Cropping a raw camera image before it is rectified.
Hi, After reading a lot of Q&A's on the topic, I still can't seem to crop an input image before rectifying it. I hope someone can help me. I'm runing KUbuntu 14.04 and ROS indigo
I can take a raw image, rectify it using the camera calibrator toolbox (e.g. using rosrun camera_calibration cameracalibrator.py -p circles -s 8x7 -q 0.02 image:=camera/image_raw&) and act upon the rectified image (view it etc). All fine, using the following : roscore& roslaunch uvc_camera webcam_calibrated.launch& The launch file for uvc_camera is e.g.:
<launch>
<node ns="camera" pkg="uvc_camera" type="uvc_camera_node" name="webcam" output="screen">
<param name="width" type="int" value="640" />
<param name="height" type="int" value="480" />
<param name="fps" type="int" value="30" />
<param name="device" type="string" value="/dev/video1" />
<param name="frame" type="string" value="Webcam Video 1" />
<param name="camera_info_url" type="string" value="file:///home/auser/.ros/camera_info/webcam_cal.yaml" />
</node>
</launch>
But what I'd like to do now is take, say a 720x576 resolution raw image from a video capture card and crop it down to 640x480. Then I would like to run the monocular camera calibrator again, with the input to the calibrator acting upon the output of the cropping process.
As an example, let's suppose I have input from the capture card on /dev/video0
and I remap the image_rawand
camera_infoto the
camera0` namespace.
ltop1:~/rosbuild_ros$ roscore&
ltop1:~/rosbuild_ros$ rosrun uvc_camera uvc_camera_node /image_raw:=/camera0/image_raw /camera_info:=/camera0/camera_info &
I can view the raw image (un-rectified) with rviz:
ltop1:~/rosbuild_ros$ rosrun rviz rviz -d ./ImageRawViewer.rviz &
Running up imag_proc
ltop1:~/rosbuild_ros$ ROS_NAMESPACE=camera0 rosrun image_proc image_proc&
of course it now complains that it cannot find a camera calibration file (which is what I want). I can view the camera0/image_color
or image_mono
output in rviz, which is the unrectified color / mono output .Then I try to run the imag_proc
nodelet and this is where things go wrong:
ltop1:~/rosbuild_ros$ rosrun nodelet nodelet standalone image_proc/crop_decimate _x_offset=45 _y_offset=46 _width=640 _height=480 camera0/image_color:=camera/image_raw /camera0/camera_info:=camera/camera_info &
Help! I can't see anything using rviz with the nodelet's default camera_out/image_raw
published topic.
Can anyone shed any light on how to properly use the image_proc
nodelet to take a raw image and crop it prior to running up the monocular camera calibrator? Or perhaps provide and example launch file?
Many thanks.