Yogui Posted April 24, 2010 Posted April 24, 2010 I found this code on the German site, Can use me to put on (it) Thank you in advance expandcollapse popup#include <GDIPlus.au3> #include <WinAPI.au3> #include <Array.au3> $hOpen = DllOpen("fdlib.dll") _GDIPlus_Startup() $hbBMP = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\geeks.jpg") $iWidth = _GDIPlus_ImageGetWidth($hbBMP) $iHeight = _GDIPlus_ImageGetHeight($hbBMP) $hBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hbBMP) $iThreshold = Number(InputBox("Threshold", "Threshold")) If $iThreshold < 1 Then $iThreshold = 1 $vBMP = _GDIPlus_BitmapToStructByte($hBMP, $iWidth, $iHeight) DllCall($hOpen, "int:cdecl", "fdlib_detectfaces", "ptr", DllStructGetPtr($vBMP), "int", $iWidth, "int", $iHeight, "int", $iThreshold) $nFace = DllCall($hOpen, "int:cdecl", "fdlib_getndetections") If Not @error Then MsgBox(0, "", $nFace[0]) $nFace = $nFace[0] Else MsgBox(0, "", @error) Exit EndIf $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) $hGraph = _GDIPlus_ImageGetGraphicsContext($hImage) $hPen = _GDIPlus_PenCreate(0xFFFF0000) Dim $aFaces,$iX,$iY,$iSize If $nFace > 0 Then Dim $aFaces[$nFace][4] For $i = 0 To $nFace - 1 $nextFace = DllCall($hOpen, "int:cdecl", "fdlib_getdetection", "int", $i, "int*", $iX + $i, "int*", $iY + $i, "int*", $iSize + $i) If Not @error Then $iX = $nextFace[2] $iY = $nextFace[3] $iSize = $nextFace[4] _GDIPlus_GraphicsDrawRect($hGraph,$iX,$iY,$iSize,$iSize,$hPen) $aFaces[$i][0] = $i $aFaces[$i][1] = $iX $aFaces[$i][2] = $iY $aFaces[$i][3] = $iSize EndIf Next EndIf _GDIPlus_ImageSaveToFile($hImage,@ScriptDir&"\geeks2.jpg") _ArrayDisplay($aFaces) DllClose($hOpen) Func _GDIPlus_BitmapToStructByte($hBMP, $iW, $iH) Local $x, $y, $z, $sErrorHandlerString, $hDC, $hDC_tmp, $hBitmap, $vStruct_Byte, $vStruct_BMPInfo Local $hBitmap = DllCall("User32.dll", "hwnd", "CopyImage", "hwnd", $hBMP, "int", 0, "int", 0, "int", 0, "int", 1);LR_MONOCHROME If @error Then Return SetError(1, 0, _WinAPI_GetLastErrorMessage()) $hBitmap = $hBitmap[0] $vStruct_Byte = DllStructCreate("byte graydata[" & $iW * $iH & "]") Local $vStruct_BMPInfo = DllStructCreate("dword;long;long;ushort;ushort;dword;dword;long;long;dword;dword;dword RGBQuad[256];") $hDC_tmp = _WinAPI_GetDC(_WinAPI_GetDesktopWindow()) $hDC = _WinAPI_CreateCompatibleDC($hDC_tmp) _WinAPI_ReleaseDC(0, $hDC_tmp) Local $hBitmapOld = _WinAPI_SelectObject($hDC, $hBitmap) DllStructSetData($vStruct_BMPInfo, 1, DllStructGetSize(DllStructCreate("dword;long;long;ushort;ushort;dword;dword;long;long;dword;dword;", 1))) DllStructSetData($vStruct_BMPInfo, 2, $iW) DllStructSetData($vStruct_BMPInfo, 3, $iH * - 1) DllStructSetData($vStruct_BMPInfo, 4, 1) DllStructSetData($vStruct_BMPInfo, 5, 1) _WinAPI_GetDIBits($hDC, $hBitmap, 0, $iH, DllStructGetPtr($vStruct_Byte), DllStructGetPtr($vStruct_BMPInfo), 0) _WinAPI_DeleteObject(_WinAPI_SelectObject($hDC, $hBitmapOld)) _WinAPI_DeleteDC($hDC) Return $vStruct_Byte EndFunc ;==>_GDIPlus_BitmapToStructByte
JohnOne Posted April 24, 2010 Posted April 24, 2010 Sorry, I cant understand what it is you are needing help with. Can you explain a little about what you have posted ? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Yogui Posted April 24, 2010 Author Posted April 24, 2010 This script has to find faces in one embellish with images and to spot them but it does not work: (I have to try to modify it but without any success...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now