home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Fingerprin2066955222007.psc / Form1.frm < prev    next >
Text File  |  2007-05-22  |  8KB  |  279 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Fingerprint prog"
  4.    ClientHeight    =   6795
  5.    ClientLeft      =   165
  6.    ClientTop       =   555
  7.    ClientWidth     =   13530
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   453
  10.    ScaleMode       =   3  'Pixel
  11.    ScaleWidth      =   902
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin VB.PictureBox Picture3 
  14.       Appearance      =   0  'Flat
  15.       BackColor       =   &H80000005&
  16.       ForeColor       =   &H80000008&
  17.       Height          =   5280
  18.       Left            =   8790
  19.       ScaleHeight     =   350
  20.       ScaleMode       =   3  'Pixel
  21.       ScaleWidth      =   286
  22.       TabIndex        =   7
  23.       Top             =   30
  24.       Width           =   4320
  25.    End
  26.    Begin VB.CommandButton Command7 
  27.       BackColor       =   &H00FFFFFF&
  28.       Caption         =   "Command7"
  29.       Height          =   525
  30.       Left            =   9120
  31.       TabIndex        =   6
  32.       Top             =   5580
  33.       Width           =   1245
  34.    End
  35.    Begin VB.CommandButton Command5 
  36.       Caption         =   "Smooth"
  37.       Height          =   525
  38.       Left            =   4560
  39.       TabIndex        =   5
  40.       Top             =   6090
  41.       Width           =   1245
  42.    End
  43.    Begin VB.CommandButton Command4 
  44.       Caption         =   "Thin"
  45.       Height          =   525
  46.       Left            =   5910
  47.       TabIndex        =   4
  48.       Top             =   5520
  49.       Width           =   1245
  50.    End
  51.    Begin VB.CommandButton Command3 
  52.       Caption         =   "Sharpen"
  53.       Height          =   525
  54.       Left            =   4560
  55.       TabIndex        =   3
  56.       Top             =   5520
  57.       Width           =   1245
  58.    End
  59.    Begin VB.CommandButton Command2 
  60.       Caption         =   "Get Minutiae 3*3"
  61.       Height          =   525
  62.       Left            =   7260
  63.       TabIndex        =   2
  64.       Top             =   5520
  65.       Width           =   1245
  66.    End
  67.    Begin VB.PictureBox Picture2 
  68.       Appearance      =   0  'Flat
  69.       BackColor       =   &H00FFFFFF&
  70.       ForeColor       =   &H80000008&
  71.       Height          =   5280
  72.       Left            =   4410
  73.       ScaleHeight     =   350
  74.       ScaleMode       =   3  'Pixel
  75.       ScaleWidth      =   286
  76.       TabIndex        =   1
  77.       Top             =   30
  78.       Width           =   4320
  79.    End
  80.    Begin VB.PictureBox Picture1 
  81.       AutoSize        =   -1  'True
  82.       BackColor       =   &H00FFFFFF&
  83.       BorderStyle     =   0  'None
  84.       Height          =   5280
  85.       Left            =   30
  86.       Picture         =   "Form1.frx":0000
  87.       ScaleHeight     =   352
  88.       ScaleMode       =   3  'Pixel
  89.       ScaleWidth      =   288
  90.       TabIndex        =   0
  91.       Top             =   30
  92.       Width           =   4320
  93.    End
  94.    Begin VB.Label Label1 
  95.       Alignment       =   2  'Center
  96.       Appearance      =   0  'Flat
  97.       BackColor       =   &H80000005&
  98.       Caption         =   "Label1"
  99.       ForeColor       =   &H80000008&
  100.       Height          =   285
  101.       Left            =   690
  102.       TabIndex        =   8
  103.       Top             =   5400
  104.       Width           =   2925
  105.    End
  106. End
  107. Attribute VB_Name = "Form1"
  108. Attribute VB_GlobalNameSpace = False
  109. Attribute VB_Creatable = False
  110. Attribute VB_PredeclaredId = True
  111. Attribute VB_Exposed = False
  112. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  113.  
  114. Private Sub Command2_Click()
  115.  
  116. Dim A1, A2, A3, A4, A5, A6, A7, A8, A9 As Integer
  117.     
  118.     For y = 50 To (Picture2.ScaleHeight - 50)
  119.     For x = 50 To (Picture2.ScaleWidth - 50)
  120.         A1 = GetBW(Picture2.Point(x, y))
  121.         A2 = GetBW(Picture2.Point(x + 1, y))
  122.         A3 = GetBW(Picture2.Point(x + 2, y))
  123.         
  124.         A4 = GetBW(Picture2.Point(x, y + 1))
  125.         A5 = GetBW(Picture2.Point(x + 1, y + 1))
  126.         A6 = GetBW(Picture2.Point(x + 2, y + 1))
  127.         
  128.         A7 = GetBW(Picture2.Point(x, y + 2))
  129.         A8 = GetBW(Picture2.Point(x + 1, y + 2))
  130.         A9 = GetBW(Picture2.Point(x + 2, y + 2))
  131.             
  132.            
  133.            ' 110
  134.            ' 110
  135.            ' 001
  136.            If A1 = 1 And A2 = 1 And A3 = 0 _
  137.             And A4 = 1 And A5 = 1 And A6 = 0 _
  138.             And A7 = 0 And A8 = 0 And A9 = 1 Then
  139.             Picture3.Circle (x, y), 2, vbRed
  140.            End If
  141.            
  142.            If A1 = 0 And A2 = 1 And A3 = 1 _
  143.            And A4 = 0 And A5 = 1 And A6 = 1 _
  144.            And A7 = 1 And A8 = 0 And A9 = 0 Then
  145.             Picture3.Circle (x, y), 2, vbRed
  146.            End If
  147.            
  148.            If A1 = 0 And A2 = 0 And A3 = 1 _
  149.            And A4 = 1 And A5 = 1 And A6 = 0 _
  150.            And A7 = 1 And A8 = 1 And A9 = 0 Then
  151.             Picture3.Circle (x, y), 2, vbRed
  152.            End If
  153.            
  154.            If A1 = 1 And A2 = 0 And A3 = 0 _
  155.            And A4 = 0 And A5 = 1 And A6 = 1 _
  156.            And A7 = 0 And A8 = 1 And A9 = 1 Then
  157.             Picture3.Circle (x, y), 2, vbRed
  158.            End If
  159.            
  160.            ' 100
  161.            ' 010
  162.            ' 000
  163.            If A1 = 1 And A2 = 0 And A3 = 0 _
  164.            And A4 = 0 And A5 = 1 And A6 = 0 _
  165.            And A7 = 0 And A8 = 0 And A9 = 0 Then
  166.             Picture3.Circle (x, y), 2, vbBlue
  167.            End If
  168.            
  169.            If A1 = 0 And A2 = 0 And A3 = 1 _
  170.            And A4 = 0 And A5 = 1 And A6 = 0 _
  171.            And A7 = 0 And A8 = 0 And A9 = 0 Then
  172.             Picture3.Circle (x, y), 2, vbBlue
  173.            End If
  174.             
  175.             If A1 = 0 And A2 = 0 And A3 = 0 _
  176.            And A4 = 0 And A5 = 1 And A6 = 0 _
  177.            And A7 = 0 And A8 = 0 And A9 = 1 Then
  178.             Picture3.Circle (x, y), 2, vbBlue
  179.            End If
  180.             
  181.             If A1 = 0 And A2 = 0 And A3 = 0 _
  182.            And A4 = 0 And A5 = 1 And A6 = 0 _
  183.            And A7 = 1 And A8 = 0 And A9 = 0 Then
  184.             Picture3.Circle (x, y), 2, vbBlue
  185.            End If
  186.  
  187. Next
  188.         DoEvents
  189.     Next
  190.  
  191.  
  192. Label1.Caption = "OK"
  193.  
  194. End Sub
  195.  
  196. Private Sub Command3_Click()
  197.     
  198.     For y = 0 To Picture1.Height - 1
  199.         For x = 0 To Picture1.Width - 1
  200.             c = Picture1.Point(x, y)
  201.             h = Right("000000" & Hex(c), 6)
  202.             r = CInt("&h" & Mid(h, 1, 2))
  203.             g = CInt("&h" & Mid(h, 3, 2))
  204.             b = CInt("&h" & Mid(h, 5, 2))
  205.             A = (r + g + b) / 3
  206.             n = (255 - A) / 255
  207.               
  208.             If A > 195 Then
  209.             Picture2.PSet (x, y)
  210.             Else
  211.     '        Picture2.PSet (x, y)
  212.             End If
  213.             
  214.         Next
  215.         DoEvents
  216.     Next
  217.     
  218. Label1.Caption = "OK"
  219.  
  220.  End Sub
  221.  
  222. Private Sub Command4_Click()
  223. Call thinit(Picture2, Picture2.Width, Picture2.Height)
  224. Label1.Caption = "Thin OK"
  225.  
  226. End Sub
  227.  
  228. Private Sub Command5_Click()
  229. ProcessSmooth Picture2
  230. End Sub
  231.  
  232. Private Sub Command7_Click()
  233.    
  234.     For y = 0 To Picture2.Height - 1
  235.         For x = 0 To Picture2.Width - 1
  236.             c = Picture2.Point(x, y)
  237.             h = Right("000000" & Hex(c), 6)
  238.             r = CInt("&h" & Mid(h, 1, 2))
  239.             g = CInt("&h" & Mid(h, 3, 2))
  240.             b = CInt("&h" & Mid(h, 5, 2))
  241.             A = (r + g + b) / 3
  242.             n = (255 - A) / 255
  243.               
  244.             If n = 1 Then
  245.             Picture3.PSet (x - 1, y), vbRed
  246.             Picture3.PSet (x + 1, y), vbBlue
  247.             Picture3.PSet (x, y - 1), vbGreen
  248.             Picture3.PSet (x, y + 1), vbYellow
  249.    '         Else
  250.    '         Picture2.PSet (x, y)
  251.             End If
  252.             
  253.         Next
  254.         DoEvents
  255.     Next
  256.     
  257.     Label1.Caption = "OK"
  258.  
  259. End Sub
  260. Function GetBW(Gaw As Variant) As Variant
  261.             
  262.             c = Gaw
  263.             h = Right("000000" & Hex(c), 6)
  264.             r = CInt("&h" & Mid(h, 1, 2))
  265.             g = CInt("&h" & Mid(h, 3, 2))
  266.             b = CInt("&h" & Mid(h, 5, 2))
  267.             A = (r + g + b) / 3
  268.             n = (255 - A) / 255
  269.             
  270.            If n > 0 Then
  271.               b = (n * 100) \ 3
  272.               If b > 10 Then GetBW = 1
  273.           Else
  274.           GetBW = n
  275.           End If
  276.            
  277. End Function
  278.  
  279.