|
|
|
|
|
Example for managing videos (broadcasted by a Camera control)
In this example, the application allows you to: - view the camera preview stream currently being transmitted by the camera installed on the current workstation.
- modify the configuration of the driver for video capture.
- save the video currently broadcasted by the specified camera as an image (BMP file) or as a video sequence (AVI file).
To develop this application: - Create a blank window:
- Click
in the quick access buttons. - When the new element window appears, click "Window" then "Window".
- In the wizard, select "Blank".
- In this new window:
- Create a Camera field named "CAM_Camera": under the "Creation" pane, in the "Graphic controls" group, scroll down to "Video and capture" and click on "Camera"..
Note: By default, the camera associated with this field will be the default camera for the current workstation. - Create a Button field named "BTN_Filmer": under the "Creation" pane, in the "Usual controls" group, click on "Button"..
This Button control will be used to display the video sequence in the Camera control. - Create a Button field named "BTN_Configuration": under the "Creation" pane, in the "Usual controls" group, click on "Button"..
This Button control will be used to modify the configuration of the driver for video capture. - Create a Button field named "BTN_Image": under the "Creation" pane, in the "Usual controls" group, click on "Button"..
This Button control will be used to save the video sequence currently transmitted, as an image (BMP file). - Create a Button field named "BTN_Video": under the "Creation" pane, in the "Usual controls" group, click on "Button"..
This Button control will be used to save the video sequence currently transmitted, as a video sequence (AVI file). - Create a Button field named "BTN_Stop": under the "Creation" pane, in the "Usual controls" group, click on "Button"..
This Button control will be used to stop displaying and/or saving the video sequence in the Camera control.
- Write the following code in the "Click" event of "BTN_Film":
ResAffiche is boolean
ResAffiche = VideoDisplay(CAM_Caméra)
IF ResAffiche = False THEN Error(ErrorInfo())
- Write the following code in the "Click" event of "BTN_Configuration":
VideoConfigure(CAM_Caméra)
- Write the following code in the "Click" event of "BTN_Image":
ResSauvImg is boolean
ResSauvImg = VideoCapture(CAM_Caméra, "Temp.gif", viPictureCapture)
IF ResSauvImg = False THEN
Error(ErrorInfo())
END
FichierImage is string
FichierImage = fSelect(fExeDir(), "Image", ...
"Enregistrer sous...", "BMP" + TAB + "*.BMP", "bmp", fselCreate + fselExist)
IF FichierImage ~= "" THEN
fDelete("Temp.BMP")
ELSE
fRename("Temp.BMP", FichierImage)
END
- Write the following code in the "Click" event of "BTN_Video":
ResSauvVidéo is boolean
ResSauvVidéo = VideoCapture(CAM_Caméra, "Temp.avi", viVideoCapture, 180)
IF ResSauvVidéo = False THEN
Error(ErrorInfo())
END
FichierVidéo is string = fSélecteur(fExeDir(), "Vidéo", ...
"Enregistrer sous...", "AVI" + TAB + "*.avi", "avi", fselCreate + fselExist)
IF FichierVidéo ~= "" THEN
fDelete("Temp.avi")
ELSE
fRename("Temp.avi", FichierImage)
END
- Write the following code in the "Click" event of "BTN_Stop":
ResArrête is boolean
ResArrête = VideoStop(CAM_Caméra)
IF ResArrête = False THEN Error(ErrorInfo())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|