AutoIt: Получаване на снимка от уеб камера

Публикувано: 12.01.14, 10:32:12 | Автор: ArMeN | Видяна: 1178 | Редактирано: 19.07.16, 21:08:11


Изисквания: Webcam.au3

#include <Webcam.au3>
_WebcamInit()
$width = 320
$height = 240
$gui = GUICreate("Time Lapse", $width, $height)
_Webcam($gui, $width, $height, 0, 0)
_WebcamSnapShot(@ScriptDir & "\1.jpg")

#include <GUIConstantsEx.au3>
#include <Webcam.au3>
_WebcamInit()
$width = 320
$height = 240
$gui = GUICreate("Time Lapse", $width, $height)
_Webcam($gui, $width, $height, 0, 0)
Sleep (5000)
GUISetState(@SW_SHOW)
$timer = TimerInit()
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then
_WebcamStop()
Exit
ElseIf $timer >= 2000 Then
_WebcamSnapShot(@ScriptDir & "\" & @MDAY & @MON & @MDAY & @HOUR & @MIN & @SEC & ".jpg")
$timer = TimerInit ()
EndIf
WEnd

#include <GUIConstantsEx.au3>
#include <Webcam.au3>
;Initiate the webcam
_WebcamInit()
;Folder to store images, no trailing slash
$image_dir = @ScriptDir & "\" & @YEAR & @MON & @MDAY
;Time between taking images (ms)
$timelapse = 2000
;Size of Webcam Image
$width = 320
$height = 240
;Create $image_dir
If Not FileExists ($image_dir) Then DirCreate ($image_dir)
;Create the GUI
$gui = GUICreate("Time Lapse", $width, $height)
;Create the Webcam on the GUI
_Webcam($gui, $width, $height, 0, 0)
ToolTip ("Loading")
;Wait for Webcam to initate
Sleep (5000)
;Show the GUI
GUISetState(@SW_SHOW)
$timer = TimerInit()
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then
_WebcamStop()
Exit
ElseIf $timer >= $timelapse Then
_WebcamSnapShot($image_dir & "\" & @MDAY & @MON & @MDAY & @HOUR & @MIN & @SEC & ".jpg")
$timer = TimerInit ()
EndIf
WEnd

Не сте влезли в акаунта си за да коментирате.


 

Няма коментари.