Buenas..
Estimado amigo, todavia no consigo poder ver un GUI en el cual me muestre una imagen tomada por mi camara web. A continuación le muestro el código que estoy utilizando pero me da el siguiente error:
Código: Seleccionar todo
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=..\..\..\..\..\..\..\tmp\Icones\Webcam_4.ico
#AutoIt3Wrapper_outfile=MultiWebcam.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <AVIConstants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Webcam.au3>
#include <Date.au3>
If Not FileExists("multicam.ini") Then
Iniwrite("multicam.ini","Devices","NumberOfDevice","4")
Iniwrite("multicam.ini","Devices","DeviceName1","")
Iniwrite("multicam.ini","Devices","DeviceName2","")
Iniwrite("multicam.ini","Devices","DeviceName3","")
Iniwrite("multicam.ini","Devices","DeviceName4","")
Iniwrite("multicam.ini","SaveNames","BmpPrefix","")
Iniwrite("multicam.ini","SaveNames","AviPrefix","")
EndIf
#Region ### START Koda GUI section ### Form=c:\program files\ride runner\skins\carwings_dynamic_pm\scripts\multiwebcam\multicam.kxf
$MultiCam = GUICreate("MultiCam", 664, 462, 198, 136)
$wcamid = _WebcamOpen($MultiCam, 12, 15, 257, 201);fenêtre caméra 1
;$wcamid2 = _WebcamOpen($MultiCam, 285, 15, 257, 201);fenêtre caméra 2
;$wcamid3 = _WebcamOpen($MultiCam, 12, 239, 257, 201);fenêtre caméra 3
;$wcamid4 = _WebcamOpen($MultiCam, 285, 239, 257, 201);fenêtre caméra 4
$Cam1 = GUICtrlCreateButton("Cam 1", 552, 78, 44, 46, $BS_FLAT);ON/OFF caméra 1
$Cam2 = GUICtrlCreateButton("Cam 2", 613, 78, 44, 46, $BS_FLAT);ON/OFF caméra 2
$Cam3 = GUICtrlCreateButton("Cam 3", 552, 132, 44, 46, $BS_FLAT);ON/OFF caméra 3
$Cam4 = GUICtrlCreateButton("Cam 4", 613, 132, 44, 46, $BS_FLAT);ON/OFF caméra 4
$Group1 = GUICtrlCreateGroup(" Nbr Of Cam ", 550, 0, 110, 50)
$Group2 = GUICtrlCreateGroup(" Caméra 1 ", 8, 0, 265, 225)
$Group3 = GUICtrlCreateGroup(" Caméra 2 ", 280, 0, 265, 225)
$Group4 = GUICtrlCreateGroup(" Caméra 3 ", 8, 224, 265, 225)
$Group5 = GUICtrlCreateGroup(" Caméra 4 ", 280, 224, 265, 225)
$BTONOFF = GUICtrlCreateGroup(" ON / OFF ", 550, 60, 110, 125)
$Group6 = GUICtrlCreateGroup(" Save Type ", 550, 200, 110, 50)
$BTONOFF = GUICtrlCreateGroup(" Save ", 550, 260, 110, 125)
$SnapShotCam1 = GUICtrlCreateButton("Cam 1", 552, 278, 44, 46, $BS_FLAT);Snap shot caméra 1
$SnapShotCam2 = GUICtrlCreateButton("Cam 2", 611, 278, 44, 46, $BS_FLAT);Snap shot caméra 2
$SnapShotCam3 = GUICtrlCreateButton("Cam 3", 552, 332, 44, 46, $BS_FLAT);Snap shot caméra 3
$SnapShotCam4 = GUICtrlCreateButton("Cam 4", 611, 332, 44, 46, $BS_FLAT);Snap shot caméra 4
$Cancel = GUICtrlCreateButton("Cancel", 595, 402, 60, 00, $BS_FLAT);Sortir du pogramme
;choix du nombre de caméra (1 => 1 seule caméra plein écran , 2,3,4 => écran partagé en quatre)
$NbWebCam = GUICtrlCreateCombo("", 555, 20, 100, 25)
GUICtrlSetData(-1, "1|2|3|4", "4")
$SavePicOrAvi = GUICtrlCreateCombo("", 555, 220, 100, 25)
GUICtrlSetData(-1, "Save Bmp|Save Avi|Save Html>IP", "Save Avi")
$AviSave = GUICtrlRead($SavePicOrAvi)
;If $AviSave = "Save Avi" Then
;$Group7 = GUICtrlCreateGroup(" Time in s ", 680, 200, 80, 50)
;$AviTime = GUICtrlCreateCombo("", 685, 220, 50, 25)
;GUICtrlSetData(-1, "5|10", "5")
;EndIf
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $Cancel
Exit
Case $NbWebCam
$Nb = GUICtrlRead($NbWebCam)
Select
Case $Nb = "1"
_Gui1();GUI une seule caméra prenant toute la fenêtre
Case $Nb = "2"
_Gui4();GUI quatre caméras sur toute la fenêtre
Case $Nb = "3"
_Gui4();GUI quatre caméras sur toute la fenêtre
Case $Nb = "4"
_Gui4();GUI quatre caméras sur toute la fenêtre
EndSelect
Case $Cam1;ON/OFF caméra 1
Case $Cam2;ON/OFF caméra 2
Case $Cam3;ON/OFF caméra 3
Case $Cam4;ON/OFF caméra 4
Case $SnapShotCam1
;Choix sauvegarde (Bmp ou Avi)
$SaveCam = GUICtrlRead($SavePicOrAvi)
Select
Case $SaveCam = "Save Bmp"
_SaveBmp();sauvegarde d'images
Case $SaveCam = "Save Avi"
_SaveAvi();sauvegarde par vidéo
Select
Case $AviTime = "5"
Case $AviTime = "10"
EndSelect
Case $SaveCam = "Save Html>IP"
_SaveHtmlIp();sauvegarde Bmp dans page Html
EndSelect
Case $SnapShotCam2
$SaveCam = GUICtrlRead($SavePicOrAvi)
Select
Case $SaveCam = "Save Bmp"
; DateTime()
_SaveBmp();sauvegarde d'images
Case $SaveCam = "Save Avi"
_SaveAvi();sauvegarde par vidéo
EndSelect
Case $SnapShotCam3
$SaveCam = GUICtrlRead($SavePicOrAvi)
Select
Case $SaveCam = "Save Bmp"
_SaveBmp();sauvegarde d'images
Case $SaveCam = "Save Avi"
_SaveAvi();sauvegarde par vidéo
EndSelect
Case $SnapShotCam4
$SaveCam = GUICtrlRead($SavePicOrAvi)
Select
Case $SaveCam = "Save Bmp"
_SaveBmp();sauvegarde d'images
Case $SaveCam = "Save Avi"
_SaveAvi();sauvegarde par vidéo
EndSelect
EndSwitch
WEnd
Func _Gui1()
$MultiCam1 = GUICreate("MultiCam", 664, 662, 198, 136)
$wcamid = _WebcamOpen($MultiCam1, 12, 15, 529, 425)
$Cam1 = GUICtrlCreateButton("Cam 1", 552, 78, 44, 46, $BS_FLAT);ON/OFF caméra 1
$Cam2 = GUICtrlCreateButton("Cam 2", 613, 78, 44, 46, $BS_FLAT);ON/OFF caméra 2
$Cam3 = GUICtrlCreateButton("Cam 3", 552, 132, 44, 46, $BS_FLAT);ON/OFF caméra 3
$Cam4 = GUICtrlCreateButton("Cam 4", 613, 132, 44, 46, $BS_FLAT);ON/OFF caméra 4
$Group1 = GUICtrlCreateGroup(" Nbr Of Cam ", 550, 0, 110, 50)
$Group2 = GUICtrlCreateGroup(" Caméra 1 ", 8, 0, 537, 450)
$BTONOFF = GUICtrlCreateGroup(" ON / OFF ", 550, 60, 110, 125)
$Group6 = GUICtrlCreateGroup(" Save Type ", 550, 200, 110, 50)
$BTONOFF = GUICtrlCreateGroup(" Save ", 550, 260, 110, 125)
$SnapShotCam1 = GUICtrlCreateButton("Cam 1", 552, 278, 44, 46, $BS_FLAT);Snap shot caméra 1
$SnapShotCam2 = GUICtrlCreateButton("Cam 2", 611, 278, 44, 46, $BS_FLAT);Snap shot caméra 2
$SnapShotCam3 = GUICtrlCreateButton("Cam 3", 552, 332, 44, 46, $BS_FLAT);Snap shot caméra 3
$SnapShotCam4 = GUICtrlCreateButton("Cam 4", 611, 332, 44, 46, $BS_FLAT);Snap shot caméra 4
$Cancel = GUICtrlCreateButton("Cancel", 595, 402, 60, 00, $BS_FLAT);Sortir du pogramme
;choix du nombre de caméra (1 => 1 seule caméra plein écran , 2,3,4 => écran partagé en quatre)
$NbWebCam = GUICtrlCreateCombo("Nbr of Webcam", 555, 20, 100, 25)
GUICtrlSetData(-1, "1|2|3|4", "1")
$SavePicOrAvi = GUICtrlCreateCombo("Bmp or Avi", 555, 220, 100, 25)
GUICtrlSetData(-1, "Save Bmp|Save Avi|Save Html>IP", "Save Avi")
;If $SavePicOrAvi = "Save Avi" Then
;$AviTime = GUICtrlCreateCombo("Avi Time", 685, 220, 50, 25)
;GUICtrlSetData(-1, "5|10", "5")
;EndIf
GUISetState(@SW_SHOW)
EndFunc
Func _Gui4()
$MultiCam4 = GUICreate("MultiCam", 664, 462, 198, 136)
$wcamid = _WebcamOpen($MultiCam, 12, 15, 257, 201);fenêtre caméra 1
;$wcamid2 = _WebcamOpen($MultiCam, 285, 15, 257, 201);fenêtre caméra 2
;$wcamid3 = _WebcamOpen($MultiCam, 12, 239, 257, 201);fenêtre caméra 3
;$wcamid4 = _WebcamOpen($MultiCam, 285, 239, 257, 201);fenêtre caméra 4
$Cam1 = GUICtrlCreateButton("Cam 1", 552, 78, 44, 46, $BS_FLAT);ON/OFF caméra 1
$Cam2 = GUICtrlCreateButton("Cam 2", 613, 78, 44, 46, $BS_FLAT);ON/OFF caméra 2
$Cam3 = GUICtrlCreateButton("Cam 3", 552, 132, 44, 46, $BS_FLAT);ON/OFF caméra 3
$Cam4 = GUICtrlCreateButton("Cam 4", 613, 132, 44, 46, $BS_FLAT);ON/OFF caméra 4
$Group1 = GUICtrlCreateGroup(" Nbr Of Cam ", 550, 0, 110, 50)
$Group2 = GUICtrlCreateGroup(" Caméra 1 ", 8, 0, 265, 225)
$Group3 = GUICtrlCreateGroup(" Caméra 2 ", 280, 0, 265, 225)
$Group4 = GUICtrlCreateGroup(" Caméra 3 ", 8, 224, 265, 225)
$Group5 = GUICtrlCreateGroup(" Caméra 4 ", 280, 224, 265, 225)
$BTONOFF = GUICtrlCreateGroup(" ON / OFF ", 550, 60, 110, 125)
$Group6 = GUICtrlCreateGroup(" Save Type ", 550, 200, 110, 50)
$BTONOFF = GUICtrlCreateGroup(" Save ", 550, 260, 110, 125)
$SnapShotCam1 = GUICtrlCreateButton("Cam 1", 552, 278, 44, 46, $BS_FLAT);Snap shot caméra 1
$SnapShotCam2 = GUICtrlCreateButton("Cam 2", 611, 278, 44, 46, $BS_FLAT);Snap shot caméra 2
$SnapShotCam3 = GUICtrlCreateButton("Cam 3", 552, 332, 44, 46, $BS_FLAT);Snap shot caméra 3
$SnapShotCam4 = GUICtrlCreateButton("Cam 4", 611, 332, 44, 46, $BS_FLAT);Snap shot caméra 4
$Cancel = GUICtrlCreateButton("Cancel", 595, 402, 60, 00, $BS_FLAT);Sortir du pogramme
;choix du nombre de caméra (1 => 1 seule caméra plein écran , 2,3,4 => écran partagé en quatre)
$NbWebCam = GUICtrlCreateCombo("Nbr of Webcam", 555, 20, 100, 25)
GUICtrlSetData(-1, "1|2|3|4", "4")
$SavePicOrAvi = GUICtrlCreateCombo("Bmp or Avi", 555, 220, 100, 25)
GUICtrlSetData(-1, "Save Bmp|Save Avi|Save Html>IP", "Save Avi")
;If $SavePicOrAvi = "Save Avi" Then
;$AviTime = GUICtrlCreateCombo("Avi Time", 685, 220, 50, 25)
;GUICtrlSetData(-1, "5|10", "5")
;EndIf
GUISetState(@SW_SHOW)
EndFunc;Fin Gui à quatre caméras
Func _SaveBmp();sauvegarde de trois images bmp
;définition du préfix des fichiers sauvegardés
$DateTime = _Date_Time_GetSystemTime()
$DateTimeCorrected = StringReplace(StringReplace(StringReplace(_Date_Time_SystemTimeToDateTimeStr($DateTime),"/",""),":","")," ","_")
If IniRead("multicam.ini","SaveNames","BmpPrefix","") = "" Then
$PrefixName = $DateTimeCorrected
Else
$PrefixName = IniRead("multicam.ini","SaveNames","BmpPrefix","")&$DateTimeCorrected
EndIf
ConsoleWrite("Taking snapshot ..." &$PrefixName& @CRLF)
_WebcamSnap($wcamid,@ScriptDir & "\"&$PrefixName&".bmp")
EndFunc
Func _SaveAvi();sauvegarde d'une vidéo de N secondes
;définition du préfix des fichiers sauvegardés
$DateTime = _Date_Time_GetSystemTime()
$DateTimeCorrected = StringReplace(StringReplace(StringReplace(_Date_Time_SystemTimeToDateTimeStr($DateTime),"/",""),":","")," ","_")
If IniRead("multicam.ini","SaveNames","AviPrefix","") = "" Then
$PrefixName = $DateTimeCorrected
Else
$PrefixName = IniRead("multicam.ini","SaveNames","AviPrefix","")&$DateTimeCorrected
EndIf
$AviTime = $AviTime
ConsoleWrite("Taking snapshot ..." &$PrefixName& " "&$AviTime&@CRLF)
_WebcamRecordStart(@ScriptDir & "\"&$PrefixName&".avi", $wcamid)
_WebcamRecordStop($wcamid)
EndFunc
Func _SaveHtmlIp();sauvegarde Bmp dans page Html
EndFunc
No se cual es el problema, me dice que desconoce el nombre de esa función. Una pregunta: ¿Debo agregar alguna libreria a la carpeta de INCLUDE de Autoit?
Muchas gracias y saludos muchachos.......