GithubHelp home page GithubHelp logo

sourishg / stereo-calibration Goto Github PK

View Code? Open in Web Editor NEW
592.0 31.0 238.0 4.31 MB

:camera: :camera: Stereo camera calibration using OpenCV and C++

Home Page: http://sourishghosh.com/2016/stereo-calibration-cpp-opencv/

CMake 3.61% C++ 87.42% Python 8.97%
camera-calibration stereo-calibration opencv

stereo-calibration's People

Contributors

cyberdrk avatar jjbut avatar sourishg avatar vwvw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stereo-calibration's Issues

Visualize checkerboard points

For every stereo pair visualize the checkboard points detected using imshow. Ideally, this visualization should be triggered by a command-line flag argument.

Any image pair for testing?

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?

calib-stereo.cpp: Use Mat for T

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;

error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'CvtHelper'

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.

How to use kinect v2 with this code?

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?

Question about vectors in calib_stereo.cpp

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,

do not use popt

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.

Documentation not clear

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.

Statistical analysis of calibration

  1. Generate insightful plots describing camera calibration accuracy. Here's an example: plot the graph of reprojection error vs number of images used for calibration.

  2. Compare multiple methods (AprilTags vs Checkerboard)

Error when using calibration

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.

Error converting BGR to GRAY

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.