Search the Community
Showing results for tags 'capture_gama'.
-
was playing with my webcam using mylise's script from https://www.autoitscript.com/forum/topic/150536-simple-webcam-access-using-escapi/ . I'm trying to set the contrast and brightness with the new escapi.dll, found here http://sol.gfxile.net/zip/escapi3.zip but fail to understand how to implement it, i tried to call the dll with VideoProcAmp_Gamma and CAPTURE_GAMMA but it seems I'm doing it wrong, dllcall keeps returning the default brightness value as if i didn't call the Gama parameters, of which i don't even know if im doing it the correct way. i got the VideoProcAmp_Gamma and CAPTURE_GAMMA from https://github.com/jarikomppa/escapi/blob/master/escapi_dll/capture.cpp . but dont know for sure with which int i can call the dll with ;-------------------------------------------------------------------------- ; ESCAPI is a very simple DLL interface to use video capture devices ; (most commonly webcams, but also video in devices and other similar things) ; Get dll from --> [url="http://sol.gfxile.net/escapi/index.html"]http://sol.gfxile.net/escapi/index.html[/url] ; #include <GDIplus.au3> #include <GUIConstantsEx.au3> ;-------------------------------------------------------------------------- ; Local variables Local $Width = 320 ;Escapi seems to use 640x480 (or lower) as webcam resolution and will Local $Height = 240 ; adjust the image size to $Width by $Height ;-------------------------------------------------------------------------- ; variables required for dshow escapi Local $tagSimpleCapParams = _ "ptr mTargetBuf;" & _ "int mWidth;" & _ "int mHeight;" Local $tSimpleCapParams = DllStructCreate($tagSimpleCapParams) Local $tTargetBuf = DllStructCreate("BYTE[" & $Width * $Height * 4 & "]") Global $pTargetBuf = DllStructGetPtr($tTargetBuf) DllStructSetData($tSimpleCapParams, 1, $pTargetBuf) DllStructSetData($tSimpleCapParams, 2, $Width) DllStructSetData($tSimpleCapParams, 3, $Height) Local $pSimpleCapParams = DllStructGetPtr($tSimpleCapParams) Local $device = 0 ;change this number to select dshow device ;--------------------------------------------------------------------------- ;Escapi init Local $_escapi_Dll = DllOpen("escapi.dll") $return = DllCall($_escapi_Dll, "int", "initCOM") $return = DllCall($_escapi_Dll, "int:cdecl", "initCapture", "int", $device, "ptr", $pSimpleCapParams) ;--------------------------------------------------------------------------- ; GUI and GDI init Global $hwnd = GUICreate("EscApi WebCam", $Width, $Height) GUISetState(@SW_SHOW, $hwnd) _GDIPlus_Startup() Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) $C_timer = TimerInit() While 1 ;--------------------------------------------------------------------------- ;Get frame DllCall($_escapi_Dll, "none:cdecl", "doCapture", "int", 0) Do $return = DllCall($_escapi_Dll, "int:cdecl", "isCaptureDone", "int", 0) Sleep(100) Until $return[0] = 1 ;--------------------------------------------------------------------------- ;Display frame $hBMP = _WinAPI_CreateBitmap($Width, $Height, 1, 32, $pTargetBuf) Local $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $Width, $Height) _GDIPlus_BitmapDispose($hImage) _WinAPI_DeleteObject($hBMP) Local $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Sleep(500) ;################################################# getCapturePropertyValue ################################################# $Default = DllCall($_escapi_Dll, "float:cdecl", "getCapturePropertyValue", "int", $device, "int", '') ;extern "C" float __declspec(dllexport) getCapturePropertyValue(unsigned int deviceno, int prop) ConsoleWrite("$Default CAPTURE_BRIGHTNESS = " & $Default[0] & @LF) ;WHAT is WRONG HERE? CAPTURE_GAMMA $CAPTURE_GAMMA = DllCall($_escapi_Dll, "float:cdecl", "getCapturePropertyValue", "int", $device, "int", 'CAPTURE_GAMMA');,"int",20) ConsoleWrite("$CAPTURE_GAMMA = " & $CAPTURE_GAMMA[0] & @LF) ;WHAT is WRONG HERE? VideoProcAmp_Gamma $VideoProcAmp_Gamma = DllCall($_escapi_Dll, "float:cdecl", "getCapturePropertyValue", "int", $device, "int", 'VideoProcAmp_Gamma');,"int",20) ConsoleWrite("$VideoProcAmp_Gamma = " & $VideoProcAmp_Gamma[0] & @LF& @LF) If Round(TimerDiff($C_timer)) > 5000 Then $C_timer = TimerInit() ;WHAT is WRONG HERE? CAPTURE_BRIGHTNESS to 0.1 $setCaptureProperty = DllCall($_escapi_Dll, "int:cdecl", "setCaptureProperty", "int", $device, "int", '', 'float', 0.1) ;~ extern "C" int __declspec(dllexport) setCaptureProperty(unsigned int deviceno, int prop, float value, int autoval) ConsoleWrite("$setCaptureProperty = " & $setCaptureProperty[0] & @LF) EndIf WEnd ;-------------------------------------------------------------------------- ;Clean up _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($hwnd)i can change the brightness with the propgui.exe which is inside the dll examples folder, and then the script picks the changed value up with the dllcall, but was not able to set it from autoit nor pick up the Gama or other settings
- 2 replies
-
- webcam
- escapi.dll
-
(and 2 more)
Tagged with: