sourishg / stereo-calibration Goto Github PK
View Code? Open in Web Editor NEW:camera: :camera: Stereo camera calibration using OpenCV and C++
Home Page: http://sourishghosh.com/2016/stereo-calibration-cpp-opencv/
:camera: :camera: Stereo camera calibration using OpenCV and C++
Home Page: http://sourishghosh.com/2016/stereo-calibration-cpp-opencv/
I'm getting the following error while trying to run the ./calibrate
:
OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /home/pi/opencv-3.2.0/modules/imgproc/src/color.cpp, line 9748
terminate called after throwing an instance of 'cv::Exception'
what(): /home/pi/opencv-3.2.0/modules/imgproc/src/color.cpp:9748: error: (-215) scn == 3 || scn == 4 in function cvtColor
Aborted
This may be because of cv::cvtColor(img, gray, CV_BGR2GRAY);
on line 30. I tried changing from CV_BGR2GRAY
to CV_RGB2GRAY
, but the error remains same.
Making your code depend on platform-dependent libraries such as popt, which is a terrible piece of incompatible code makes your code dirty. Please fix.
In calib-stereo.cpp
you're using Vec3d to store and then write the contents of vector T. opencv does not store metadata about the type of the container for Vec3d as it does for Mat, so users may get errors on cvRead because opencv won't be able to tell the type of the node. Ideally, you would want to specify Mat as T's type on the reader side just like the other calibration params and rely on simple fs["T"] >> T;
working seamlessly on the reader side.
diff --git calib_stereo.cpp calib_stereo.cpp
index 5adb9f1..15d7aea 100644
--- calib_stereo.cpp
+++ calib_stereo.cpp
@@ -118,9 +118,7 @@ int main(int argc, char const *argv[])
leftimg_dir, rightimg_dir, leftimg_filename, rightimg_filename, extension);
printf("Starting Calibration\n");
- Mat K1, K2, R, F, E;
- Vec3d T;
- Mat D1, D2;
+ Mat K1, K2, D1, D2, R, T, F, E;
fsl["K"] >> K1;
fsr["K"] >> K2;
fsl["D"] >> D1;
Hi,
Can you please explain the way you use vectors in calib_stereo.cpp because seems like it is a bit redundant to my understanding.
You created vectors: "imagePoints1, imagePoints2" to hold the corners.
Then, why don't you use those vectors in stereoCalibrate()? But you created other vectors v1,v2, and then push "imagePoints1, imagePoints2" into "v1, v2". Finally, push "v1, v2" into 2 more new vectors "left_img_points, right_img_points" before sending them to stereoCalibrate()?
Thank you,
Getting error when running the calibration for pictures that I have taken.
./calibrate -w 11 -h 16 -n 10 -s 0.015 -d "../calib_imgs/1/" -i "left" -o "cam_left.yml" -e "jpg"
Starting Calibration
OpenCV Error: Assertion failed (nimages > 0) in calibrateCamera, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/calib3d/src/calibration.cpp, line 3334
terminate called after throwing an instance of 'cv::Exception'
what(): /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/calib3d/src/calibration.cpp:3334: error: (-215) nimages > 0 in function calibrateCamera
Aborted (core dumped)
I used this code to take images:
rosrun image_view image_view image:=/kinect2/hd/image_color_rect
Because i wasn't able to use Kincet v2 with the read function.
Can this program be used to calibrate two cameras with different resolutions?
In the current code, correspondences (checkerboard corners) are found automatically using OpenCV API. We want an option to manually specify correspondences, say for example using your mouse.
Hi there,
I'm interested in using your pipeline for camera calibration, undistortion, rectification and finally depth map estimation. You have a great data set for camera calibration, I'm wondering whether you have an image pair example to test depth map estimation after the stereo set has been calibrated?
First of all, thank you for the nice package.
For this issue, I wanted to point out that the meaning of board_width
and board_height
parameters for intrinsic calibration aren't clear.
./calibrate -w [board_width] -h [board_height] -n [num_imgs] -s [square_size] -d [imgs_directory] -i [imgs_filename] -o [file_extension] -e [output_filename]
board_height
and board_width
should be the number of inner corners per row or column (see documentation for findChessboardCorners).
e.g, If I am using a 10x8 checker board, I should use board_height=9
and board_width=7
but the the above instructions asks me to use board_height=10
and board_width=8
.
Hi,
i am using this project to calibrate my stereo camera.
I have successfully make cam_left.yml and cam_right.yml through-
"./calibrate -w 8 -h 6 -n 165 -s 0.108 -d "../calib_imgs/right/" -i "right" -o "cam_right.yml" -e "png""
"./calibrate -w 8 -h 6 -n 165 -s 0.108 -d "../calib_imgs/left/" -i "left" -o "cam_left.yml" -e "png""
but for stereo_calibratio "./calibrate_stereo -n 165 -u cam_left.yml -v cam_right.yml -L ../calib_imgs/left/ -R ../calib_imgs/right/ -l left -r right -o cam_stereo.yml"
it is throghing error-
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(3.4.2) /home/rahul/opencv/opencv/modules/imgproc/src/color.hpp:253: error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'CvtHelper'
Aborted (core dumped)
Any suggestion?
I have collected the stereo images through ROS. "http://wiki.ros.org/camera_calibration/Tutorials/StereoCalibration".
Thanks.
Generate insightful plots describing camera calibration accuracy. Here's an example: plot the graph of reprojection error vs number of images used for calibration.
Compare multiple methods (AprilTags vs Checkerboard)
any thought to removed that dependency?
Thanks.
I'm trying to use this code with kinect v2 by take one image from one camera and then from the other so i changede the C++ code read_images.cpp to only take from one soruce. But when I run the code it turns on my webcam, even thoug I have activated kinect using iai_kinect repository.
Can you help?
Instead of using checkerboards, AprilTags can also be used to calibrate a pair of stereo cameras (may often lead to a more accurate calibration result).
Find correspondences using AprilTags instead of a checkerboard. An AprilTags calibration board looks something like this
C++ code for AprilTags can be found here: http://people.csail.mit.edu/kaess/apriltags/
For every stereo pair visualize the checkboard points detected using imshow
. Ideally, this visualization should be triggered by a command-line flag argument.
We want to visualize the various checkerboard poses during stereo calibration. We want it to look something like this: http://in.mathworks.com/help/vision/examples/evaluating-the-accuracy-of-single-camera-calibration.html?requestedDomain=in.mathworks.com&requestedDomain=in.mathworks.com
Implement a user-friendly GUI taking inspiration from OCamCalib
Use Qt5 for making the GUI.
Qt5 usage reference: https://github.com/sourishg/rrt-simulator
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.