Ihr kennt ja sicher mein Programm Miniüberwachungskamera. Dort ist es auch möglich Fotos zu schießen aber, wie kann ich ein komplettes Video aufnehmen???
Wie Video mit webcam aufnehmen???? [endgültig gelöst]
-
- [ gelöst ]
-
shayn -
29. April 2010 um 14:45 -
Geschlossen -
Erledigt
-
-
Ohne mir das Programm jetzt angesehen zu haben ...
HIER findest du Infos zu _CreateAVI & Co.
-
von der WEBCAM nicht vom Bildschirm. MANN
-
du kannst ja jedes bild was die webcam empfängt ins avi packen oda?
-
Bevor du hier gleich austickst - ich kann durchaus lesen.
Wenn die Miniüberwachung Bilder mit der Webcam macht dann ist das doch wohl das selbe wie Bilder vom Screen zu erstellen. Du weisst also schon wie du an die Bilder kommst. Wenn du dir jetzt mal in dem Thread anschaust wie man aus Bildern eine .avi maacht und das ganze dann in deinem Skript umsetzt, hast du schonmal einen Lösungsansatz.
Und nächstesmal achte doch bitte auf deinen Tonfall. Wenn dir eine Antwort nicht passt dann ignorier sie.
-
Ihr kennt ja sicher mein Programm Miniüberwachungskamera. Dort ist es auch möglich Fotos zu schießen aber, wie kann ich ein komplettes Video aufnehmen???
In der von dir Verwendeten UDF gibt es eine Funktion dafür.
-
In der von dir Verwendeten UDF gibt es eine Funktion dafür.
Er kennt sein eigenes Programm ja beachtlich gut..
-
von der WEBCAM nicht vom Bildschirm. MANN
Bleib du mal auf dem Teppich
Gib bei Google AutoIt Webcam UDF ein.
Dann findest du eine Seite aus dem Englischen Forum..
Damit kannst die Webcam ansteuern. -
Er kennt sein eigenes Programm ja beachtlich gut..
natürlich gibt es da eine Funktion:
Fonktionsaufruf:
Spoiler anzeigen
[autoit]Func SnapShot()
[/autoit]
MsgBox(0,"Snapshot","press ok")
_WebcamSnap($WebcamID, $snapfile1)
EndFuncUnd die Func:
Spoiler anzeigen
[autoit]Func _WebcamSnap($sId, $sFile)
[/autoit]
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
EndFuncHA und HA
Ist alles im Script drin, wer lesen kann ist klar im Vorteil.
Wers nicht glaubt hier das Script:
Spoiler anzeigen
[autoit]$cam_xlength=100 ;Breite
[/autoit] [autoit][/autoit] [autoit]
$cam_ylength=100 ;Höhe
$Gridstep=50 ;Abstand zwischen den Pixeln zum Abtasten$sensitivity = 15 ;Empfindlichkeit
[/autoit] [autoit][/autoit] [autoit]$gui_x=130
[/autoit] [autoit][/autoit] [autoit]
$gui_y=100HotKeySet("{END}", "Quit");
[/autoit] [autoit][/autoit] [autoit]
HotKeySet("{INSERT}", "SnapShot")$snapfile1 = @ScriptDir & "\scrshot1.bmp"
[/autoit] [autoit][/autoit] [autoit]#cs ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]AutoIt Version: 3.2.11.7 (beta)
[/autoit] [autoit][/autoit] [autoit]
thnx to rysiora with his great example!
Author: LudocusScript Function:
[/autoit] [autoit][/autoit] [autoit]
Webcam Udf#ce ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]
#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>
[/autoit] [autoit][/autoit] [autoit]
#include <WindowsConstants.au3>$avi = DllOpen("avicap32.dll")
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$user = DllOpen("user32.dll")$gui_name="Minicam win32"
[/autoit] [autoit][/autoit] [autoit]$gui = GUICreate($gui_name,$gui_x,$gui_y)
[/autoit] [autoit][/autoit] [autoit]$pic = GUICtrlCreatePic (@ScriptDir & "\grün.jpg", 100, 0, 30, 100)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
GUICtrlSetState(-1, $GUI_DISABLE)Dim $red[$cam_xlength/$Gridstep*$cam_ylength/$Gridstep+1]
[/autoit] [autoit][/autoit] [autoit]
Dim $green[$cam_xlength/$Gridstep*$cam_ylength/$Gridstep+1]
Dim $blue[$cam_xlength/$Gridstep*$cam_ylength/$Gridstep+1]$WebcamID = _WebcamOpen($gui, 0, 0, $cam_xlength, $cam_ylength)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit]$changeold=0
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
$pos=WinGetPos ( $gui_name ) ;Farbwerte der Cam werden direkt vom Screen ausgelesen
$xpos=$pos[0] ;dazu wird das direkt angezeigte Bild
$ypos=$pos[1] ;abgefragt
$count=0$change=0
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$tempchange=0
$changemax=0For $x_scan = 1 to $cam_xlength Step $Gridstep
[/autoit] [autoit][/autoit] [autoit]
For $y_scan = 1 to $cam_ylength Step $Gridstep$count=$count+1 ;Counter für abgetastete Pixel
[/autoit] [autoit][/autoit] [autoit]$farbe=PixelGetColor(2+$x_scan+$xpos,21+$y_scan+$ypos)
[/autoit] [autoit][/autoit] [autoit]
$redc=BitAND($farbe, 0xFF0000) / 16^4
$greenc=BitAND($farbe, 0x00FF00) / 16^2
$bluec=BitAND($farbe, 0x0000FF)$change_red=$red[$count]-$redc
[/autoit] [autoit][/autoit] [autoit]
$change_green=$green[$count]-$greenc
$change_blue=$blue[$count]-$bluec$tempchange=Abs($change_red)+Abs($change_green)+Abs($change_blue)
[/autoit] [autoit][/autoit] [autoit]$change+=$tempchange
[/autoit] [autoit][/autoit] [autoit]
If $changemax<$tempchange Then $changemax=$tempchange$red[$count]=$redc
[/autoit] [autoit][/autoit] [autoit]
$green[$count]=$greenc
$blue[$count]=$bluec$msg = GUIGetMsg()
[/autoit] [autoit][/autoit] [autoit]
If $msg = $GUI_EVENT_CLOSE Then
_WebcamClose($WebcamID)
Exit
EndIf
Next
Next$change=$change/$count
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$diff=abs($change-$changeold)
[/autoit] [autoit][/autoit] [autoit];Hier können Anweisungen kommen wie "if $diff>50 then snapshot" folgen
[/autoit] [autoit][/autoit] [autoit]
;
;z.B.:Select
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Case $diff <$sensitivity
GUICtrlSetImage($pic, @scriptdir&"\grün.jpg")
Case $diff > $sensitivity AND $diff<=$sensitivity*2
GUICtrlSetImage($pic, @scriptdir&"\gelb.jpg")
SoundPlay(@scriptdir&"\gelb.wav")
Case $diff > 2*$sensitivity AND $diff<=$sensitivity*4
GUICtrlSetImage($pic, @scriptdir&"\rotgelb.jpg")
SoundPlay(@scriptdir&"\rotgelb.wav")
Case $diff > 4*$sensitivity
GUICtrlSetImage($pic, @scriptdir&"\rot.jpg")
SoundPlay(@scriptdir&"\rot.wav")
EndSelect$changeold=$change
[/autoit] [autoit][/autoit] [autoit]
Sleep(100)
WEndFunc SnapShot()
[/autoit] [autoit][/autoit] [autoit]
MsgBox(0,"Snapshot","press ok")
_WebcamSnap($WebcamID, $snapfile1)
EndFuncFunc Quit()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_WebcamClose($WebcamID)
Exit
EndFunc;===============================================================================
[/autoit] [autoit][/autoit] [autoit]
;
; Description: Open's a webcam preview screen in your gui
; Syntax: _WebcamOpen($sHwnd, $sLeft, $sTop, $sWidth, $sHeight)
; 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
; Requirement(s): A webcam
; Return Value(s): On Success - Returns id needed for other controls
; On Failure - Returns -1
; Author(s): Ludocus
; Note(s): None
;
;===============================================================================
func _WebcamOpen($sHwnd, $sLeft, $sTop, $sWidth, $sHeight)
$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", 0, "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;===============================================================================
[/autoit] [autoit][/autoit] [autoit]
;
; 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_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;===============================================================================
[/autoit] [autoit][/autoit] [autoit]
;
; 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;===============================================================================
[/autoit] [autoit][/autoit] [autoit]
;
; 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;===============================================================================
[/autoit]
;
; 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 ;==> _WebcamRecordStop -
und was is jetz dein problem
du hast doch jetz alles was du brauchst oda?
-
Alles klar! Ich fand nur die ANtwort von qon sinnlos.
-
Du bisch so pleeed.
Dein Alter spricht eindeutig aus dir. Wenn du UNBEDINGT wegen jedem kleinen bisschen so abgehen muss dann mach das wo anders.
Wenn du dir mal den Thread, den ideas2code gepostet hast anschaust und die Funktionen dort wirst du wohl dadurch erfahren, dass du einfach die Screenshots von der Funktion zu einer .avi hinzufügen kannst. -
Ich bin ein wenig klüger als du. Du willst immer noch bilder zu einem Film zusammenfügen, aba was ist mit der Func _WebcamRecordStart($sFile, $sId) ??
-
Du hast dein Script hinzugefügt als ich gerade meine Nachricht am schreiben war, daher konnte ich von der Funktion nichts wissen.
Und woher willst du bitte wissen wie klug ich bin? -
natürlich gibt es da eine Funktion:
Fonktionsaufruf:
Spoiler anzeigen
[autoit]Func SnapShot()
[/autoit]
MsgBox(0,"Snapshot","press ok")
_WebcamSnap($WebcamID, $snapfile1)
EndFuncUnd die Func:
Spoiler anzeigen
[autoit]Func _WebcamSnap($sId, $sFile)
[/autoit]
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
EndFuncHA und HA
Ist alles im Script drin, wer lesen kann ist klar im Vorteil.
Wers nicht glaubt hier das Script:
Spoiler anzeigen
[autoit]$cam_xlength=100 ;Breite
[/autoit] [autoit][/autoit] [autoit]
$cam_ylength=100 ;Höhe
$Gridstep=50 ;Abstand zwischen den Pixeln zum Abtasten$sensitivity = 15 ;Empfindlichkeit
[/autoit] [autoit][/autoit] [autoit]$gui_x=130
[/autoit] [autoit][/autoit] [autoit]
$gui_y=100HotKeySet("{END}", "Quit");
[/autoit] [autoit][/autoit] [autoit]
HotKeySet("{INSERT}", "SnapShot")$snapfile1 = @ScriptDir & "\scrshot1.bmp"
[/autoit] [autoit][/autoit] [autoit]#cs ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]AutoIt Version: 3.2.11.7 (beta)
[/autoit] [autoit][/autoit] [autoit]
thnx to rysiora with his great example!
Author: LudocusScript Function:
[/autoit] [autoit][/autoit] [autoit]
Webcam Udf#ce ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]
#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>
[/autoit] [autoit][/autoit] [autoit]
#include <WindowsConstants.au3>$avi = DllOpen("avicap32.dll")
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$user = DllOpen("user32.dll")$gui_name="Minicam win32"
[/autoit] [autoit][/autoit] [autoit]$gui = GUICreate($gui_name,$gui_x,$gui_y)
[/autoit] [autoit][/autoit] [autoit]$pic = GUICtrlCreatePic (@ScriptDir & "\grün.jpg", 100, 0, 30, 100)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
GUICtrlSetState(-1, $GUI_DISABLE)Dim $red[$cam_xlength/$Gridstep*$cam_ylength/$Gridstep+1]
[/autoit] [autoit][/autoit] [autoit]
Dim $green[$cam_xlength/$Gridstep*$cam_ylength/$Gridstep+1]
Dim $blue[$cam_xlength/$Gridstep*$cam_ylength/$Gridstep+1]$WebcamID = _WebcamOpen($gui, 0, 0, $cam_xlength, $cam_ylength)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit]$changeold=0
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
$pos=WinGetPos ( $gui_name ) ;Farbwerte der Cam werden direkt vom Screen ausgelesen
$xpos=$pos[0] ;dazu wird das direkt angezeigte Bild
$ypos=$pos[1] ;abgefragt
$count=0$change=0
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$tempchange=0
$changemax=0For $x_scan = 1 to $cam_xlength Step $Gridstep
[/autoit] [autoit][/autoit] [autoit]
For $y_scan = 1 to $cam_ylength Step $Gridstep$count=$count+1 ;Counter für abgetastete Pixel
[/autoit] [autoit][/autoit] [autoit]$farbe=PixelGetColor(2+$x_scan+$xpos,21+$y_scan+$ypos)
[/autoit] [autoit][/autoit] [autoit]
$redc=BitAND($farbe, 0xFF0000) / 16^4
$greenc=BitAND($farbe, 0x00FF00) / 16^2
$bluec=BitAND($farbe, 0x0000FF)$change_red=$red[$count]-$redc
[/autoit] [autoit][/autoit] [autoit]
$change_green=$green[$count]-$greenc
$change_blue=$blue[$count]-$bluec$tempchange=Abs($change_red)+Abs($change_green)+Abs($change_blue)
[/autoit] [autoit][/autoit] [autoit]$change+=$tempchange
[/autoit] [autoit][/autoit] [autoit]
If $changemax<$tempchange Then $changemax=$tempchange$red[$count]=$redc
[/autoit] [autoit][/autoit] [autoit]
$green[$count]=$greenc
$blue[$count]=$bluec$msg = GUIGetMsg()
[/autoit] [autoit][/autoit] [autoit]
If $msg = $GUI_EVENT_CLOSE Then
_WebcamClose($WebcamID)
Exit
EndIf
Next
Next$change=$change/$count
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$diff=abs($change-$changeold)
[/autoit] [autoit][/autoit] [autoit];Hier können Anweisungen kommen wie "if $diff>50 then snapshot" folgen
[/autoit] [autoit][/autoit] [autoit]
;
;z.B.:Select
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Case $diff <$sensitivity
GUICtrlSetImage($pic, @scriptdir&"\grün.jpg")
Case $diff > $sensitivity AND $diff<=$sensitivity*2
GUICtrlSetImage($pic, @scriptdir&"\gelb.jpg")
SoundPlay(@scriptdir&"\gelb.wav")
Case $diff > 2*$sensitivity AND $diff<=$sensitivity*4
GUICtrlSetImage($pic, @scriptdir&"\rotgelb.jpg")
SoundPlay(@scriptdir&"\rotgelb.wav")
Case $diff > 4*$sensitivity
GUICtrlSetImage($pic, @scriptdir&"\rot.jpg")
SoundPlay(@scriptdir&"\rot.wav")
EndSelect$changeold=$change
[/autoit] [autoit][/autoit] [autoit]
Sleep(100)
WEndFunc SnapShot()
[/autoit] [autoit][/autoit] [autoit]
MsgBox(0,"Snapshot","press ok")
_WebcamSnap($WebcamID, $snapfile1)
EndFuncFunc Quit()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_WebcamClose($WebcamID)
Exit
EndFunc;===============================================================================
[/autoit] [autoit][/autoit] [autoit]
;
; Description: Open's a webcam preview screen in your gui
; Syntax: _WebcamOpen($sHwnd, $sLeft, $sTop, $sWidth, $sHeight)
; 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
; Requirement(s): A webcam
; Return Value(s): On Success - Returns id needed for other controls
; On Failure - Returns -1
; Author(s): Ludocus
; Note(s): None
;
;===============================================================================
func _WebcamOpen($sHwnd, $sLeft, $sTop, $sWidth, $sHeight)
$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", 0, "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;===============================================================================
[/autoit] [autoit][/autoit] [autoit]
;
; 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_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;===============================================================================
[/autoit] [autoit][/autoit] [autoit]
;
; 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;===============================================================================
[/autoit] [autoit][/autoit] [autoit]
;
; 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;===============================================================================
[/autoit]
;
; 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 ;==> _WebcamRecordStopUnd warum machst du es dann nicht gleich so?
Mit dem "Er" in meinem Satz warst du gemeint........Edit: um es für dich aufzuklären, wie es gemeint war:
Du weisst nichtmal, was in deinem eigenen Programm drinsteht, sonst hättest du garnicht erst diesen Thread aufgemacht, und es direkt so gemacht, wie du es oben beschrieben hast.Ich kann echt nicht mehr, du bist so unbeschreiblich ****.. denk dir was aus, wies dir gefällt.
Ich bin ein wenig klüger als du. Du willst immer noch bilder zu einem Film zusammenfügen, aba was ist mit der Func _WebcamRecordStart($sFile, $sId) ??
Ist auch ein sehr starker post.
Naja genug dazu, ich halt mich ab jetzt raus