-
-
Notifications
You must be signed in to change notification settings - Fork 549
OpenPnpCaptureCamera
OpenPnpCaptureCamera is an OpenPnP camera driver based on the openpnp-capture library by Niels Moseley. It is the most advanced OpenPnP camera driver available, making it possible to use multiple USB cameras on a single host, and allowing you to specify configuration parameters such as exposure, brightness, focus, etc.
When using multiple USB cameras on the same USB host, there are some limitations to consider. Primarily, it is important to use a compressed format when selecting the Format in OpenPnP. Compressed formats have a number of names. The most common are 1bmd, dmb1, mjpg, and mjpeg. Uncompressed formats such as yuv, vuy, yuv2, etc. cannot be used when using multiple cameras on the same host.
For more information on the limitations of multiple USB cameras, see the USB Camera Troubleshooting FAQ.
To configure the format for a camera:
- Go to Machine Setup -> Cameras or Machine Setup -> Heads -> Cameras and select the camera to configure.
- Select the Camera Specific tab.
- Scroll down to the General section and click the Format dropdown.
- In the list of Formats, find a compressed format that meets you resolution and FPS needs. If there are no compressed formats in the dropdown you will either need to change to a different camera (see What Should I Build for recommendations) or put each camera on it's own USB host port.
Depending on the make and model of your camera, different properties will be available/enabled. Issues and Solutions will suggest some advice setting correct properties.
Generally, Auto settings should be avoided, as they lead to unstable conditions for computer vision. We need to be able to set stable thresholds, e.g. for brightness, color hue, saturation etc. which is not possible if they fluctuate between camera subjects. If your camera does not support switching off automatic exposure, consider replacing it. Seriously.
Unlike humans, computer vision does not care about the aesthetics of an image. Avoid all settings that aim at "pleasing" images, these can be detrimental to the accuracy of computer vision. The raw, unmanipulated image at the right exposure is what we want, so computer vision gets the original real world information from the sensor, even if it looks not so crispy to you. Therefore, minimize Sharpness, set Contrast, Gamma etc. to their respective Default values indicated on the right side.
The optimal image is optimized for the brightest scene that is encountered in operation. In other scenes it might appear too dark to humans, however computer vision can still get enough information from even a fraction of the dynamic range, it is much more important that levels remain stable between scenes.
If in doubt, set to the Default value indicated on the right side.
The Freeze Properties? switch determines how camera properties are handled:
- If disabled (default), the camera device driver will store the properties (Auto and Value). They are queried from the camera whenever it is reopened.
- If enabled (new), the OpenPnP configuration (
machine.xml
) will store all the currently set properties (Auto and Value). They are reapplied to the camera whenever it is later reopened. To make sure you get repeatable results, the properties will also be reapplied when the machine is homed. They can still be changed through the UI, but settings will never be overwritten with those queried from the camera device.
Enable Freeze Properties? when you want repeatable settings stored with the OpenPnP configuration. You can then switch between configurations or even between different applications using the web cam with no harm. The configured properties will always be restored.
Likewise if you mistakenly reconnect the two cameras to the wrong/swapped USB port, it will no longer overwrite or reset the configured settings. Just connect to the right USB ports or select the right USB device from the drop-down and press Apply. The configured settings will be restored to the camera (an OpenPnP restart might be needed for a fresh USB device enumeration).
Finally, if your camera device driver or OS does not properly store settings between OpenPnP sessions or OS reboots, they are now restored as soon OpenPnP reopens the camera.
Notes:
- Some cameras have been reported to not accept properties correctly on the reopen. For this reason properties are also applied when homing the machine. Use the Reapply to Camera button (only available with frozen properties), to reapply properties to the camera any time. If frequent manual reapplication is necessary, i.e. if the camera is arbitrarily not accepting or losing its properties, please report to the discussion group.
- If you first switch the Freeze Properties? on, press Apply for the properties to be initially frozen.
- Once you want to change the camera device for a different make or model, you will likely need to disable Freeze Properties? and press Apply to query reasonable settings from the new camera (availability and ranges of properties may change between makes and models).
Note that not all cameras behave as well as others. If you want to be sure of reliable operation of two cameras on a single USB host it is recommended that you use the ELP Model USB100W03M, 720p USB Cameras. See the Build FAQ for more camera recommendations.