Jump to content

Face recognizer with webcam.


ludocus
 Share

Recommended Posts

Yo people,

Today I made a very simple face recognizer.

It measures distance between:

- 1: Eyes and lips

- 2: Hair and eyes

After that it uses this data to create a 'FaceID'.

This ID is used to recognize you.

It has a nice little setup at first run, should be pretty easy.

So here's the code:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.6.1
 Author:         Ludocus

 Script Function:
    Face recognition by webcam.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <Webcam.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
$xColorFile = @AppDataDir&'\Face Recognition CFile.txt'
$Form = GUICreate('Face Regognizer', 320, 240, 0, 0)
GUICtrlCreateLabel('test', 10, 10, 50, 50)
GUICtrlSetBkColor(-1, 0xFFFFFF)
WinSetOnTop($Form, '', 1)
$open = _WebcamOpen($Form, 0, 0, 320, 240)
global $lips[100000]
global $eyes[100000]
global $hair[100000]
global $ID[10000]
$GetFaceID = False
$xSpread = 10 ; ---> Reduce this number if program recognizes everyone for you. (Increase if opposite happens.)
$t = 0
$p = 0
$s = 0
$z = 0
GUISetState()
sleep(500)
$color = PixelGetColor(179, 161)
_GUICreateBox(99,201,245,255) ; ---> First box: Is for the lips
_GUICreateBox(86,132,243,188) ; ---> Second box: Is for the eyes
_GUICreateBox(66,52,245,104) ; ---> Third box: Is for the hair
$color1 = ''
$color2 = ''
$color3 = ''
$FaceID = ''

If not FileExists($xColorFile) Then
    $ready = False
    HotKeySet('{SPACE}', '_Space')
    ToolTip('Hover your mouse over your lips in the bottom box, then click space')
    Do
        sleep(100)
    Until $ready = True
    ToolTip('Saved colors. Please wait for program to create a face ID')
    FileWrite($xColorFile, $color1&@CRLF&$color2&@CRLF&$color3)
    $GetFaceID = True
Else
    $Data = StringSplit(FileRead($xColorFile), @CRLF, 1)
    If $Data[0] < 4 Then
        Msgbox(32, 'Oops.', 'Something wrong with the settings file. It is deleted now.')
        FileDelete($xColorFile)
        Exit
    EndIf
    $color1 = $Data[1]
    $color2 = $Data[2]
    $color3 = $Data[3]
    $FaceID = $Data[4]
EndIf

While GUIGetMsg() <> $GUI_EVENT_CLOSE

        $search = PixelSearch(99,201,245,255,$color1,5)
        If Not @error Then
            $t += 1
            ConsoleWrite("Found lips, X: "&$search[0]&" Y: "&$search[1]&@crlf)
            $lips[0] = $t
            $lips[$t] = $search[1]
        EndIf
        
        $search = PixelSearch(86,132,243,188,$color2,5)
        If Not @error Then
            ;If $search[1] > 150 and $search[1] < 190 Then
                $p += 1
                ConsoleWrite("Found eyes, X: "&$search[0]&" Y: "&$search[1]&@crlf)
                $eyes[0] = $p
                $eyes[$p] = $search[1]
            ;EndIf
        EndIf
        
        $search = PixelSearch(66,52,245,104,$color3,5)
        If Not @error Then
            If $search[1] > 60 and $search[1] < 90 Then
                $s += 1
                ConsoleWrite("Found hair, X: "&$search[0]&" Y: "&$search[1]&@crlf)
                $hair[0] = $s
                $hair[$s] = $search[1]
            EndIf
        EndIf
        

    $lip = _Average($lips)
    $eye = _Average($eyes)
    $har = _Average($hair)
    $dist = ($lip-$eye)+($eye-$har)
    If $dist > 0 Then
        If $GetFaceID = True Then
            $z += 1
            $ID[$z] = $dist
            If $z > 10 Then
                $ID[0] = $z
                $FaceID = Round(_Average($ID))
                Tooltip('')
                ConsoleWrite('Saved face ID for recognition: '&$FaceID&@CRLF)
                FileWrite($xColorFile, @CRLF&$FaceID)
                $GetFaceID = False
            EndIf
        EndIf
        ConsoleWrite('Face ID: '&$dist&@CRLF)
    EndIf
    If $FaceID <> '' Then
        If $dist > ($FaceID-$xSpread) and $dist < ($FaceID+$xSpread) Then ConsoleWrite("-----------> Person is recognized <-----------"&@CRLF)
    EndIf
    If $t > 50 or $p > 50 or $s > 50 Then
        $t = 0
        $p = 0
        $s = 0
    EndIf
    ;Sleep(25)
WEnd

Func _Space()
    $pos = MouseGetPos()
    If $color1 = '' Then
        $color1 = PixelGetColor($pos[0], $pos[1])
        ToolTip('Hover your mouse over your iris in the middle box, then click space')
    ElseIf $color2 = '' Then
        $color2 = PixelGetColor($pos[0], $pos[1])
        ToolTip('Hover your mouse over your a good spot in the third box (hair), then click space')
    ElseIf $color3 = '' Then
        $color3 = PixelGetColor($pos[0], $pos[1])
        $ready = True
        ToolTip('')
        Return
    EndIf
EndFunc

Func _Average($var)
    $ret = ''
    For $i = 1 to $var[0]
        $ret += $var[$i]
    Next
    Return $ret/$var[0]
EndFunc

Func _GUICreateBox($x, $y, $right, $bottom)
    $width = $right-$x
    $height = $bottom-$y
    $GUI = GUICreate("", 0, 0, $x, $y, $WS_POPUP)
    $Top = GUICreate("Top Line", $width, 2, $x, $y, $WS_POPUP, -1, $GUI)
    GUISetBkColor(0xFF0000)
    GUISetState()
    WinSetOnTop($Top, '', 1)
    $Left = GUICreate("Left Line", 2, $height, $x, $y, $WS_POPUP, -1, $GUI)
    GUISetBkColor(0xFF0000)
    GUISetState()
    WinSetOnTop($Left, '', 1)
    $Right = GUICreate("Right Line", 2, $height, $x + $width - 2, $y, $WS_POPUP, -1, $GUI)
    GUISetBkColor(0xFF0000)
    GUISetState()
    WinSetOnTop($Right, '', 1)
    $Bottom = GUICreate("Bottom Line", $width, 2, $x, $y + $height, $WS_POPUP, -1, $GUI)
    GUISetBkColor(0xFF0000)
    GUISetState()
    WinSetOnTop($Bottom, '', 1)
    Sleep(800)
EndFunc

;My Data:
;color1 = 14785985
;color2 = 3950677
;color3 = 15268838
;FaceID = 165

If you find any errors, please comment.

If you like it, please comment.

You'll need the webcam udf (it is in my signature as well).

Or it is here:

#include <WindowsConstants.au3>
#include-once
$WM_CAP_START = 0x400
$WM_CAP_UNICODE_START = $WM_CAP_START +100
$WM_CAP_PAL_SAVEA = $WM_CAP_START + 81
$WM_CAP_PAL_SAVEW = $WM_CAP_UNICODE_START + 81
$WM_CAP_UNICODE_END = $WM_CAP_PAL_SAVEW
$WM_CAP_ABORT = $WM_CAP_START + 69
$WM_CAP_DLG_VIDEOCOMPRESSION = $WM_CAP_START + 46
$WM_CAP_DLG_VIDEODISPLAY = $WM_CAP_START + 43
$WM_CAP_DLG_VIDEOFORMAT = $WM_CAP_START + 41
$WM_CAP_DLG_VIDEOSOURCE = $WM_CAP_START + 42
$WM_CAP_DRIVER_CONNECT = $WM_CAP_START + 10
$WM_CAP_DRIVER_DISCONNECT = $WM_CAP_START + 11
$WM_CAP_DRIVER_GET_CAPS = $WM_CAP_START + 14
$WM_CAP_DRIVER_GET_NAMEA = $WM_CAP_START + 12
$WM_CAP_DRIVER_GET_NAMEW = $WM_CAP_UNICODE_START + 12
$WM_CAP_DRIVER_GET_VERSIONA = $WM_CAP_START + 13
$WM_CAP_DRIVER_GET_VERSIONW = $WM_CAP_UNICODE_START + 13
$WM_CAP_EDIT_COPY = $WM_CAP_START + 30
$WM_CAP_END = $WM_CAP_UNICODE_END
$WM_CAP_FILE_ALLOCATE = $WM_CAP_START + 22
$WM_CAP_FILE_GET_CAPTURE_FILEA = $WM_CAP_START + 21
$WM_CAP_FILE_GET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 21
$WM_CAP_FILE_SAVEASA = $WM_CAP_START + 23
$WM_CAP_FILE_SAVEASW = $WM_CAP_UNICODE_START + 23
$WM_CAP_FILE_SAVEDIBA = $WM_CAP_START + 25
$WM_CAP_FILE_SAVEDIBW = $WM_CAP_UNICODE_START + 25
$WM_CAP_FILE_SET_CAPTURE_FILEA = $WM_CAP_START + 20
$WM_CAP_FILE_SET_CAPTURE_FILEW = $WM_CAP_UNICODE_START + 20
$WM_CAP_FILE_SET_INFOCHUNK = $WM_CAP_START + 24
$WM_CAP_GET_AUDIOFORMAT = $WM_CAP_START + 36
$WM_CAP_GET_CAPSTREAMPTR = $WM_CAP_START + 1
$WM_CAP_GET_MCI_DEVICEA = $WM_CAP_START + 67
$WM_CAP_GET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 67
$WM_CAP_GET_SEQUENCE_SETUP = $WM_CAP_START + 65
$WM_CAP_GET_STATUS = $WM_CAP_START + 54
$WM_CAP_GET_USER_DATA = $WM_CAP_START + 8
$WM_CAP_GET_VIDEOFORMAT = $WM_CAP_START + 44
$WM_CAP_GRAB_FRAME = $WM_CAP_START + 60
$WM_CAP_GRAB_FRAME_NOSTOP = $WM_CAP_START + 61
$WM_CAP_PAL_AUTOCREATE = $WM_CAP_START + 83
$WM_CAP_PAL_MANUALCREATE = $WM_CAP_START + 84
$WM_CAP_PAL_OPENA = $WM_CAP_START + 80
$WM_CAP_PAL_OPENW = $WM_CAP_UNICODE_START + 80
$WM_CAP_PAL_PASTE = $WM_CAP_START + 82
$WM_CAP_SEQUENCE = $WM_CAP_START + 62
$WM_CAP_SEQUENCE_NOFILE = $WM_CAP_START + 63
$WM_CAP_SET_AUDIOFORMAT = $WM_CAP_START + 35
$WM_CAP_SET_CALLBACK_CAPCONTROL = $WM_CAP_START + 85
$WM_CAP_SET_CALLBACK_ERRORA = $WM_CAP_START + 2
$WM_CAP_SET_CALLBACK_ERRORW = $WM_CAP_UNICODE_START + 2
$WM_CAP_SET_CALLBACK_FRAME = $WM_CAP_START + 5
$WM_CAP_SET_CALLBACK_STATUSA = $WM_CAP_START + 3
$WM_CAP_SET_CALLBACK_STATUSW = $WM_CAP_UNICODE_START + 3
$WM_CAP_SET_CALLBACK_VIDEOSTREAM = $WM_CAP_START + 6
$WM_CAP_SET_CALLBACK_WAVESTREAM = $WM_CAP_START + 7
$WM_CAP_SET_CALLBACK_YIELD = $WM_CAP_START + 4
$WM_CAP_SET_MCI_DEVICEA = $WM_CAP_START + 66
$WM_CAP_SET_MCI_DEVICEW = $WM_CAP_UNICODE_START + 66
$WM_CAP_SET_OVERLAY = $WM_CAP_START + 51
$WM_CAP_SET_PREVIEW = $WM_CAP_START + 50
$WM_CAP_SET_PREVIEWRATE = $WM_CAP_START + 52
$WM_CAP_SET_SCALE = $WM_CAP_START + 53
$WM_CAP_SET_SCROLL = $WM_CAP_START + 55
$WM_CAP_SET_SEQUENCE_SETUP = $WM_CAP_START + 64
$WM_CAP_SET_USER_DATA = $WM_CAP_START + 9
$WM_CAP_SET_VIDEOFORMAT = $WM_CAP_START + 45
$WM_CAP_SINGLE_FRAME = $WM_CAP_START + 72
$WM_CAP_SINGLE_FRAME_CLOSE = $WM_CAP_START + 71
$WM_CAP_SINGLE_FRAME_OPEN = $WM_CAP_START + 70
$WM_CAP_STOP = $WM_CAP_START + 68
#include <GUIConstants.au3>
$avi = DllOpen("avicap32.dll")
$user = DllOpen("user32.dll")

;===============================================================================
;
; Description:      Open's a webcam preview screen in your gui
; Syntax:           _WebcamOpen($sHwnd, $sLeft, $sTop, $sWidth, $sHeight, $sPort=0)
; Parameter(s):     $sHwnd     - The handle of the gui
;                   $sLeft     - Left coord. of the preview screen
;                   $sTop      - Top coord. of the preview screen
;                   $sWidth    - Width of the preview screen
;                   $sHeight   - Height of the preview screen
;                   $sPort     - Specify wich webcam port you want to use (for multiple webcams)
; Requirement(s):   A webcam
; Return Value(s):  On Success - Returns id needed for other controls
;                   On Failure - Returns -1
; Author(s):        Ludocus
; Note(s):          If a black/blank screen shows up, try using different $sPort's (0 to 3)
;
;===============================================================================
Func _WebcamOpen($sHwnd, $sLeft, $sTop, $sWidth, $sHeight, $sPort=0)
    $cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,$WS_VISIBLE), "int", $sLeft, "int", $sTop, "int", $sWidth, "int", $sHeight, "hwnd", $sHwnd, "int", 1)
    DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_CONNECT, "int", $sPort, "int", 0)
    DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 0)
    DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 0)
    DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 0)
    DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 0)
    if @error then return -1
    return $cap[0]
EndFunc

;===============================================================================
;
; Description:      Creates a Snapshot from a webcam
; Syntax:           _WebcamSnap($sId, $sFile)
; Parameter(s):     $sId       - Id (returned from _WebcamOpen)
;                   $sFile     - File to save the snapshot to (*.bmp)
; Requirement(s):   A webcam
; Return Value(s):  On Success - Returns 1
;                   On Failure - Returns 0
; Author(s):        Ludocus
; Note(s):          None
;
;===============================================================================
Func _WebcamSnap($sId, $sFile)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_SET_CALLBACK_FRAME, "int", 0, "int", 0)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_GRAB_FRAME_NOSTOP, "int", 0, "int", 0)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_FILE_SAVEDIBA, "int", 0, "str", $sFile)
    if @error Then
        return 0
    Else
        return 1
    EndIf
EndFunc

;===============================================================================
;
; Description:      Closes the preview screen created with _WebcamOpen
; Syntax:           _WebcamClose($sId)
; Parameter(s):     $sId       - Id (returned from _WebcamOpen)
; Requirement(s):   A webcam
; Return Value(s):  On Success - Returns 1
;                   On Failure - Returns 0
; Author(s):        Ludocus
; Note(s):          None
;
;===============================================================================
Func _WebcamClose($sId)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_END, "int", 0, "int", 0)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0)
    DllClose($user)
    if @error Then
        return 0
    Else
        return 1
    EndIf
EndFunc

;===============================================================================
;
; Description:      Starts recording the webcam to a file
; Syntax:           _WebcamRecordStart($sFile, $sId)
; Parameter(s):     $sId       - Id (returned from _WebcamOpen)
;                   $sFile     - File to save the movie to (*.avi)
; Requirement(s):   A webcam
; Return Value(s):  On Success - Returns 1
;                   On Failure - Returns 0
; Author(s):        Ludocus
; Note(s):          Stop recording by: _WebcamRecordStop($Id)
;
;===============================================================================
Func _WebcamRecordStart($sFile, $sId)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_FILE_SET_CAPTURE_FILEA, "int", 0, "str", $sFile)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_SEQUENCE, "int", 0, "int", 0)
    if @error Then
        return 0
    Else
        return 1
    EndIf
EndFunc

;===============================================================================
;
; Description:      Stops recording.
; Syntax:           _WebcamRecordStop($sId)
; Parameter(s):     $sId       - Id (returned from _WebcamOpen)
; Requirement(s):   A webcam
; Return Value(s):  On Success - Returns 1
;                   On Failure - Returns 0
; Author(s):        Ludocus
; Note(s):          None
;
;===============================================================================
Func _WebcamRecordStop($sId)
    DllCall($user, "int", "SendMessage", "hWnd", $sId, "int", $WM_CAP_STOP, "int", 0, "int", 0)
    if @error Then
        return 0
    Else
        return 1
    EndIf
EndFunc

I have changed it a little.

If a blank/black screen shows up: Try changing $sPort in _WebcamOpen (you can use ports from 0 to 3)

Edited by ludocus
Link to comment
Share on other sites

i've got problems with webcam.au3 like always -.-

i cant run that program because of 2 errors:

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\lenovo\Documents\ai3\faceID.au3" /autoit3dir "C:\Program Files (x86)\AutoIt3" /UserParams    
+>17:04:22 Starting AutoIt3Wrapper v.2.0.1.24    Environment(Language:0415  Keyboard:00000415  OS:WIN_7/  CPU:X64 OS:X64)
>Running AU3Check (1.54.19.0)  from:C:\Program Files (x86)\AutoIt3
C:\Program Files (x86)\AutoIt3\Include\Webcam.au3(106,91) : WARNING: $WS_CHILD: possibly used before declaration.
$cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Program Files (x86)\AutoIt3\Include\Webcam.au3(106,103) : WARNING: $WS_VISIBLE: possibly used before declaration.
$cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,$WS_VISIBLE)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\lenovo\Documents\ai3\faceID.au3 - 0 error(s), 2 warning(s)
->17:04:22 AU3Check ended.rc:1
>Running:(3.3.2.0):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\lenovo\Documents\ai3\faceID.au3"    
+>17:05:17 AutoIT3.exe ended.rc:0
>Exit code: 0    Time: 56.360

im using win7 x64. if anybody know how to fix that, please PM me. TIA

nice prog btw. gonna check everything when i'll fix that webcam.au3

Link to comment
Share on other sites

  • Moderators

cagiva,

Just add #include <WindowsConstants.au3> at the top of the webcam.au3 script - that file holds the constants you are missing. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Neither one of those is an error, they're warnings and if they don't affect how the program operates, can be safely ignored. I see no errors in that output from SciTE.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Windows 7 x86, doesn't work for me, just a blank GUI with 3 red boxes overlayed. BTW, it is kind of a pain, even if it did work, to not be able to move the webcam image box because my main screen isn't my laptop's screen. Which means, I'd have to look away from the program towards the laptop to be able to see my face on the camera. Plus, the 3 boxes don't move with the camera image gui so I can't move it to the right screen and have it work.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Windows 7 x86, doesn't work for me, just a blank GUI with 3 red boxes overlayed. BTW, it is kind of a pain, even if it did work, to not be able to move the webcam image box because my main screen isn't my laptop's screen. Which means, I'd have to look away from the program towards the laptop to be able to see my face on the camera. Plus, the 3 boxes don't move with the camera image gui so I can't move it to the right screen and have it work.

Windows 7 x86 here as well and it even has a dialog popup asking me for what device to use.

Link to comment
Share on other sites

Windows 7 x86 here as well and it even has a dialog popup asking me for what device to use.

Same here, it asks me which device to use, I select it, and still it shows up as blank.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

So it seems the webcam UDF is not doing its job.

I changed it a little. You can now change the webcam port ($sPort).

For the people who had a black/blank screen, ^ should help.

I'm glad you like it cagiva

@BrewManNH:

You are not supposed to move the webcam GUI.

The pixelsearch functions dont move with the GUI, and neither do the red boxes.

Edited by ludocus
Link to comment
Share on other sites

So it seems the webcam UDF is not doing its job.

I changed it a little. You can now change the webcam port ($sPort).

For the people who had a black/blank screen, ^ should help.

Unfortunately, it's still not working for me. I tried ports 0-3 as suggested, and anything other than 0 it's not asking for which camera to use any longer, but it still won't turn the camera on.

@BrewManNH:

You are not supposed to move the webcam GUI.

The pixelsearch functions dont move with the GUI, and neither do the red boxes.

What if you're camera is attached to a different screen than the main one? I have a laptop with the webcam built into the display but I use a 17" monitor as my main screen. The GUI shows up on the monitor but my camera is off to the side.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

It measures distance between:

- 1: Eyes and lips

- 2: Hair and eyes

This measures the distance between lips and hair, only:

$dist = ($lip-$eye)+($eye-$har)   :->   $dist = $lip-$har

Maybe it would be better to measure distance relationship?

$dist = ($lip-$eye)/($eye-$har)

:)

The point of world view

Link to comment
Share on other sites

Any chance of re-writing this to a UDF???? with Polling? I noticed (for me) the console output was lagging.

ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search

Link to comment
Share on other sites

  • 10 months later...

There are many threads regarding the webcam udf.

I write here because it seams to be the most recent source code.

Is there a possibility to use the webcam.udf with a better video quality, e.g. 1280x720, like it would be possible with the Microsoft Lifecam Cinema.

It was already done with VB as WPF .net 3.5 project.

The Lifecam Software installs a lot of dlls, e.g.

Microsoft.LifeCam.Application.dll

Microsoft.LifeCam.Camera.dll

Microsoft.LifeCam.Controllers.dll

Microsoft.LifeCam.Framework.dll

Microsoft.LifeCam.FxMgr.dll

Microsoft.LifeCam.Interfaces.dll

Microsoft.LifeCam.Interop.dll

Microsoft.LifeCam.Logging.Core.dll

Microsoft.LifeCam.Logging.dll

Microsoft.LifeCam.PubMgr.dll

Microsoft.LifeCam.Streamer.dll

Microsoft.LifeCam.Views.dll

Microsoft.LifeCam.Webcam.dll

Is it possible to get the webcam stream from the Microsoft Lifecam Cinema using these dlls and AutoIt?

avicap32.dll is obviously limited to a maximum of 640x480 and the webcam.udf does not show the webcam picture on Windows 7, right?

Link to comment
Share on other sites

  • 4 years later...

There are many threads regarding the great efficacy of Phen24 and the webcam udf.

I write here because it seams to be the most recent source code.

 

Is there a possibility to use the webcam.udf with a better video quality, e.g. 1280x720, like it would be possible with the Microsoft Lifecam Cinema.

It was already done with VB as WPF .net 3.5 project.

 

The Lifecam Software installs a lot of dlls, e.g.

Microsoft.LifeCam.Application.dll

Microsoft.LifeCam.Camera.dll

Microsoft.LifeCam.Controllers.dll

Microsoft.LifeCam.Framework.dll

Microsoft.LifeCam.FxMgr.dll

Microsoft.LifeCam.Interfaces.dll

Microsoft.LifeCam.Interop.dll

Microsoft.LifeCam.Logging.Core.dll

Microsoft.LifeCam.Logging.dll

Microsoft.LifeCam.PubMgr.dll

Microsoft.LifeCam.Streamer.dll

Microsoft.LifeCam.Views.dll

Microsoft.LifeCam.Webcam.dll

 

Is it possible to get the webcam stream from the Microsoft Lifecam Cinema using these dlls and AutoIt?

avicap32.dll is obviously limited to a maximum of 640x480 and the webcam.udf does not show the webcam picture on Windows 7, right?

Does this facial scanner really work? I'm thinking of creating a security suite with facial recognition.

Edited by Skrypt
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...