====== Camera ======
For the perception, we use Camera Chameleon, a digital USB 2.0 camera [[http://www.ptgrey.com/products/chameleon/Chameleon_datasheet.pdf|Chameleon]] manufactured by [[http://www.ptgrey.com|PointGrey]].
==== Camera Control (Python) ====
From Python, the library used for the communication with the camera is PyCapture2. Here is an example of camera usage in Python:
import PyCapture2
import cv2
import numpy as np
# Initialize bus and camera
bus = PyCapture2.BusManager()
camera = PyCapture2.Camera()
# Select first camera on the bus
camera.connect(bus.getCameraFromIndex(0))
# Start capture
camera.startCapture()
while True:
# Retrieve image from camara in PyCapture2.Image format
image = camera.retrieveBuffer()
# Convert from MONO8 to RGB8
image = image.convert(PyCapture2.PIXEL_FORMAT.RGB8)
# Convert image to Numpy array
rgb_cv_image = np.array(image.getData(), dtype="uint8").reshape((image.getRows(), image.getCols(), 3));
# Convert RGB image to BGR image to be shown by OpenCV
bgr_cv_image = cv2.cvtColor(rgb_cv_image, cv2.COLOR_RGB2BGR)
# Show image
cv2.imshow('frame',bgr_cv_image)
# Wait for key press, stop if the key is q
if cv2.waitKey(1) & 0xFF == ord('q'):
break
More documentation about PyCapture2 can be found with this command:
evince /opt/salt-install/PyCapture2-2.13.31/docs/PyCapture2doc.pdf
==== Camera control (ROS) ====
Driver documentation: [[http://wiki.ros.org/pointgrey_camera_driver|pointgray_camera_driver]]
Start camera driver nodes:
# Assuming that the B3B33ROB ROS environment was properly sourced, i.e. :
source /opt/ros/b3b33rob
# just camera driver
roslaunch b3b33rob_ros camera.launch
# or camera with robot
roslaunch b3b33rob_ros start_rv6sdl.launch camera:=true
roslaunch b3b33rob_ros start_rv6s.launch camera:=true
roslaunch b3b33rob_ros start_fake_rv6sdl.launch camera:=true
roslaunch b3b33rob_ros start_fake_rv6sdl.launch camera:=true
Display camera stream:
rosrun image_view image_view image:=/camera/image_color
==== Parameter Settings (flycap2) ====
In order to configure the camera use the **FlyCap2** utility. In terminal run:
flycap2