Skip to content

SwitcherCamera

markmaker edited this page Nov 30, 2022 · 10 revisions

SwitcherCamera lets you have multiple virtual cameras sharing the same physical capture hardware. This is common in commercial desktop pick and place machines where a single USB capture card captures images from multiple analog cameras. A serial command is used to switch between the two streams.

  • Note: the following video is outdated. In newer OpenPnP versions, each switched camera view will always only show images that come from the right analog camera, i.e. if the camera is currently not the switched-to camera, the view is frozen on the last frame captured before the switching.

    Video Demonstration

  • Related Issue

Configuration

The most common configuration for SwitcherCamera will be a single capture device using the OpenPnpCaptureCamera as a source, and two SwitcherCameras - one for Top and one for Bottom. The Top and Bottom SwitcherCameras will send a command to switch back and forth.

The basic steps to set everything up are:

  1. Create an Actuator that will switch between the Top and Bottom camera. Set its Value Type to Double.

    Switcher Actuator

  2. Create the OpenPnpCaptureCamera as a normal camera and set it up to capture images from your capture hardware.

    Capture Device

  3. Make sure to set Preview FPS to 0. Disable Show in multiple camera view?.

  4. Create the Bottom SwitcherCamera. Under Device Settings, choose the source camera and the the actuator.

    Bottom Switcher

  5. Fill in the actuator value with the numeric code that you will send to enable that camera. For instance, if the command M810 enables your Bottom camera, fill in 810.

  6. Make sure to set Preview FPS to 0. Enable Suspend During Tasks?.

  7. Create the Top SwitcherCamera similarly to the Top.

  8. Make sure to set the correct numeric code for the Bottom camera. It should be different from the Top.

  9. Let Issues and Solutions help you create the G-Code ACTUATE_DOUBLE_COMMAND for the Switcher actuator. Enter:

    M{IntegerValue} ; actuate camera switcher

    Actuator G-Code

To switch between cameras double click on the camera in the camera view. Note that this will capture a screenshot in your OpenPnP configuration directory.

OpenPnP will automatically switch between the two cameras for vision operations without capturing a screenshot.

Hide the Capturing Device camera

Cameras can be shown/not shown in multi camera view panels (Show All Horizontal/Show All Vertical). This is typically used to hide the capture card in a SwitcherCamera setup. The Camera can still be selected as a single CameraView.

Show All

Disable the Show in multi camera view? option if you want to hide the capture device camera:

Show option

Clone this wiki locally