⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.frm

📁 车牌识别
💻 FRM
字号:
VERSION 5.00
Begin VB.Form main 
   Caption         =   "图象处理"
   ClientHeight    =   8205
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   10635
   LinkTopic       =   "Form1"
   ScaleHeight     =   8205
   ScaleWidth      =   10635
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command2 
      Caption         =   "关闭"
      Height          =   375
      Left            =   8280
      TabIndex        =   15
      Top             =   6960
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Height          =   1575
      Left            =   840
      TabIndex        =   4
      Top             =   6120
      Width           =   7095
      Begin VB.CommandButton Command1 
         Caption         =   "随机噪声"
         Height          =   375
         Index           =   9
         Left            =   5640
         TabIndex        =   14
         Top             =   960
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "椒盐噪声"
         Height          =   375
         Index           =   8
         Left            =   4320
         TabIndex        =   13
         Top             =   960
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "梯度锐化"
         Height          =   375
         Index           =   7
         Left            =   3000
         TabIndex        =   12
         Top             =   960
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "中值滤波"
         Height          =   375
         Index           =   6
         Left            =   1680
         TabIndex        =   11
         Top             =   960
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "图象反色"
         Height          =   375
         Index           =   5
         Left            =   360
         TabIndex        =   10
         Top             =   960
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "图象旋转"
         Height          =   375
         Index           =   4
         Left            =   5640
         TabIndex        =   9
         Top             =   360
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "图象缩放"
         Height          =   375
         Index           =   3
         Left            =   4320
         TabIndex        =   8
         Top             =   360
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "图象转置"
         Height          =   375
         Index           =   2
         Left            =   3000
         TabIndex        =   7
         Top             =   360
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "水平镜象"
         Height          =   375
         Index           =   1
         Left            =   1680
         TabIndex        =   6
         Top             =   360
         Width           =   1095
      End
      Begin VB.CommandButton Command1 
         Caption         =   "垂直镜象"
         Height          =   375
         Index           =   0
         Left            =   360
         TabIndex        =   5
         Top             =   360
         Width           =   1095
      End
   End
   Begin VB.PictureBox Picture2 
      BorderStyle     =   0  'None
      Height          =   5415
      Left            =   4320
      ScaleHeight     =   5415
      ScaleWidth      =   6135
      TabIndex        =   1
      Top             =   720
      Width           =   6135
   End
   Begin VB.PictureBox Picture1 
      AutoSize        =   -1  'True
      BorderStyle     =   0  'None
      Height          =   2760
      Left            =   240
      Picture         =   "main.frx":0000
      ScaleHeight     =   2760
      ScaleWidth      =   3840
      TabIndex        =   0
      Top             =   720
      Width           =   3840
   End
   Begin VB.Label Label2 
      Caption         =   "示意图"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4320
      TabIndex        =   3
      Top             =   240
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "源图"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   360
      TabIndex        =   2
      Top             =   240
      Width           =   855
   End
End
Attribute VB_Name = "main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function MirrorBmp Lib "GeoTrans.dll" (ByVal hdcSrc As Long, ByVal hbmpSrc As Long, ByVal hDCDest As Long, ByVal bDirection As Boolean) As Integer
Private Declare Function TransposeBmp Lib "GeoTrans.dll" (ByVal hdcSrc As Long, ByVal hbmpSrc As Long, ByVal hDCDest As Long) As Integer
Private Declare Function RotateBmp Lib "GeoTrans.dll" (ByVal hdcSrc As Long, ByVal hbmpSrc As Long, ByVal hDCDest As Long, ByVal iRotateAngle As Integer) As Integer
Private Declare Function ZoomBmp Lib "GeoTrans.dll" (ByVal hdcSrc As Long, ByVal hbmpSrc As Long, ByVal hDCDest As Long, ByVal fXZoomRatio As Double, ByVal fYZoomRatio As Double) As Integer
Private Declare Function LinerTransBmp Lib "GeoTrans.dll" (ByVal hdcSrc As Long, ByVal hbmpSrc As Long, ByVal hDCDest As Long) As Integer
Private Declare Function MedianFilterBmp Lib "GeoTrans.dll" (ByVal hdcSrc As Long, ByVal hbmpSrc As Long, ByVal hDCDest As Long, ByVal iFilterH As Integer, ByVal iFilterW As Integer, ByVal iFilterMX As Integer, ByVal iFilterMY As Integer) As Integer
Private Declare Function GradSharpBmp Lib "GeoTrans.dll" (ByVal hdcSrc As Long, ByVal hbmpSrc As Long, ByVal hDCDest As Long, ByVal bThre As Byte) As Integer
Private Declare Function SaltNoiseBmp Lib "GeoTrans.dll" (ByVal hdcSrc As Long, ByVal hbmpSrc As Long, ByVal hDCDest As Long) As Integer
Private Declare Function RandomNoiseBmp Lib "GeoTrans.dll" (ByVal hdcSrc As Long, ByVal hbmpSrc As Long, ByVal hDCDest As Long) As Integer
Dim picWidth As Integer, picHeight As Integer


'Command1_功能按钮

Private Sub Command1_Click(Index As Integer)
    Dim hDCDest As Long, hBmpDest As Long
    Dim result As Integer

'    hDCDest = CreateCompatibleDC(Picture2.hDC)
'    hBmpDest = CreateCompatibleBitmap(Picture2.hDC, picWidth, picHeight)
    
    Select Case Index
        Case 0: '垂直镜象 ON_GEOM_MIRV
'            SelectObject hDCDest, hBmpDest
            Picture2.Cls
            result = MirrorBmp(Picture1.hDC, Picture1.Image.Handle, Picture2.hDC, False)
'            BitBlt Picture2.hDC, 0, 0, picWidth, picHeight, hDCDest, 0, 0, vbSrcCopy
            If result <> 1 Then
            MsgBox result
            End If
        Case 1: '水平镜象 ON_GEOM_MIRX
'            SelectObject hDCDest, hBmpDest
            Picture2.Cls
            result = MirrorBmp(Picture1.hDC, Picture1.Image.Handle, Picture2.hDC, True)
'            BitBlt Picture2.hDC, 0, 0, picWidth, picHeight, hDCDest, 0, 0, vbSrcCopy
            If result <> 1 Then
            MsgBox result
            End If
        Case 2: '图象转置 ON_GEOM_TRPO
            Picture2.Cls
            result = TransposeBmp(Picture1.hDC, Picture1.Image.Handle, Picture2.hDC)
            If result <> 1 Then
            MsgBox result
            End If
        Case 3: '图象缩放 ON_GEOM_ZOOM
            Picture2.Cls
            result = ZoomBmp(Picture1.hDC, Picture1.Image.Handle, Picture2.hDC, 3, 3)
            If result <> 1 Then
            MsgBox result
            End If
        Case 4: '图象旋转 ON_GEOM_ROTA
            Picture2.Cls
            result = RotateBmp(Picture1.hDC, Picture1.Image.Handle, Picture2.hDC, 30)
            If result <> 1 Then
            MsgBox result
            End If
        Case 5: '图象反转 ON_POINT_INVERT
            Picture2.Cls
            result = LinerTransBmp(Picture1.hDC, Picture1.Image.Handle, Picture2.hDC)
            If result <> 1 Then
            MsgBox result
            End If
        
        Case 6: '中值滤波 ON_ENHA_MIDIANF
            Picture2.Cls
            result = MedianFilterBmp(Picture1.hDC, Picture1.Image.Handle, Picture2.hDC, 3, 1, 0, 1)
            If result <> 1 Then
            MsgBox result
            End If
        
        Case 7: '梯度锐化 ON_ENHA_GRADSHARP
            Picture2.Cls
            result = GradSharpBmp(Picture1.hDC, Picture1.Image.Handle, Picture2.hDC, 5)
            If result <> 1 Then
            MsgBox result
            End If
        
        Case 8: '椒盐噪声 ON_RESTORE_SALTNOISE
            Picture2.Cls
            result = SaltNoiseBmp(Picture1.hDC, Picture1.Image.Handle, Picture2.hDC)
            If result <> 1 Then
            MsgBox result
            End If
        
        Case 9: '随机噪声 ON_RESTORE_RANDOMNOISE
            Picture2.Cls
            result = RandomNoiseBmp(Picture1.hDC, Picture1.Image.Handle, Picture2.hDC)
            If result <> 1 Then
            MsgBox result
            End If
        
    End Select
    
'    DeleteDC hDCDest
'    DeleteObject hBmpDest

End Sub

Private Sub Command2_Click()
    End
End Sub



Private Sub Form_Load()
    Dim bm As BITMAP
    

    ScaleMode = vbPixels
    
    GetObject Picture1.Image.Handle, LenB(bm), bm
    picWidth = bm.bmWidth
    picHeight = bm.bmHeight
    
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -