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
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
In this example, the application allows you to:
  • view the video sequence currently broadcasted by the camera installed on the current computer.
  • 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.
    • The creation window appears: click "Window" then "Window".
    • In the wizard, select "Blank".
  2. In this new window:
    • Create a Camera control named "CAM_Camera": on the "Creation" tab, "Graphic controls" group, expand "Video and capture" and click "Camera".
      Remark: By default, the camera associated with this control will correspond to the default camera found on the current computer.
    • Create a Button control and name it "BTN_Film": on the "Creation" tab, in the "Usual controls" group, click "Button".
      This Button control will be used to display the video sequence in the Camera control.
    • Create a Button control and name it "BTN_Configuration": on the "Creation" tab, in the "Usual controls" group, click "Button".
      This Button control will be used to modify the configuration of the driver for video capture.
    • Create a Button control and name it "BTN_Image": on the "Creation" tab, in the "Usual controls" group, click "Button".
      This Button control will be used to save the video sequence currently transmitted, as an image (BMP file).
    • Create a Button control and name it "BTN_Video": on the "Creation" tab, in the "Usual controls" group, click "Button".
      This Button control will be used to save the video sequence currently transmitted, as a video sequence (AVI file).
    • Create a Button control and name it "BTN_Stop": on the "Creation" tab, in the "Usual controls" group, click "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":
    // Displays the video sequence currently transmitted in the "CAM_Camera" control
    ResDisplay is boolean
    ResDisplay = VideoDisplay(CAM_Camera)
    // Displays an error message if a problem occurs
    IF ResDisplay = False THEN Error(ErrorInfo())
  4. Write the following code in the "Click" event of "BTN_Configuration":
    // Displays the standard dialog box used to
    // configure the driver for video capture used by the "CAM_Camera" control
    VidéoConfigure(CAM_Camera)
  5. Write the following code in the "Click" event of "BTN_Image":
    // Save the image currently broadcasted in the "CAM_Camera" control
    ResImgBck is boolean
    ResImgBck = VidéoCapture(CAM_Camera, "Temp.gif", viPictureCapture)
    IF ResImgBck = False THEN
    Error(ErrorInfo())
    END
     
    // Select the file to create
    ImageFile is string
    ImageFile = fSelect(fExeDir(), "Image", ...
    "Save as...", "BMP" + TAB + "*.BMP", "bmp", fselCreate + fselExist)
     
    // Renames the created BMP file
    IF ImageFile ~= "" THEN
    // Delete the temporary file
    fDelete("Temp.BMP")
    ELSE
    // Renames and moves the generated file
    fRename("Temp.BMP", ImageFile)
    END
  6. Write the following code in the "Click" event of "BTN_Video":
    // Save the video sequence currently broadcasted
    // in the "CAM_Camera" control in the format of a 3-minute AVI
    ResVideoBck is boolean
    ResVideoBck = VidéoCapture(CAM_Camera, "Temp.avi", viVideoCapture, 180)
    IF ResVideoBck = False THEN
    Error(ErrorInfo())
    END
     
    // Select the file to create
    VideoFile is string = fSelect(fExeDir(), "Video", ...
    "Save as...", "AVI" + TAB + "*.avi", "avi", fselCreate + fselExist)
     
    // Renames the created AVI file
    IF VideoFile ~= "" THEN
    // Delete the temporary file
    fDelete("Temp.avi")
    ELSE
    // Renames and moves the generated file
    fRename("Temp.avi", ImageFile)
    END
  7. Write the following code in the "Click" event of "BTN_Stop":
    // Displays the display or the backup of the video sequence
    ResStop is boolean
    ResStop = VideoStop(CAM_Camera)
    // Displays an error message if a problem occurs
    IF ResStop = False THEN Error(ErrorInfo())
Minimum version required
  • Version 10
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help