ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Camera control
  • Overview
  • Use example
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Example of video management (transmitted by a Camera control) (prefix syntax)
Overview
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).
Use example
To develop this application:
  1. 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".
  2. 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.
  3. Write the following code in the "Click" event of "BTN_Film":
    // Affiche la séquence vidéo actuellement retransmise dans le champ "CAM_Caméra"
    ResAffiche is boolean
    ResAffiche = CAM_Caméra.Affiche()
    // Affiche une erreur en cas de problème
    IF ResAffiche = False THEN Error(ErrorInfo())
  4. Write the following code in the "Click" event of "BTN_Configuration":
    // Affiche la boîte de dialogue standard permettant 
    // la configuration du driver de capture vidéo utilisé pour le champ "CAM_Caméra"
    CAM_Caméra.Configure()
  5. Write the following code in the "Click" event of "BTN_Image":
    // Sauvegarde de l'image actuellement retransmise dans le champ "CAM_Caméra"
    ResSauvImg is boolean
    ResSauvImg = CAM_Caméra.Capture("Temp.gif", viPictureCapture)
    IF ResSauvImg = False THEN 
    	Error(ErrorInfo())
    END
    
    // Sélection du fichier à créer
    FichierImage is string 
    FichierImage = fSelect(fExeDir(), "Image", ...
    	"Enregistrer sous...", "BMP" + TAB + "*.BMP", "bmp", fselCreate + fselExist)
    
    // Renomme le fichier BMP créé
    IF FichierImage ~= "" THEN
    	// Suppression du fichier temporaire
    	fDelete("Temp.BMP")
    ELSE
    	// Renomme et déplace le fichier généré
    	fRename("Temp.BMP", FichierImage)
    END
  6. Write the following code in the "Click" event of "BTN_Video":
    // Sauvegarde de la séquence vidéo actuellement retransmise 
    // dans le champ "CAM_Caméra" sous forme d'une AVI de 3 minutes
    ResSauvVidéo is boolean
    ResSauvVidéo = CAM_Caméra.Capture("Temp.avi", viVideoCapture, 180)
    IF ResSauvVidéo = False THEN 
    	Error(ErrorInfo())
    END
    
    // Sélection du fichier à créer
    FichierVidéo is string = fSelect(fExeDir(), "Vidéo", ...
    	"Enregistrer sous...", "AVI" + TAB + "*.avi", "avi", fselCreate + fselExist)
    
    // Renomme le fichier AVI créé
    IF FichierVidéo ~= "" THEN
    	// Suppression du fichier temporaire
    	fDelete("Temp.avi")
    ELSE
    	// Renomme et déplace le fichier généré
    	fRename("Temp.avi", FichierImage)
    END
  7. Write the following code in the "Click" event of "BTN_Stop":
    // Affiche l'affichage ou la sauvegarde de la séquence vidéo
    ResArrête is boolean 
    ResArrête = CAM_Caméra.Arrête()
    // Affiche une erreur en cas de problème
    IF ResArrête = False THEN Error(ErrorInfo())
Minimum version required
  • Version 23
Comments
Click [Add] to post a comment

Last update: 09/24/2024

Send a report | Local help