Hi all. I am writing code to subscribe raw video frame and calibrate them as well as publish. I was using OpenCV to generate .xml file for camera calibration as expected. I also calibrate the video in OpenCV succesfully by reading "cameraMatrix" and "distCoeffs", getting the image using "videocapture" and watching the image in "imshow" . The OpenCV function I used is "undistort(old_frame, new_frame, cameraMatrix, distCoeffs)".
All things works excellently but when I change it into ROS, I can only get a heavily distorted image and don't know why.
Here is my code
#include "CalibratedVideo.h"
#include
using namespace cv;
using namespace std;
CalibratedVideo::CalibratedVideo(ros::NodeHandle n){
image_transport::ImageTransport it(n);
img_sub = it.subscribe("/usb_cam/image_raw", 1, &CalibratedVideo::send_video, this);
img_pub = it.advertise("/CalibratedVideo/image_fine",1);
//read the calibrating parameters.
string path = ros::package::getPath("irb120_cam_cali");
const string inputSettingsFile = path + "/src/out_camera_data.xml";
ROS_INFO("%s\n", inputSettingsFile.c_str());
FileStorage fs(inputSettingsFile, FileStorage::READ); // Read the settings
if (!fs.isOpened())
{
ROS_INFO("Could not open the configuration file");
return;
}
fs["Camera_Matrix"] >> cameraMatrix;
fs["Distortion_Coefficients"] >> distCoeffs;
fs.release();
}
void CalibratedVideo::send_video(const sensor_msgs::ImageConstPtr& img){
Mat newFrame;
cv_bridge::CvImagePtr inMsgPtr;
inMsgPtr = cv_bridge::toCvCopy(img, sensor_msgs::image_encodings::BGR8);
undistort(inMsgPtr->image, newFrame, cameraMatrix, distCoeffs);
sensor_msgs::ImagePtr msg = cv_bridge::CvImage(std_msgs::Header(), "bgr8", newFrame).toImageMsg();
img_pub.publish(msg);
ROS_INFO("sent frame width=%d height=%d", newFrame.cols, newFrame.rows);
}
int main (int argc, char* argv[]){
ros::init(argc, argv, "cali");
ros::NodeHandle nh;
CalibratedVideo cali(nh);
ros::spin();
return 0;}
↧
Calibrate Camer using OpenCV in ROS
↧
StereoCalibration GUI doesn't start.
This is the message displayed in the console:
rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 right:=/optris/thermal_binary left:=/camera/rgb/image_rect_color left_camera:=/camera/rgb right_camera:=/optris
('Waiting for service', '/camera/rgb/set_camera_info', '...')
OK
('Waiting for service', '/optris/set_camera_info', '...')
OK
And nothig happens.
Mono calibration worked well for both camera
camera_calibration cameracalibrator.py --size 8x6 --square 0.108 image:=/optris/thermal_binary camera:=/optris
camera_calibration cameracalibrator.py --size 8x6 --square 0.108 image:=/camera/rgb/image_rect_color camera:=/camera/rgb
↧
↧
Can not commit after calibration
I am trying to calibrate my camera using:
rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 --no-service-check image:=/camera/color/image_raw camera:=/camera
When I click calibrate everything seems to be fine and I don't get any error in Terminal. but afterwards I dont see the results and when I click **COMMIT** nothing happens. I don't even get errors. This is all I get in Terminal:
init done
*** Added sample 1, p_x = 0.303, p_y = 0.421, p_size = 0.130, skew = 0.033
*** Added sample 2, p_x = 0.340, p_y = 0.525, p_size = 0.165, skew = 0.059
*** Added sample 3, p_x = 0.288, p_y = 0.589, p_size = 0.227, skew = 0.032
...
*** Added sample 77, p_x = 0.128, p_y = 0.935, p_size = 0.207, skew = 0.242
('D = ', [0.05972527274291541, -0.3404421907853329, 0.003975207752334216, 0.004222444284761914, 0.0])
('K = ', [636.1261204613188, 0.0, 316.95646684373344, 0.0, 637.5692374013765, 219.87787669125925, 0.0, 0.0, 1.0])
('R = ', [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0])
('P = ', [631.7277221679688, 0.0, 318.96466028216673, 0.0, 0.0, 639.1346435546875, 220.7255855114854, 0.0, 0.0, 0.0, 1.0, 0.0])
None
# oST version 5.0 parameters
[image]
width
640
height
480
[narrow_stereo]
camera matrix
636.126120 0.000000 316.956467
0.000000 637.569237 219.877877
0.000000 0.000000 1.000000
distortion
0.059725 -0.340442 0.003975 0.004222 0.000000
rectification
1.000000 0.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.000000 1.000000
projection
631.727722 0.000000 318.964660 0.000000
0.000000 639.134644 220.725586 0.000000
0.000000 0.000000 1.000000 0.000000
**Note:** I didn't have **/camera/image_raw** in my Topic list so I am using **/camera/color/image_raw** instead. Can that be the problem? This is list of my Topics:
rostopic list
/camera/color/camera_info
/camera/color/image_raw
/camera/color/image_raw/compressed
/camera/color/image_raw/compressed/parameter_descriptions
/camera/color/image_raw/compressed/parameter_updates
/camera/color/image_raw/compressedDepth
/camera/color/image_raw/compressedDepth/parameter_descriptions
/camera/color/image_raw/compressedDepth/parameter_updates
/camera/color/image_raw/theora
/camera/color/image_raw/theora/parameter_descriptions
/camera/color/image_raw/theora/parameter_updates
/camera/depth/camera_info
/camera/depth/image_raw
/camera/depth/image_raw/compressed
/camera/depth/image_raw/compressed/parameter_descriptions
/camera/depth/image_raw/compressed/parameter_updates
/camera/depth/image_raw/compressedDepth
/camera/depth/image_raw/compressedDepth/parameter_descriptions
/camera/depth/image_raw/compressedDepth/parameter_updates
/camera/depth/image_raw/theora
/camera/depth/image_raw/theora/parameter_descriptions
/camera/depth/image_raw/theora/parameter_updates
/camera/depth/points
/camera/driver/parameter_descriptions
/camera/driver/parameter_updates
/camera/ir/camera_info
/camera/ir/image_raw
/camera/ir/image_raw/compressed
/camera/ir/image_raw/compressed/parameter_descriptions
/camera/ir/image_raw/compressed/parameter_updates
/camera/ir/image_raw/compressedDepth
/camera/ir/image_raw/compressedDepth/parameter_descriptions
/camera/ir/image_raw/compressedDepth/parameter_updates
/camera/ir/image_raw/theora
/camera/ir/image_raw/theora/parameter_descriptions
/camera/ir/image_raw/theora/parameter_updates
/camera/ir2/camera_info
/camera/ir2/image_raw
/camera/ir2/image_raw/compressed
/camera/ir2/image_raw/compressed/parameter_descriptions
/camera/ir2/image_raw/compressed/parameter_updates
/camera/ir2/image_raw/compressedDepth
/camera/ir2/image_raw/compressedDepth/parameter_descriptions
/camera/ir2/image_raw/compressedDepth/parameter_updates
/camera/ir2/image_raw/theora
/camera/ir2/image_raw/theora/parameter_descriptions
/camera/ir2/image_raw/theora/parameter_updates
/camera/nodelet_manager/bond
/clicked_point
/initialpose
/move_base_simple/goal
/rosout
/rosout_agg
/tf
/tf_static
↧
Prosilica Camera calibration error with binning
Hi all,
I have a camera Prosilica GC2450, the resolution is 2448 * 2050.
I want to use the images for LSD-SLAM. LSD-SLAM only accept the resolution of a multiple of 16.
Then, I try to caliburate Prosilica GC2450 using camera_calibration (mono camera) with resolution 640 * 480.
Calibrate and Save processes are success.
But, following error occured in Commit process.
[ERROR] [1496236878.801921996]: Camera_info resolution 640x480 does not match current video setting, camera running at resolution 1224x1025.
The setting of rqt_reconfigure are as follows.
binning_x:2
binning_y:2
width:1280
height:960
commands are follows.
$roscore
$roslaunch prosilica.launch
$rosrun rqt_reconfigure rqt_reconfigure
$rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.081 image:=/prosilica/image_raw camera:=/prosilica
I can get 640*480 images in Save process.
Is there any issues with setting of caliburation?
Thanks
↧
Camera launch ignores camera info urls
Hello, I am using an Orbbec Astra camera with the astra drivers. My launch file looks like this:
The problem is that, even though it launches the camera, it completely ignores my camera info urls, where I have the calibration parameters; so my depth image looks completely bad. The output for rostopic echo /camera/depth/camera_info is:
header:
seq: 818
stamp:
secs: 1497437986
nsecs: 339961044
frame_id: camera_depth_optical_frame
height: 480
width: 640
distortion_model: plumb_bob
D: [0.0, 0.0, 0.0, 0.0, 0.0]
K: [570.3422241210938, 0.0, 314.5, 0.0, 570.3422241210938, 235.5, 0.0, 0.0, 1.0]
R: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
P: [570.3422241210938, 0.0, 314.5, 0.0, 0.0, 570.3422241210938, 235.5, 0.0, 0.0, 0.0, 1.0, 0.0]
binning_x: 0
binning_y: 0
roi:
x_offset: 0
y_offset: 0
height: 0
width: 0
do_rectify: False
-----------------------------------------------
But in the url file the parameters look like:
image_width: 640
image_height: 480
camera_name: "depth_Orbbec_Orbbec "
camera_matrix:
rows: 3
cols: 3
data: [586.0295803105151, 0, 325.1107120728067, 0, 585.5541564977655, 242.3986130691661, 0, 0, 1]
distortion_model: plumb_bob
distortion_coefficients:
rows: 1
cols: 5
data: [-0.03292964909879049, 0.08060137821556344, -0.001139453780851402, 0.007361020257652488, 0]
rectification_matrix:
rows: 3
cols: 3
data: [1, 0, 0, 0, 1, 0, 0, 0, 1]
projection_matrix:
rows: 3
cols: 4
data: [586.5491943359375, 0, 328.8950540238802, 0, 0, 589.6646118164062, 241.3611304274491, 0, 0, 0, 1, 0]
I am trying to calibrate the camera but, if the launch file ignores the files, I am not able to check if the calibration was good.
How can I solve this?
Regards
↧
↧
stereo_calibration - rotation and translation matrix from output?!
I did a stereo calibration of two rgb-cameras with the camera_calibration package.
$ rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 right:=/my_stereo/right/image_raw left:=/my_stereo/left/image_raw right_camera:=/my_stereo/right left_camera:=/my_stereo/left
I am actually interested in the **Rotation** and **Translation** between the two camera frames. But I do not understand how to get this information from the output I got:
[image]
width
640
height
480
[narrow_stereo/left]
camera matrix
648.128948 0.000000 310.456734
0.000000 645.852354 239.382301
0.000000 0.000000 1.000000
distortion
-0.004746 0.045946 -0.002314 -0.002279 0.000000
rectification
0.999426 0.029044 0.017429
-0.028984 0.467011 0.883776
0.017528 -0.883774 0.467585
projection
3533.740115 0.000000 378.726444 0.000000
0.000000 3533.740115 -2855.120445 0.000000
0.000000 0.000000 1.000000 0.000000
# oST version 5.0 parameters
[image]
width
640
height
480
[narrow_stereo/right]
camera matrix
541.784078 0.000000 311.829932
0.000000 540.030207 240.621846
0.000000 0.000000 1.000000
distortion
0.047129 -0.150119 -0.000644 -0.002149 0.000000
rectification
0.997956 0.054935 0.032662
-0.054994 0.477731 0.876783
0.032563 -0.876787 0.479775
projection
3533.740115 0.000000 378.726444 0.000000
0.000000 3533.740115 -2855.120445 305.406125
0.000000 0.000000 1.000000 0.000000
Left:
('D = ', [-0.004745505276970892, 0.04594649780065838, -0.0023144618343065573, -0.0022789476229827144, 0.0])
('K = ', [648.1289483347696, 0.0, 310.4567342485528, 0.0, 645.8523544134756, 239.38230099187072, 0.0, 0.0, 1.0])
('R = ', [0.9994261827735477, 0.029043505832408213, 0.01742928442759996, -0.02898385832798141, 0.4670110286018882, 0.8837763490389581, 0.017528295499529056, -0.8837743908561558, 0.4675848424871277])
('P = ', [3533.74011530084, 0.0, 378.72644424438477, 0.0, 0.0, 3533.74011530084, -2855.120445251465, 0.0, 0.0, 0.0, 1.0, 0.0])
Right:
('D = ', [0.04712904679290734, -0.15011876036543534, -0.0006437146133086122, -0.0021494622132509017, 0.0])
('K = ', [541.7840777852443, 0.0, 311.82993239170753, 0.0, 540.030207287234, 240.621846446304, 0.0, 0.0, 1.0])
('R = ', [0.9979555802017678, 0.05493504956821761, 0.032661908595344215, -0.05499401026517345, 0.4777307594543458, 0.8767833143406234, 0.03256253643540602, -0.8767870105105982, 0.47977517591136526])
('P = ', [3533.74011530084, 0.0, 378.72644424438477, 0.0, 0.0, 3533.74011530084, -2855.120445251465, 305.4061245407626, 0.0, 0.0, 1.0, 0.0])
('self.T', [-0.00475289834567013, 0.041288237125056894, 0.07577665175074097])
('self.R', [0.9995476404618809, -0.02547661638974252, -0.015983005487590064, 0.0256884644291203, 0.9995829459246669, 0.013192308813783209, 0.01564024431907163, -0.01359692001499986, 0.999785230198839])
[image]
width
640
height
480
[narrow_stereo/left]
camera matrix
648.128948 0.000000 310.456734
0.000000 645.852354 239.382301
0.000000 0.000000 1.000000
distortion
-0.004746 0.045946 -0.002314 -0.002279 0.000000
rectification
0.999426 0.029044 0.017429
-0.028984 0.467011 0.883776
0.017528 -0.883774 0.467585
projection
3533.740115 0.000000 378.726444 0.000000
0.000000 3533.740115 -2855.120445 0.000000
0.000000 0.000000 1.000000 0.000000
# oST version 5.0 parameters
[image]
width
640
height
480
[narrow_stereo/right]
camera matrix
541.784078 0.000000 311.829932
0.000000 540.030207 240.621846
0.000000 0.000000 1.000000
distortion
0.047129 -0.150119 -0.000644 -0.002149 0.000000
rectification
0.997956 0.054935 0.032662
-0.054994 0.477731 0.876783
0.032563 -0.876787 0.479775
projection
3533.740115 0.000000 378.726444 0.000000
0.000000 3533.740115 -2855.120445 305.406125
0.000000 0.000000 1.000000 0.000000
I also read the corresponding information in the documentation, but it is still not clear to me how to extract this information.
Any help is greatly appreciated!
Cheers!
↧
What exactly does the parameters p_x,p_y and p_size obtained as a result of the camera calibration mean ?
I have used the ROS camera_calibration package provided in the ROS website. The package is working properly but I'm not able to understand what the does parameters p_x,p_y & p_size implies in the output obtained from the packages. Also in the source code of the camera calibration package written in python, I didn't understand how the above parameters are calculated by the author ?
The output obtained is according to the image attached.
Links:- http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration
Any help in these problem will be highly appreciated and thanks in advance.![image description]
↧
Camera calibration - waiting for service
I am running camera calibration on Raspberry Pi using Raspberry pi camera. I am using Indigo distribution. I am following the steps of the ROS wiki tutorial. I am getting the message : ('Waiting for service', '/camera/set_camera_info', '...')
OK
The camera works with the terminal command 'raspistill -o cam.jpg'
Where should I look for the problem?
Thanks
Ash
↧
Can't find camera calibration file
Hi,
I'm trying to use a USB Camera, HP HD 4310, with ROS. The thing is, i'm reallu new at ROS, so i must be missing something really basic.
First, I installed uvc_camera.
I confirmed that my camera is in /dev/video1.
Then i have in parallel a roscore running in one terminal, and in another i'm doing:
> rosrun uvc_camera uvc_camera_node device:=/dev/video1
This gives me this output:
[ INFO] [1506637439.537106354]: using default calibration URL
[ INFO] [1506637439.537174997]: camera calibration URL: file:///home/cesar/.ros/camera_info/camera.yaml
[ INFO] [1506637439.537215489]: Unable to open camera calibration file [/home/cesar/.ros/camera_info/camera.yaml]
[ WARN] [1506637439.537231103]: Camera calibration file /home/cesar/.ros/camera_info/camera.yaml not found.
opening /dev/video0
pixfmt 0 = 'YUYV' desc = 'YUYV 4:2:2'
discrete: 640x480: 1/30 1/25 1/20
discrete: 160x120: 1/30 1/25 1/20
discrete: 176x144: 1/30 1/25 1/20
discrete: 320x240: 1/30 1/25 1/20
discrete: 352x288: 1/30 1/25 1/20
int (Brightness, 0, id = 980900): -64 to 64 (1)
int (Contrast, 0, id = 980901): 0 to 64 (1)
int (Saturation, 0, id = 980902): 0 to 128 (1)
int (Hue, 0, id = 980903): -180 to 180 (1)
bool (White Balance Temperature, Auto, 0, id = 98090c): 0 to 1 (1)
int (Gamma, 0, id = 980910): 100 to 500 (1)
int (Gain, 0, id = 980913): 0 to 128 (1)
menu (Power Line Frequency, 0, id = 980918): 0 to 2 (1)
0: Disabled
1: 50 Hz
2: 60 Hz
int (White Balance Temperature, 16, id = 98091a): 2800 to 6500 (10)
int (Sharpness, 0, id = 98091b): 0 to 8 (1)
int (Backlight Compensation, 0, id = 98091c): 0 to 1 (1)
menu (Exposure, Auto, 0, id = 9a0901): 0 to 3 (1)
int (Exposure (Absolute), 16, id = 9a0902): 50 to 10000 (1)
And stays here infinitly.
As you can see, it wasn't able to find the calibration file and so it changed to /dev/video0. The thing is, i don't even know why is he trying to look in "/home/cesar/.ros/camera_info/camera.yaml". I never specified that path, or any path. The file ".ros" in "/home/cesar" doesn't exist.
So, can someone tell me what I'm doing wrong please?
↧
↧
Need a camera with constant focus
Hello,
I use a usb camera to localize NAO robot by tracking a marker placed on its head (using ar_pose marker tracker). My problem is with the camera autofocus which results in the poor performance when there are other moving objects in the environment.
Is there a camera with constant focus you could suggest me to buy?
(I need a camera with a wide field of view and a long data cable as the camera is placed in the ceiling in my scenario)
or whether it is possible to set the autofocus of usb camera off?
Thanks,
Pouyan
↧
Unable to view image using image_view in ROS Indigo with rosberrypi_cam
I have succesfully installed the rosberrypi_cam package following this [page](https://github.com/japonophile/rosberrypi_cam). After that when I execute the command
rosrun rosberrypi_cam rosberrypi_cam_node
the red light on camera becomes on, showing a message,
[ INFO] [1506259295.746458853]: using default calibration URL
[ INFO] [1506259295.747325311]: camera calibration URL: file:///home/pi/.ros/camera_info//rosberrypi_cam.yaml
[ INFO] [1506259295.747978384]: Unable to open camera calibration file [/home/pi/.ros/camera_info//rosberrypi_cam.yaml]
[ WARN] [1506259295.748239009]: Camera calibration file /home/pi/.ros/camera_info//rosberrypi_cam.yaml not found.
Now when I try to view an image using,
rosrun image_view image_view image:=/rosberrypi_cam/image_raw
I get the following message,
[ INFO] [1506259415.296537089]: Using transport "raw"
(image_raw:1697): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
Attempt to unlock mutex that was not locked
Aborted
Even while trying to calibrate the camera using cameraclibrator.py I am unable to calibrate it since the calibration window is opening as half black with all buttons disabled and without checkerboard. I am unable to understand the problem. Plesae help...
Thank you.
↧
Export matlab monocular camera calibration parameters to ROS
I have calibrated my camera using matlab's calibration toolbox and saved it as a .mat file. Is there a way to convert this file into yaml? Also once I have the yaml file, how can this file be accepted by camera_info so that image_proc can subscribe and read the parameters?
↧
how to check calibration of a single camera?
Hi,
What's the best way to check the calibration of a single camera? Is there a way to load the calibration into the `camera_calibration` package and check it using any checkerboard? (I do not have the original apparatus used to calibrate the camera)
Thank you.
↧
↧
Camera matrix drastically changes between successive calibrations of low-res camera
I'm using camera_calibration package to calibrate a camera using checkerboard (in gazebo environment). The resolution of the camera is 84x84, and I've managed to calibrate the camera thrice.
camera matrix
18.869876 0.000000 42.232541
0.000000 18.817910 46.843425
0.000000 0.000000 1.000000
projection
19.568193 0.000000 41.369775 0.000000
0.000000 19.412340 45.832273 0.000000
0.000000 0.000000 1.000000 0.000000
distortion
-0.003044 0.000774 -0.000227 -0.001105 0.0000
camera matrix
59.194174 0.000000 41.422579
0.000000 59.220697 43.212139
0.000000 0.000000 1.000000
projection
58.686417 0.000000 40.837182 0.000000
0.000000 58.767673 42.702490 0.000000
0.000000 0.000000 1.000000 0.000000
distortion
-0.004351 0.007664 0.000151 -0.000845 0.0000
camera matrix
46.885763 0.000000 41.564895
0.000000 46.850151 41.490714
0.000000 0.000000 1.000000
projection
46.414661 0.000000 41.097325 0.000000
0.000000 46.358101 41.072972 0.000000
0.000000 0.000000 1.000000 0.000000
distortion
0.002144 -0.001044 0.000596 0.000203 0.0000
I'd also like to add that all 'X', 'Y', 'scale' and 'skew' bars were not green.
↧
Camera matrix drastically change between successive calibrations of a low resolution camera
I'm using camera_calibration package to calibrate a camera using checkerboard (in gazebo environment). The resolution of the camera is 84x84, and I've managed to calibrate the camera thrice.
camera matrix
18.869876 0.000000 42.232541
0.000000 18.817910 46.843425
0.000000 0.000000 1.000000
projection
19.568193 0.000000 41.369775 0.000000
0.000000 19.412340 45.832273 0.000000
0.000000 0.000000 1.000000 0.000000
distortion
-0.003044 0.000774 -0.000227 -0.001105 0.0000
camera matrix
59.194174 0.000000 41.422579
0.000000 59.220697 43.212139
0.000000 0.000000 1.000000
projection
58.686417 0.000000 40.837182 0.000000
0.000000 58.767673 42.702490 0.000000
0.000000 0.000000 1.000000 0.000000
distortion
-0.004351 0.007664 0.000151 -0.000845 0.0000
camera matrix
46.885763 0.000000 41.564895
0.000000 46.850151 41.490714
0.000000 0.000000 1.000000
projection
46.414661 0.000000 41.097325 0.000000
0.000000 46.358101 41.072972 0.000000
0.000000 0.000000 1.000000 0.000000
distortion
0.002144 -0.001044 0.000596 0.000203 0.0000
I'd also like to add that all 'X', 'Y', 'scale' and 'skew' bars were not green.
Calibration window: https://drive.google.com/open?id=1_DiYW-3zff6RDWgvk9r7VrFenT4tLyIx
Gazebo env.: https://drive.google.com/open?id=1v03is0M4xXDIf4cd6iUAVdLDf4Z-BNII
↧
How to use camera_info_manager to publish camera_info
I am trying to calibrate my ov7251 camera using the camera_calibration package. I adapted a sample camera driver that I found which use the UV4L API so that I can try to publish images to the ROS topic /camera/image. I am also publishing to /camera/camera_info. However, what I need now is to be able to run the /camera/set_camera_info service so that I can use the calibration package.
Here is my code for publishing to /camera/image and /camera/camera_info:
int main(int argc, char **argv) {
dev_name = "/dev/video2";
namedWindow( "Camera Preview", WINDOW_AUTOSIZE );// Create a window for display.
ros::init(argc, argv, "image_publisher");
ros::NodeHandle nh;
image_transport::ImageTransport it(nh);
image_transport::Publisher pub = it.advertise("camera/image", 1);
ros::Publisher pub_info = nh.advertise("camera/camera_info", 100);
sensor_msgs::CameraInfo cam_info;
open_device();
init_device();
start_capturing();
while (nh.ok()) {
read_frame();
if (!prev.empty()) {
cv::Mat image = prev;
sensor_msgs::ImagePtr msg = cv_bridge::CvImage(std_msgs::Header(), "bgr8", image).toImageMsg();
ros::Rate loop_rate(5);
cam_info.header.stamp = ros::Time::now();
pub_info.publish(cam_info);
pub.publish(msg);
ros::spinOnce();
loop_rate.sleep();
}
}
...
return 0;
}
When I ran rostopic list, this is what I get:
/camera/camera_info
/camera/image
/camera/image/compressed
/camera/image/compressed/parameter_descriptions
/camera/image/compressed/parameter_updates
/camera/image/compressedDepth
/camera/image/compressedDepth/parameter_descriptions
/camera/image/compressedDepth/parameter_updates
/camera/image/theora
/camera/image/theora/parameter_descriptions
/camera/image/theora/parameter_updates
/camera/image_raw
/rosout
/rosout_agg
/statistics
/svo/dense_input
/svo/image
/svo/image/compressed
/svo/image/compressed/parameter_descriptions
/svo/image/compressed/parameter_updates
/svo/image/compressedDepth
/svo/image/compressedDepth/parameter_descriptions
/svo/image/compressedDepth/parameter_updates
/svo/image/theora
/svo/image/theora/parameter_descriptions
/svo/image/theora/parameter_updates
/svo/info
/svo/keyframes
/svo/points
/svo/pose
/svo/remote_key
/tf
And when I run rosservice list:
/camera/image/compressed/set_parameters
/camera/image/compressedDepth/set_parameters
/camera/image/theora/set_parameters
/image_publisher/get_loggers
/image_publisher/set_logger_level
/rosout/get_loggers
/rosout/set_logger_level
/rqt_gui_py_node_13721/get_loggers
/rqt_gui_py_node_13721/set_logger_level
/rqt_gui_py_node_13807/get_loggers
/rqt_gui_py_node_13807/set_logger_level
/svo/get_loggers
/svo/image/compressed/set_parameters
/svo/image/compressedDepth/set_parameters
/svo/image/theora/set_parameters
/svo/set_logger_level
As you can see, I don't have a /set_camera_info service, which I think is the main problem I am having with trying to run the camera_calibration package. If anyone can please provide me with a simple sample code for using the camera_info_manager, it would be much appreciated.
EDIT: For now, I wish to simply initialize a camera_info_manager object so that I can use its functions to run the set_camera_info service, but I am not well-versed with C++ so I am having some problems understanding the tutorial for camera_info_manager.
EDIT2: I added these two lines in, based on @joq's comments:
boost::shared_ptr cinfo;
cinfo(new camera_info_manager::CameraInfoManager(nh));
but I only get this error:
no match for call to ‘(boost::shared_ptr) (camera_info_manager::CameraInfoManager*)’
cinfo(new camera_info_manager::CameraInfoManager(nh));
As a separate approach, I have also tried to simply do this to instantiate a camera info manager:
camera_info_manager::CameraInfoManager cinfo(nh, "camera","");
but then I get this error:
CMakeFiles/vga_cam_publisher.dir/src/vga_cam_publisher.cpp.o: In function `vga_cam_publisher::vga_cam_publisher()':
vga_cam_publisher.cpp:(.text._ZN15vga_cam_publisherC2Ev[_ZN15vga_cam_publisherC5Ev]+0x147): undefined reference to `camera_info_manager::CameraInfoManager::CameraInfoManager(ros::NodeHandle, std::__cxx11::basic_string, std::allocator> const&, std::__cxx11::basic_string, std::allocator> const&)'
collect2: error: ld returned 1 exit status
↧
Stereo-camera calibration with one camera upside down
I'm trying to calibrate a stereo camera with one of the cameras upside down, but the results are far from correct (rectified image is distorted). The images are being published using [cv_camera](http://wiki.ros.org/cv_camera), which apparently does not give an option to flip the image. Is there a way to solve this without an intermediate node such as [image_rotate](http://wiki.ros.org/image_rotate)?
↧
↧
The right way to use CameraInfo to correct barrel distortion
Environment: Kinetic, on Ubuntu 16, kernel 4.13.0-31-generic
OpenCV: 3.3.0
C++ code base
I have a USB camera which is easily publishing the raw images and the default camera_info topics, as generated by the image_transport helper methods. Looking at the image on RVIZ, there's clearly a barrel distortion. That's fine - that's what camera_calibration cameracalibrator.py is for. I ran through that, and at the end I saw a feed of the distortion-corrected frames. I was able to generate a calibration file. That's a YAML file that has the width and height, and then a camera matrix (3x3), a distortion (1x5), rectification (3x3 identity) and projection (3x4). Great. I can get this file into the camera_info topic and now I'm publishing all of the information needed to correct barrel distortion.
Now, how do I correct barrel distortion?
The "obvious" answer (because I'm new at ROS and ignorant of many packages) was to use cv_bridge and OpenCV. After some time passed, I ran into the same problem as the [stack overflow poster](https://stackoverflow.com/questions/38983164/opencv-fisheye-undistort-issues) linked here, where the remove fisheye distortion function was, instead, creating unusably distorted images. I have adopted his solution, which is to carry out each step that the remove-fisheye-distortion function allegedly wraps, and I now have an image, but with a different fisheye distortion.
Now that I've gotten that out of my system, it seems like there's something I'm missing here. Since there's a standard camera_info channel that carries the information you need to correct distortion, it seems like there should be a standard way to correct distortion that doesn't involve hand-wiring OpenCV. This is where my googling is coming up empty.
**What is the "right" way to remove fisheye distortion in ROS?** Is there a node that you just point your camera to, that subscribes to the /camera_info and /image_raw nodes and issues an /image_corrected topic? Is there a wrapper library that depends on OpenCV but will make the transformation for you if you provide the ImageConstPtr and CameraInfoConstPtr? Or is it the case that the best way to do this is using OpenCV yourself?
If you're aware of tutorials or example code for this kind of problem, I'd also be glad to see those.
↧
Left and Right camera according to ROS/OpenCV
HI,
I am currently trying to calibrate 2 cameras (stereo calibration) and tried using [this tutorial](http://wiki.ros.org/camera_calibration/Tutorials/StereoCalibration).
**Question**:
What is the Translation (and Rotation) vector in the output of the calibration ?
Is it the transform required to move left camera coordinate system to right ?
**What I dont understand:**
The tutorial mentions left and right camera, but are these left and right wrt to user ?
(can be opposite since user is facing the cameras).
On digging deeper into openCV docs , I came across this image. It clearly suggests that the camera to the **right** of the user (facing cameras) is the **left** camera. However my results from stereo calibration dont make sense then.
Can someone please explain which is the left camera ??

↧
How to get raw stereo camera calibration from left and right camera_info messages
Hi guys,
I am trying to obtain the stereo un-rectified calibration (that is un-rectified extrinsics R and t; and calibration matrix K for each camera) from the left_camera_info.yaml and the right_camera_info.yaml configuration files. The only unrectified information that I can get straightforward from the configuration files is the instrinsic matrix K and distortion parameters D. But I do not know how to get the un-rectified extrinsic R and T.
I think I should use R rotation rectification matrix and Projection matrix from right configuration file right_camera_info.yaml but I am not sure how should I use them.
Any suggestions? thank you very much
This is my **left_camera_info.yaml**
image_width: 672
image_height: 376
camera_name: narrow_stereo/left
camera_matrix:
rows: 3
cols: 3
data: [348.522264, 0.000000, 344.483596, 0.000000, 348.449870, 188.808062, 0.000000, 0.000000, 1.000000]
distortion_model: plumb_bob
distortion_coefficients:
rows: 1
cols: 5
data: [-0.174497, 0.027127, -0.000359, 0.000457, 0.000000]
rectification_matrix:
rows: 3
cols: 3
data: [0.999873, 0.000708, 0.015892, -0.000683, 0.999999, -0.001578, -0.015893, 0.001567, 0.999872]
projection_matrix:
rows: 3
cols: 4
data: [347.652079, 0.000000, 339.375946, 0.000000, 0.000000, 347.652079, 198.590004, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000]
This is my **right_camera_info.yaml**
image_width: 672
image_height: 376
camera_name: narrow_stereo/right
camera_matrix:
rows: 3
cols: 3
data: [349.569635, 0.000000, 340.836585, 0.000000, 349.390781, 206.105440, 0.000000, 0.000000, 1.000000]
distortion_model: plumb_bob
distortion_coefficients:
rows: 1
cols: 5
data: [-0.174606, 0.027855, -0.000108, -0.000141, 0.000000]
rectification_matrix:
rows: 3
cols: 3
data: [0.999997, -0.000440, 0.002268, 0.000436, 0.999999, 0.001573, -0.002269, -0.001572, 0.999996]
projection_matrix:
rows: 3
cols: 4
data: [347.652079, 0.000000, 339.375946, -41.272771, 0.000000, 347.652079, 198.590004, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000]
↧