Camera¶
Supported cameras¶
Logitech C270¶
HD USB webcam with fixed focus.
Name | Value | Setting |
Width | 1280 px | camera_width |
Height | 960 px | camera_height |
Frame rate | 30 fps | frame_rate |
Rotation | Yes | camera_rotate |
Horizontal flip | Yes | camera_hflip |
Vertical flip | No | camera_vflip |
Focal length x | 1430 px | camera_matrix |
Focal length y | 1430 px | camera_matrix |
Optical center x | 480 px | camera_matrix |
Optical center y | 620 px | camera_matrix |
Distortion | No | use_distortion |
Image controls¶
Name | Range | Setting |
Brightness | 0-255 | brightness_ |
Contrast | 0-255 | contrast_ |
Saturation | 0-255 | saturation_ |
Exposure | 1-64 | exposure_ |
These parameters have different values for each situation:
- Capture texture
- Pattern detection
- Laser detection over the object
- Laser detection over the pattern
Therefore, for each case the optimum values can be set.
Flush buffer¶
OpenCV is used to manage the camera. It wraps all the functionality to allow easy access.
At the low level driver, each operating system has different behavior regarding to the buffer of stored images. Moreover, if the exposure time is set over the frame rate (33 ms), buffer filling may vary if image controls are being updated. This may cause synchronization problems between the laser and the camera. Instead of using a long delay to reach the synchronization, a better approach is implemented using custom flush values.
Name | OS | Value | Setting |
Texture flush | Linux | 3 | flush_linux_texture |
Laser flush | Linux | 2 | flush_linux_laser |
Pattern flush | Linux | 3 | flush_linux_pattern |
Texture flush | Windows | 4 | flush_windows_texture |
Laser flush | Windows | 3 | flush_windows_laser |
Pattern flush | Windows | 4 | flush_windows_pattern |
Texture flush | MacOSX | 4 | flush_darwin_texture |
Laser flush | MacOSX | 3 | flush_darwin_laser |
Pattern flush | MacOSX | 4 | flush_darwin_pattern |
Note
In Linux, a custom OpenCV version is used, because of the next reasons. In Windows and Mac, standard 2.4.9 version is used.
Troubleshooting¶
Focus image¶
Logitech C270 camera is not focused at the scanner working distance (about 300 mm), but it is focused at a longer distance. This may cause inaccurate pattern detection and worse calibration values.
To improve that, the camera can be re-focused manually:
- Remove the electronics: the camera can not be removed if the board is fixed.
- Disassemble the camera: remove the 3 screws and the front cover.
- Move the lens to break up the glue.
- Put the camera into the scanner.
- Put the pattern on the middle of the platform.
- Open the video and move the focus until the pattern is focused.
- Assemble again the camera and the rest of the scanner.
In this video the camera manual focus is explained.