Code Monkey home page Code Monkey logo

stereovision-adcensus's Introduction

StereoVision-ADCensus

This is a master student project realized at the robotics laboratory of the Westphalian University of Applied Science. With the programs in this repository you can calibrate single cameras, a stereo system, calculate disparity maps and evaluate your data. It's a all in one package for stereo vision! The software runs under windows and linux and is written in C++.

Checkout the project in action or see other nice projects: My YouTube Channel, Robalab W-HS YouTube Channel

YouTube project video

Based on the following libraries:

  • OpenCV
  • BOOST
  • libConfig
  • PCL
  • OpenMP
  • Qt 4.8.X

Projects in this package:

  • IntrinsicExtrinsicCalib
  • ImageRectify
  • ADCensusBM
  • PictureOverlay
  • OpenCVBM
  • evalDisp

IntrinsicExtrinsicCalib

With this program you can calculate the intrinsic and extrinsinc parameters of your cameras. The calibration requires several images with chessboard pattern in any size, e.g. a 8x6 (width x height) pattern. We used this 18x12 (only the inner edges count) pattern on a A0 sheet in the project. Every calibration is based on about 20 images from different views, distances and angles. It is important that the pattern is visible on every section of the camera sensor! For every single camera and calibration step (intrinsic and extrinsic) you must take these images.

Building and execution on a linux based system

Build the program:

  1. Navigate into the "IntrinsicExtrinsicCalib" folder.
  2. mkdir build
  3. cd build
  4. cmake ..
  5. make
  6. If you build the program successfully you should be able to see the "intrisic" and "extrinsic" executables.

Execute the intrinsic:

  1. Create a "intrinsicConfig.cfg" as you can see in the sample folder. (e.g.: configIntrinsicLeft.cfg, configIntrinsicRight.cfg)
  2. Create a "intrinsicImages.xml" as you can see in the sample folder. (e.g.: imagesLeftIntrinsic.xml, imagesRightIntrinsic.xml)
  3. Execute the intrisic calibration: ./intrinsic PATH_TO_YOUR_CONFIG/intrinsicConfig.cfg
  4. This can take several minutes. Check your calibration result in your destination folder!

Execute the extrinsic:

  1. Create a "extrinsicConfig.cfg" as you can see in the sample folder. (e.g.: configExtrinsic.cfg)
  2. Create a "extrinsicImages.xml" as you can see in the sample folder. (e.g.: imagesExtrinsic.xml)
  3. Execute the extrinsic calibration: ./extrinsic PATH_TO_YOUR_CONFIG/extrinsicConfig.cfg
  4. This can take several minutes. Check your calibration result in your destination folder!
  5. Check the translation vector in the resulting 4x4 matrix. This should match the distance between the cameras in the selected measuring unit.

ImageRectify

With this program you can easy rectify new images which are taken with a calibrated stereo camera system. You need the intrinsic calibration from each camera and the extrinsic calibration for the stereo system. All the calibrations can be estimated with "IntrinsicExtrinsicCalib".

Building and execution on a linux based system

Build the program:

  1. Navigate into the "ImageRectify" folder.
  2. mkdir build
  3. cd build
  4. cmake ..
  5. make
  6. If you build the program successfully you should be able to see the "ImageRectify" executable.

Execute the image rectification:

  1. Create a "config.cfg" as you can see in the sample folder.
  2. Create a "images.xml" as you can see in the sample folder.
  3. Execute the image rectification: ./ImageRectify PATH_TO_YOUR_CONFIG/config.cfg

ADCensusBM

This program creates the disparity map for a given rectified image set with the use of the ADCensus algorithm. You can find the paper in the "Documents" section or here. The current implementation doesn't use your graphics card for parallelization, for what the algorithm is designed for, but rather it makes use of OpenMP. By using the OpenCV it should be easy to make a port to the graphics card.

If you have an extrinsic calibration file for your images the program creates a point cloud. Otherwise create an empty extrinsic file and change the specific parameter in the config as you can see in the sample folder. Only the depth maps will be created if no extrinsic exists. In any case, the input images must be rectified!

You can see the results and evalution of the algorithm here: http://vision.middlebury.edu/stereo/eval/

Build the program:

  1. Navigate into the "ADCensusBM" folder.
  2. mkdir build
  3. cd build
  4. cmake ..
  5. make
  6. If you build the program successfully you should be able to see the "ADCensusBM" executable.

Execute the image rectification:

  1. Copy and edit the "config.cfg" from the sample folder. The values in the "config.cfg" are for the middleburry image set. The values also work with other images but specific values for your own dataset can improve the quallity.
  2. Create a "images.xml" as you can see in the sample folder.
  3. Execute the image rectification: ./ADCensusBM PATH_TO_YOUR_CONFIG/config.cfg

PictureOverlay

It's a small tool to check the accuracy of your calibrations and the disparities in the scene. The program simply overlays 2 corresponding images from the left and right camera and display them. Afterwards you can move one image (the first one) and check if objects layes on the same epipolar lines. Further you can check the disparity between the objects.

Build the program:

  1. Navigate into the "PictureOverlay" folder
  2. mkdir build
  3. cd build
  4. cmake ..
  5. make
  6. If you build the program successfully you should be able to see the "PictureOverlay" executable

Execute PictureOverlay:

  1. ./PictureOverlay PATH_TO_YOUR_IMAGE/image1.jpg PATH_TO_YOUR_IMAGE/image2.jpg alpha1 alpha2 scale
  • alpha1: The alpha value for the first image. The value must be between 0 - 1. (e.g.: 0.5)
  • alpha2: The alpha value for the second image. The value must be between 0 - 1. (e.g.: 0.5)
  • scale: You can reduce the size with this parameter, if you have images bigger than your screen resolution. The value must be between 0 and 1. If you don't want to reduce the size, set the value to 1.
  • With the "A" and "D" keys you can move the first image left and right.
  • With the "W" and "S" keys you can move the first image up and down.

OpenCVBM

It's a small programm to compare the results from the ADCensus with the builtin block matching methods by the OpenCV, Block-Matching (BM) and Semi-Global Bock-Matching (SGBM). As the input, the programm needs 2 rectified images from a stereo camera system. You're be able to adjust all free parameters for each algorithm and see immediately the results. You have the option to switch the whole time between the 2 algorithms , to compare them.

Build the program:

  1. Navigate into the "OpenCVBM" folder
  2. mkdir build
  3. cd build
  4. cmake ..
  5. make
  6. If you build the program successfully you should be able to see the "OpenCVBM" executable

Execute OpenCVBM:

  1. ./OpenCVBM PATH_TO_YOUR_IMAGE/image1.jpg PATH_TO_YOUR_IMAGE/image2.jpg scale
  • scale: You can reduce the size with this parameter, if you have images bigger than your screen resolution. The value must be between 0 and 1. If you don't want to reduce the size, set the value to 1.

evalDisp

With this programm you can evaluate each pixel and see the disparity and the calculated distance for this. All you need are the rectified images, the calculated disparity images and the camera extrinsic.

Writing a config file:

Before you can use the programm you need a config. A sample config is under the "evalDisp/sample"!

Parameter:

  • cameraName: Name for the camera
  • extrinsicFile: Is a file that would be created with "IntrinsicExtrinsicCalib"
  • imagesXML: Is a OpenCV XML-File that contains the pathes to the images
  • You need only 1 image from your camera (left or right camera)!
  • dispsXML: Is a OpenCV XML-File that contains the pathes to the disparity maps
  • Attention: You need the .yml disparity maps, which are created by the ADCensus! The disparity map must be the corresspondig file to the image at the imagesXML! See the samples in the project!
  • scaleFactor: You can reduce the size with this parameter, if you have images bigger than your screen resolution. The value must be between 0 and 1. If you don't want to reduce the size, set the value to 1.

Sample config 1 camera:

cameras =(  
            {
                cameraName="Sample_Camera";
                extrinsicFile="PATH_TO_THE_CALCULATED_CAMERA_EXTRINSIC_FILE/CAMERA_EXTRINSIC_FILE.yml";
				imagesXML="PATH_TO_THE_IMAGE_CONFIG/IMAGE.xml";
                dispsXML="PATH_TO_THE_DISPARITY_MAPS/DISPARITY_MAPS.xml";
                scaleFactor=0.5;
            }
    };

Sample config for a couple of cameras:

cameras =(  
            {
                cameraName="Sample_Camera_1";
                extrinsicFile="PATH_TO_THE_CALCULATED_CAMERA_EXTRINSIC_FILE/CAMERA1_EXTRINSIC_FILE.yml";
				imagesXML="PATH_TO_THE_IMAGE_CONFIG/IMAGE1.xml";
                dispsXML="PATH_TO_THE_DISPARITY_MAPS/DISPARITY1_MAPS.xml";
                scaleFactor=0.5;
            },
            {
                cameraName="Sample_Camera_2";
                extrinsicFile="PATH_TO_THE_CALCULATED_CAMERA_EXTRINSIC_FILE/CAMERA2_EXTRINSIC_FILE.yml";
				imagesXML="PATH_TO_THE_IMAGE_CONFIG/IMAGE2.xml";
                dispsXML="PATH_TO_THE_DISPARITY_MAPS/DISPARITY2_MAPS.xml";
                scaleFactor=0.5;
            }
    };

Build the program:

  1. Navigate into the "evalDisp" folder
  2. mkdir build
  3. cd build
  4. cmake ..
  5. make
  6. If you build the program successfully you should be able to see the "evalDisp" executable

Execute evalDisp:

  1. ./evalDisp PATH_TO_YOUR_CONFIG/YOUR_CONFIG.jpg
  • With the "A" and "D" keys you can move the cross left and right.
  • With the "W" and "S" keys you can move the cross up and down.
  • With "C" you can toggle between the disparity and the color image.
  • With "B" and "N" you can go to the previous / next image on your list.
  • With "H" and "J" you can go to the previous / next camera if exists.
  • With "Q" or "ESC" you can quit the program.

stereovision-adcensus's People

Contributors

algomorph avatar berak avatar dluensch 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

stereovision-adcensus's Issues

make ImageRectify

Hello, I can't make "ImageRectify" what's the issue - I very appreciate your help. Thanks.

pb@pb:/work/StereoVision-ADCensus-master/ImageRectify/bin$ cmake ..
-- Boost version: 1.54.0
-- Found the following Boost libraries:
-- filesystem
-- system
-- Found Config++: /usr/lib/x86_64-linux-gnu/libconfig++.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/r59400/work/StereoVision-ADCensus-master/ImageRectify/bin
pb@pb:
/work/StereoVision-ADCensus-master/ImageRectify/bin$ make
Linking CXX executable ImageRectify
CMakeFiles/ImageRectify.dir/src/main.cpp.o: In function main': /home/pb/work/StereoVision-ADCensus-master/ImageRectify/src/main.cpp:151: undefined reference tocv::imwrite(cv::String const&, cv::InputArray const&, std::vector<int, std::allocator > const&)'
CMakeFiles/ImageRectify.dir/src/main.cpp.o: In function ~String': /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference tocv::String::deallocate()'
CMakeFiles/ImageRectify.dir/src/main.cpp.o: In function String': /usr/local/include/opencv2/core/cvstd.inl.hpp:81: undefined reference tocv::String::allocate(unsigned long)'
CMakeFiles/ImageRectify.dir/src/main.cpp.o: In function ~String': /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference tocv::String::deallocate()'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function String': /usr/local/include/opencv2/core/cvstd.inl.hpp:81: undefined reference tocv::String::allocate(unsigned long)'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function intrinsicExtrinsic::loadImages(std::vector<std::string, std::allocator<std::string> >, std::vector<cv::Mat, std::allocator<cv::Mat> >&)': /home/pb/work/StereoVision-ADCensus-master/ImageRectify/src/rectify.cpp:218: undefined reference tocv::imread(cv::String const&, int)'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function ~String': /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference tocv::String::deallocate()'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function intrinsicExtrinsic::loadImages(std::vector<std::string, std::allocator<std::string> >, std::vector<cv::Mat, std::allocator<cv::Mat> >&)': /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference tocv::String::deallocate()'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function String': /usr/local/include/opencv2/core/cvstd.hpp:625: undefined reference tocv::String::allocate(unsigned long)'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function intrinsicExtrinsic::loadStereoExtrinsics(std::string, cv::Mat&, cv::Mat&, cv::Mat&, cv::Mat&, cv::Rect_<int>&)': /home/pb/work/StereoVision-ADCensus-master/ImageRectify/src/rectify.cpp:134: undefined reference to cv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In functionintrinsicExtrinsic::loadStereoExtrinsics(std::string, cv::Mat&, cv::Mat&, cv::Mat&, cv::Mat&, cv::Rect_<int>&)': /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference to cv::String::deallocate()'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function~String': /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference to cv::String::deallocate()'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In functionString': /usr/local/include/opencv2/core/cvstd.hpp:625: undefined reference to cv::String::allocate(unsigned long)'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In functioncv::internal::VecReaderProxy<int, 1>::operator()(std::vector<int, std::allocator<int> >&, unsigned long) const': /usr/local/include/opencv2/core/persistence.hpp:812: undefined reference to cv::FileNodeIterator::readRaw(cv::String const&, unsigned char*, unsigned long)'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function~String': /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference to cv::String::deallocate()'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In functionString': /usr/local/include/opencv2/core/cvstd.hpp:625: undefined reference to cv::String::allocate(unsigned long)'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In functioncv::internal::VecReaderProxy<int, 1>::operator()(std::vector<int, std::allocator<int> >&, unsigned long) const': /usr/local/include/opencv2/core/persistence.hpp:812: undefined reference to cv::FileNodeIterator::readRaw(cv::String const&, unsigned char*, unsigned long)'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function~String': /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference to cv::String::deallocate()'
/usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference tocv::String::deallocate()' CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function intrinsicExtrinsic::loadStereoExtrinsics(std::string, cv::Mat&, cv::Mat&, cv::Mat&, cv::Mat&, cv::Rect
&)':
/usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference tocv::String::deallocate()' CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function ~String':
/usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference tocv::String::deallocate()' CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function intrinsicExtrinsic::loadStereoExtrinsics(std::string, cv::Mat&, cv::Mat&, cv::Mat&, cv::Mat&, cv::Rect_&)':
/usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference tocv::String::deallocate()' CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function String':
/usr/local/include/opencv2/core/cvstd.hpp:625: undefined reference tocv::String::allocate(unsigned long)' CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function intrinsicExtrinsic::loadStereoIntrinsics(std::string&, std::string&, cv::Mat&, cv::Mat&, cv::Mat&, cv::Mat&)':
/home/pb/work/StereoVision-ADCensus-master/ImageRectify/src/rectify.cpp:170: undefined reference tocv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)' CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function intrinsicExtrinsic::loadStereoIntrinsics(std::string&, std::string&, cv::Mat&, cv::Mat&, cv::Mat&, cv::Mat&)':
/usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference tocv::String::deallocate()' CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function ~String':
/usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference tocv::String::deallocate()' CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function String':
/usr/local/include/opencv2/core/cvstd.hpp:625: undefined reference tocv::String::allocate(unsigned long)' CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function intrinsicExtrinsic::loadStereoIntrinsics(std::string&, std::string&, cv::Mat&, cv::Mat&, cv::Mat&, cv::Mat&)':
/home/pb/work/StereoVision-ADCensus-master/ImageRectify/src/rectify.cpp:171: undefined reference tocv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)' CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function intrinsicExtrinsic::loadStereoIntrinsics(std::string&, std::string&, cv::Mat&, cv::Mat&, cv::Mat&, cv::Mat&)':
/usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference tocv::String::deallocate()' CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function ~String':
/usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference tocv::String::deallocate()' CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function intrinsicExtrinsic::loadStereoIntrinsics(std::string&, std::string&, cv::Mat&, cv::Mat&, cv::Mat&, cv::Mat&)':
/usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference tocv::String::deallocate()' /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference to cv::String::deallocate()'
/usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference tocv::String::deallocate()' CMakeFiles/ImageRectify.dir/src/rectify.cpp.o:/usr/local/include/opencv2/core/cvstd.hpp:667: more undefined references to cv::String::deallocate()' follow
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In functionintrinsicExtrinsic::loadImageList(std::string, std::vector<std::string, std::allocator<std::string> >&)': /home/pb/work/StereoVision-ADCensus-master/ImageRectify/src/rectify.cpp:193: undefined reference to cv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In functionintrinsicExtrinsic::loadImageList(std::string, std::vector<std::string, std::allocator<std::string> >&)': /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference to cv::String::deallocate()'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function~String': /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference to cv::String::deallocate()'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In functionintrinsicExtrinsic::loadImageList(std::string, std::vector<std::string, std::allocator<std::string> >&)': /home/pb/work/StereoVision-ADCensus-master/ImageRectify/src/rectify.cpp:199: undefined reference to cv::FileNode::type() const'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In functionString': /usr/local/include/opencv2/core/cvstd.inl.hpp:81: undefined reference to cv::String::allocate(unsigned long)'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In functioncv::FileNode::operator std::string() const': /usr/local/include/opencv2/core/cvstd.inl.hpp:147: undefined reference to cv::read(cv::FileNode const&, cv::String&, cv::String const&)'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function~String': /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference to cv::String::deallocate()'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In functionintrinsicExtrinsic::loadImageList(std::string, std::vector<std::string, std::allocator<std::string> >&)': /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference to cv::String::deallocate()'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In function~String': /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference to cv::String::deallocate()'
CMakeFiles/ImageRectify.dir/src/rectify.cpp.o: In functionintrinsicExtrinsic::loadImageList(std::string, std::vector<std::string, std::allocator<std::string> >&)': /usr/local/include/opencv2/core/cvstd.hpp:667: undefined reference to cv::String::deallocate()'
collect2: error: ld returned 1 exit status
make[2]: *** [ImageRectify] Error 1
make[1]: *** [CMakeFiles/ImageRectify.dir/all] Error 2
make: *** [all] Error 2

The question of census cost calculation

I am confused about the census cost calulation as following :
for(int h = -censusWin.height / 2; h <= censusWin.height / 2; ++h) { for(int w = -censusWin.width / 2; w <= censusWin.width / 2; ++w) { const Vec3b &colorLP = leftImage.at<Vec3b>(**hL + h, wL + w**); const Vec3b &colorRP = rightImage.at<Vec3b>(**hR + h, wR + w**); for(uchar color = 0; color < 3; ++color) { // bool diff = (colorLP[color] < colorRefL[color]) ^ (colorRP[color] < colorRefR[color]); bool diff = (colorLP[color] - colorRefL[color]) * (colorRP[color] - colorRefR[color]) < 0; dist += (diff)? 1: 0; } } }
the bold parts, 'hL + h, wL + w' and ‘hR + h, wR + w’ could beyond the scope of the image. Anybody found this?

What can I change if I want to make progress about the "ADCensusBM"prgram?

hello sir.I am doing some research and I am interested in your ADCensusBM program.now I have made the disp image by your program like this:
result
what I want to ask is that if I want to make a better result on the bottom of the program ,which part of the code should I try to change?
should I change the matrix here:
matrix1
or here:
matrix2
or the input in main.cpp:
main_matrix
or neither of the above.should I make some change in the algorithm in any of the .cpp? thank you very much.

make IntrinsicExtrinsicCalib/build$

can't make IntrinsicExtrinsicCalib - what's getting wrong? I would appreciate your help. Thanks.

pb@pb:/work/StereoVision-ADCensus-master/IntrinsicExtrinsicCalib/build$ cmake ..
OPENMP FOUND
-- Boost version: 1.54.0
-- Found the following Boost libraries:
-- filesystem
-- system
-- Found Config++: /usr/lib/x86_64-linux-gnu/libconfig++.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pb/work/StereoVision-ADCensus-master/IntrinsicExtrinsicCalib/build
pb@pb:
/work/StereoVision-ADCensus-master/IntrinsicExtrinsicCalib/build$ make
Linking CXX executable extrinsic
CMakeFiles/extrinsic.dir/extrinsic.cpp.o: In function cv::operator<<(cv::FileStorage&, char const*)': extrinsic.cpp:(.text+0x59): undefined reference tocv::operator<<(cv::FileStorage&, cv::String const&)'
CMakeFiles/extrinsic.dir/extrinsic.cpp.o: In function main': extrinsic.cpp:(.text+0xf51): undefined reference tocv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)'
extrinsic.cpp:(.text+0x17aa): undefined reference to cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)' CMakeFiles/extrinsic.dir/extrinsic.cpp.o: In functioncv::FileStorage& cv::operator<< cv::Mat(cv::FileStorage&, cv::Mat const&)':
extrinsic.cpp:(.text+0x21ab): undefined reference to cv::error(int, cv::String const&, char const*, char const*, int)' extrinsic.cpp:(.text+0x21d2): undefined reference tocv::write(cv::FileStorage&, cv::String const&, cv::Mat const&)'
CMakeFiles/extrinsic.dir/extrinsic.cpp.o: In function cv::FileStorage& cv::operator<< <cv::Rect_<int> >(cv::FileStorage&, cv::Rect_<int> const&)': extrinsic.cpp:(.text+0x2288): undefined reference tocv::error(int, cv::String const&, char const_, char const_, int)'
CMakeFiles/extrinsic.dir/extrinsic.cpp.o: In function void cv::write<int>(cv::FileStorage&, cv::String const&, cv::Rect_<int> const&)': extrinsic.cpp:(.text+0x2330): undefined reference tocv::internal::WriteStructContext::WriteStructContext(cv::FileStorage&, cv::String const&, int, cv::String const&)'
extrinsic.cpp:(.text+0x235b): undefined reference to cv::internal::WriteStructContext::~WriteStructContext()' extrinsic.cpp:(.text+0x2386): undefined reference tocv::internal::WriteStructContext::~WriteStructContext()'
extrinsic.cpp:(.text+0x23a0): undefined reference to cv::internal::WriteStructContext::~WriteStructContext()' CMakeFiles/extrinsic.dir/extrinsic.cpp.o: In functioncv::String::String(char const_)':
extrinsic.cpp:(.text.ZN2cv6StringC2EPKc[ZN2cv6StringC5EPKc]+0x4f): undefined reference to cv::String::allocate(unsigned long)' CMakeFiles/extrinsic.dir/extrinsic.cpp.o: In functioncv::String::~String()':
extrinsic.cpp:(.text.ZN2cv6StringD2Ev[ZN2cv6StringD5Ev]+0x14): undefined reference to cv::String::deallocate()' CMakeFiles/extrinsic.dir/extrinsic.cpp.o: In functioncv::String::String(std::string const&)':
extrinsic.cpp:(.text.ZN2cv6StringC2ERKSs[ZN2cv6StringC5ERKSs]+0x69): undefined reference to cv::String::allocate(unsigned long)' CMakeFiles/extrinsic.dir/intrinsicextrinsiccalib.cpp.o: In functionIntrinsicExtrinsicCalib::loadStereoIntrinsics(std::string&, std::string&, cv::Mat&, cv::Mat&, cv::Mat&, cv::Mat&)':
intrinsicextrinsiccalib.cpp:(.text+0xeb5): undefined reference to cv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)' intrinsicextrinsiccalib.cpp:(.text+0xf25): undefined reference tocv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)'
CMakeFiles/extrinsic.dir/intrinsicextrinsiccalib.cpp.o: In function IntrinsicExtrinsicCalib::loadImageList(std::string, std::vector<std::string, std::allocator<std::string> >&)': intrinsicextrinsiccalib.cpp:(.text+0x11ac): undefined reference tocv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)'
intrinsicextrinsiccalib.cpp:(.text+0x1222): undefined reference to cv::FileNode::type() const' CMakeFiles/extrinsic.dir/intrinsicextrinsiccalib.cpp.o: In functionIntrinsicExtrinsicCalib::loadImages(std::vector<std::string, std::allocatorstd::string >, std::vector<cv::Mat, std::allocatorcv::Mat >&)':
intrinsicextrinsiccalib.cpp:(.text+0x1415): undefined reference to cv::imread(cv::String const&, int)' CMakeFiles/extrinsic.dir/intrinsicextrinsiccalib.cpp.o: In functionIntrinsicExtrinsicCalib::calculateIntrinsic(cv::Size
, cv::Size
, cv::Mat&, cv::Mat&, std::vectorstd::vector<cv::Point
<float, std::allocatorcv::Point
>, std::allocatorstd::vector<cv::Point<float, std::allocatorcv::Point > > >, std::vector<cv::Mat, std::allocatorcv::Mat >&, std::vector<cv::Mat, std::allocatorcv::Mat >&, std::vector<float, std::allocator >&, double&, int)':
intrinsicextrinsiccalib.cpp:(.text+0x3b78): undefined reference to cv::calibrateCamera(cv::_InputArray const&, cv::_InputArray const&, cv::Size_<int>, cv::_InputOutputArray const&, cv::_InputOutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, int, cv::TermCriteria)' CMakeFiles/extrinsic.dir/intrinsicextrinsiccalib.cpp.o: In functionIntrinsicExtrinsicCalib::findCornersStereo(cv::Size_, cv::Size_, std::vector<cv::Mat, std::allocatorcv::Mat >&, std::vectorstd::vector<cv::Point_<float, std::allocatorcv::Point_ >, std::allocatorstd::vector<cv::Point_<float, std::allocatorcv::Point_ > > >&, std::vectorstd::vector<cv::Point_<float, std::allocatorcv::Point_ >, std::allocatorstd::vector<cv::Point_<float, std::allocatorcv::Point_ > > >&) [clone ._omp_fn.0]':
intrinsicextrinsiccalib.cpp:(.text+0x52d0): undefined reference to cv::cornerSubPix(cv::_InputArray const&, cv::_InputOutputArray const&, cv::Size_<int>, cv::Size_<int>, cv::TermCriteria)' intrinsicextrinsiccalib.cpp:(.text+0x53c6): undefined reference to cv::cornerSubPix(cv::InputArray const&, cv::InputOutputArray const&, cv::Size, cv::Size, cv::TermCriteria)'
CMakeFiles/extrinsic.dir/intrinsicextrinsiccalib.cpp.o: In functionIntrinsicExtrinsicCalib::findCornersMono(cv::Size_<int>, cv::Size_<int>, std::vector<cv::Mat, std::allocator<cv::Mat> >&, std::vectorstd::vector<cv::Point_<float, std::allocatorcv::Point_<float > >, std::allocatorstd::vector<cv::Point_<float, std::allocatorcv::Point_<float > > > >&) [clone ._omp_fn.1]': intrinsicextrinsiccalib.cpp:(.text+0x58ad): undefined reference to cv::cornerSubPix(cv::InputArray const&, cv::InputOutputArray const&, cv::Size, cv::Size, cv::TermCriteria)'
CMakeFiles/extrinsic.dir/intrinsicextrinsiccalib.cpp.o: In function cv::Mat::Mat(int, int, int, void_, unsigned long)': intrinsicextrinsiccalib.cpp:(.text._ZN2cv3MatC2EiiiPvm[_ZN2cv3MatC5EiiiPvm]+0x121): undefined reference to cv::error(int, cv::String const&, char const*, char const*, int)'
intrinsicextrinsiccalib.cpp:(.text._ZN2cv3MatC2EiiiPvm[_ZN2cv3MatC5EiiiPvm]+0x228): undefined reference tocv::error(int, cv::String const&, char const_, char const_, int)' CMakeFiles/extrinsic.dir/intrinsicextrinsiccalib.cpp.o: In function cv::FileNode::operator std::string() const':
intrinsicextrinsiccalib.cpp:(.text._ZNK2cv8FileNodecvSsEv[_ZNK2cv8FileNodecvSsEv]+0x30): undefined reference to`cv::read(cv::FileNode const&, cv::String&, cv::String const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [extrinsic] Error 1
make[1]: *** [CMakeFiles/extrinsic.dir/all] Error 2
make: *** [all] Error 2

use OpenCVBM

did build OpenCVBM and trying to execute. I took left/right images from http://vision.middlebury.edu/stereo dataset (e.g. Quarter resolution of Australia, Motorcycle, etc..)

And mostly happens this:
original images:
pb@pb:~/work/StereoVision-ADCensus/OpenCVBM/build$ ./OpenCVBM im0.png im1.png 1
*** Error in `./OpenCVBM': double free or corruption (!prev): 0x0000000000957140 ***
Aborted (core dumped)

converted to jpg
pb@pb:~/work/StereoVision-ADCensus/OpenCVBM/build$ ./OpenCVBM image1.jpg image2.jpg 1
*** Error in `./OpenCVBM': double free or corruption (!prev): 0x00007f17fc000ae0 ***
Aborted (core dumped)

Truly speaking I was able to get it running with e.g. plants, Staircase to get disparity.
Any idea what's happening?
Thank you!

ADCensusBM with ../sample/config.cfg

Hello,

I'm trying to run ADCensusBM with sample included and getting this

pb@pb:~/work/StereoVision-ADCensus/ADCensusBM/build$ ./ADCensusBM ../sample/config.cfg
OpenCV Error: Parsing error (../sample/extrinsics.yml(0): Valid XML should start with '') in icvXMLParse, file /build/buildd/opencv-2.4.8+dfsg1/modules/core/src/persistence.cpp, line 2252
[ADCensusCV] Could not read image list!

Handling missing data

Rectifying a pair of images usually rotates them somewhat, which result in images with bigger width and height, and regions where no data is present, typically around corners. It is not clear if these algorithms can handle that. Any clarification would be appreciated. Thank you.

evalDisp can not work

camera =
{
{
cameraName="Sample_Camera_1";
extrinsicFile="/home/syc/StereoVision-ADCensus-master/evalDisp/sample/data/camera1/camera1_extrinsic.yml";
imagesXML="/home/syc/StereoVision-ADCensus-master/evalDisp/sample/data/camera1/camera1_images.xml";
dispsXML="/home/syc/StereoVision-ADCensus-master/evalDisp/sample/data/camera1/camera1_disps.xml";
scaleFactor=0.5;
},
{
cameraName="Sample_Camera_2";
extrinsicFile="/home/syc/StereoVision-ADCensus-master/evalDisp/sample/data/camera2/camera2_extrinsic.yml";
imagesXML="/home/syc/StereoVision-ADCensus-master/evalDisp/sample/data/camera2/camera2_images.xml";
dispsXML="/home/syc/StereoVision-ADCensus-master/evalDisp/sample/data/camera2/camera2_disps.xml";
scaleFactor=0.5;
},
};
Are these two extrinsicFiles the same between camera_1 and camera_2?
which the disps choose?
it shows that [evalDisp] Parsing error in config file.

sgblockmatching.cpp

pb@pb:~/work/StereoVision-ADCensus/OpenCVBM/build$ make
[ 6%] Generating ui_blockmatchingimage.h
[ 13%] Generating src/moc_OpenCVBMWindow.cxx
[ 20%] Generating src/moc_blockmatchingimage.cxx
[ 26%] Generating src/moc_blockmatching.cxx
/home/r59400/work/StereoVision-ADCensus/OpenCVBM/src/blockmatching.h:0: Note: No relevant classes found. No output generated.
[ 33%] Generating src/moc_sgblockmatching.cxx
/home/r59400/work/StereoVision-ADCensus/OpenCVBM/src/sgblockmatching.h:0: Note: No relevant classes found. No output generated.
[ 40%] Generating ui_OpenCVBMWindow.h
Scanning dependencies of target OpenCVBM
[ 46%] Building CXX object CMakeFiles/OpenCVBM.dir/src/main.cpp.o
[ 53%] Building CXX object CMakeFiles/OpenCVBM.dir/src/OpenCVBMWindow.cpp.o
[ 60%] Building CXX object CMakeFiles/OpenCVBM.dir/src/blockmatchingimage.cpp.o
[ 66%] Building CXX object CMakeFiles/OpenCVBM.dir/src/blockmatching.cpp.o
[ 73%] Building CXX object CMakeFiles/OpenCVBM.dir/src/sgblockmatching.cpp.o
/home/r59400/work/StereoVision-ADCensus/OpenCVBM/src/sgblockmatching.cpp: In member function ‘cv::Mat SGBlockMatching::updateSGBM()’:
/home/r59400/work/StereoVision-ADCensus/OpenCVBM/src/sgblockmatching.cpp:151:15: error: base operand of ‘->’ has non-pointer type ‘cv::StereoSGBM’
this->sgbm->compute(this->imageLeft, this->imageRight, res);
^
make[2]: *** [CMakeFiles/OpenCVBM.dir/src/sgblockmatching.cpp.o] Error 1
make[1]: *** [CMakeFiles/OpenCVBM.dir/all] Error 2
make: *** [all] Error 2

Sample images

Could you please post sample stereo images prior to distortion correction that use the calibration in the existing reference files so I can verify if it is working?
It would also be cool to post the calibration images to test out that calibration is working as well.

the calculate of P1, P2

In the ScanlineOptimization::computeP1P2 function, I have a double of the following:
d2 = colorDiff(images[otherImgNo].at<Vec3b>(height1, width1 + disparity), images[otherImgNo].at<Vec3b>(height2, width2 + disparity));. My question is when the target image is left image, the d2 represents the right image's color difference of two pixels, which have disparity to left corresponding pixels . And I think the horizontal coordinate value should be 'width1 - disparity' and 'width2 - disparity' rather than 'width1 + disparity' or ‘width2 + dispairity’.

Another question is the origianl paper assigns the pi1 and pi2's value of 1.0 and 3.0, but this codes assign 0.1 and 0.3, I can't think of reason.

Links to publications

Hello, currently I am working on my masters thesis related to Visual SLAM.
Do you have any publications related to your project? It would be great if your thesis is publicly available (and in english). However, any publication would be good too, so I can reference to it in my work. Thanks for attention!

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.