Robot Raconteur camera driver using OpenCV camera capture
Project description
Robot Raconteur Camera Driver
The robotraconteur-camera-driver
package provides a camera driver for Robot Raconteur based on OpenCV video
capture. See the OpenCV documentation
for more information on the video capture system and its capabilities. The driver allows for selecting the camera
by index, and changing some of the parameters made available by OpenCV. OpenCV does not provide a mechanism to
enumerate cameras and their capabilities so there is no option to list available cameras.
This driver uses the com.robotraconteur.imaging.Camera
standard type.
Install using Python pip (Windows, Mac, Linux) or using Docker (Linux).
Connection Info
The default connection information is as follows. These details may be changed using --robotraconteur-*
command
line options when starting the service. Also see the
Robot Raconteur Service Browser to detect
services on the network.
- URL:
rr+tcp://localhost:59823?service=camera
- Device Name:
camera
or device name in the configuration file - Node Name:
com.robotraconteur.imaging.camera
- Service Name:
camera
- Root Object Type:
com.robotraconteur.imaging.Camera
Installation
Install using Python pip
python -m pip install robotraconteur-camera-driver
On Linux use python3
instead of python
. On Ubuntu the python3-pip
apt package must be installed
to use python pip.
See the Docker section for installation instructions using docker.
Usage
Example usage:
python robotraconteur_camera_driver.py --camera-info-file=config/generic_webcam_1080p_default_camera_info.yml --width=1280 --height=720 --fps=20 --device-id=0
On Ubuntu, use python3
instead of python
Command Line Options
The following command line arguments are available:
--camera-info-file=
- The camera info file. Info files are available in theconfig/
directory. See camera info file documentation. Also seecamera_client_calibrate_intrinsic.py
example.--device-id=
- The Device ID used to identify the camera. Default is 0. Passed to the OpenCV Video Capture creation function.--width=
- Captured image width (OpenCVCAP_PROP_FRAME_WIDTH
)--height=
- Captured image height (OpenCVCAP_PROP_FRAME_HEIGHT
)--fps=
- Frames per second (OpenCVCAP_PROP_FPS
)--focus=
- Camera focus (OpenCVCAP_PROP_FOCUS
)--exposure=
- Camera exposure (OpenCVCAP_PROP_EXPOSURE
)--gain=
- Camera gain (OpenCVCAP_PROP_GAIN
)--brightness=
- Camera brightness (OpenCVCAP_PROP_BRIGHTNESS
)--contrast=
- Camera contrast (OpenCVCAP_PROP_CONTRAST
)--saturation=
- Camera saturation (OpenCVCAP_PROP_SATURATION
)
See the OpenCV Video Capture and OpenCV Video Capture Properties documentation for more information on these options.
The focus
, exposure
, gain
, brightness
, contrast
, and saturation
properties can be changed by the client using the setf_param
function
during runtime. All parameters are scalar double types. For example:
# camera_client connected using RRN.ConnectService
focus_value=10
camera_client.setf_param("focus", RR.VarValue(focus_value, "double"))
All Robot Raconteur node setup command line options are supported. See Robot Raconteur Node Command Line Options
By default the node listens on TCP port 59823 and have the NodeName com.robotraconteur.imaging.Camera. If there are multiple cameras, it will be necessary to change these two values for each additional camera. These can be overridden using Robot Raconteur node setup command line options. An additional camera info file with a different device name is also needed. For example,
python robotraconteur_camera_driver.py --camera-info-file=config/generic_webcam_1080p_default_camera_info2.yml --width=1280 --height=720 --fps=20 --device-id=1 --robotraconteur-tcp-port=54444 --robotraconteur-node-name=camera2
Examples
The following examples can be found in the examples/
directory:
camera_client_capture_frame.py
- Basic example to capture and display a single framecamera_client_capture_frame_compressed.py
- Capture and display a frame from the camera using a compressed format. The compressed image is more efficient to transfer but requires additional computational power to compress the image. Lossless PNG is used to compress the image.camera_client_image.py
- Stream full resolution uncompressed imagescamera_client_image_preview.py
- Stream "preview" images, which are mjpeg compressed and reduced resolution for live preview use onlycamera_client_aruco_detection.py
- Example of streaming detection of ArUco markerscamera_client_capture_calibration_images.py
andcamera_client_calibrate_intrinsic.py
- Examples capturing images and generating intrinsic calibration parameters. Outputs Yaml format compatible with info files.
Docker Usage
sudo docker run --rm --net=host --privileged -v /var/run/robotraconteur:/var/run/robotraconteur -v /var/lib/robotraconteur:/var/lib/robotraconteur wasontech/robotraconteur-camera-driver --camera-info-file=config/generic_webcam_1080p_default_camera_info.yml --width=1280 --height=720 --fps=20 --device-id=0
It may be necessary to mount a docker "volume" to access configuration yml files that are not included in the docker image. See the docker documentation for instructions on mounting a local directory as a volume so it can be accessed inside the docker.
License
License: Apache 2.0
Author: John Wason, PhD
Acknowledgment
This work was supported in part by the Advanced Robotics for Manufacturing ("ARM") Institute under Agreement Number W911NF-17-3-0004 sponsored by the Office of the Secretary of Defense. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of either ARM or the Office of the Secretary of Defense of the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes, notwithstanding any copyright notation herein.
This work was supported in part by the New York State Empire State Development Division of Science, Technology and Innovation (NYSTAR) under contract C160142.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file robotraconteur_camera_driver-0.2.0.tar.gz
.
File metadata
- Download URL: robotraconteur_camera_driver-0.2.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91861a8ee4ee7c9b33676166261f1ffb48a4c788be35e8238c3ae7088bddf5c4 |
|
MD5 | e261a34dd21ffc8326a390731ebc420d |
|
BLAKE2b-256 | a005156da07171f3755fe1240e0e477b999fa0d37962eb35ff551faee76e4c6c |
File details
Details for the file robotraconteur_camera_driver-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: robotraconteur_camera_driver-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a64350b269f98e68ac26d46d30f1f94782e43f5177cfbfc5cbf9394b357ca1f |
|
MD5 | 9b8b7f9b07c50376ad664164be94a9c7 |
|
BLAKE2b-256 | 49fcc0d2cf60a097348dc04b1b7c63efcd3d7051a77106aa0f51485121eb339d |