----------------------------------------------------------------------------------------------
*******由于本部分内容太长,建议同时打开两个窗口进行阅读***********
----------------------------------------------------------------------------------------------
其实上一篇还没写完,但网上各种参考资源交杂于OpenCV1.0和OpenCV3之间,看的脑袋有点乱,个人不太喜欢先扔一大段原理,然后没有程序示意的方式;倾向于简单粗暴的直接展示的模式
想了下还是先分析书上的源码可能比较靠谱。
配置
VS2017+OpenCV3.3
配置方法参见:OpenCV3.3.0在Visual Studio 2017上的配置
本部分内容为
基本原理+书上代码
书上down下来的源代码有点错误,在调试的过程中不断更改
基本原理
回顾一下立体视觉的基本内容
代码
代码来源:书上Stereo Calibration,Rectification and Correspondence Code Example
Raw Data
包含一个读取名称流的.txt文件,以及畸变很大的左右棋盘格图像各14幅
书上的代码样例,进行一段一段的分析:
#include <opencv2/opencv.hpp>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
using namespace std;
void help(char *argv[]) {
cout
<< "\n\nExample 19-3. Stereo calibration, rectification, and "
"correspondence"
<< "\n Reads in list of locations of a sequence of checkerboard "
"calibration"
<< "\n objects from a left,right stereo camera pair. Calibrates, "
"rectifies and then"
<< "\n does stereo correspondence."
<< "\n"
<< "\n This program will run on default parameters assuming you "
"created a build directory"
<< "\n directly below the Learning-OpenCV-3 directory and are "
"running programs there. NOTE: the list_of_stereo_pairs> must"
<< "\n give the full path name to the left right images, in "
"alternating"
<< "\n lines: left image, right image, one path/filename per line, see"
<< "\n stereoData/example_19-03_list.txt file, you can comment out "
"lines"
<< "\n there by starting them with #."
<< "\n"
<< "\nDefault Call (with parameters: board_w = 9, board_h = 6, list = "
"../stereoData_19-03_list.txt):"
<< "\n" << argv[0] << "\n"
<< "\nManual call:"
<< "\n" << argv[0] << " [<board_w> <board_h> <path/list_of_stereo_pairs>]"
<< "\n\n PRESS ANY KEY TO STEP THROUGH RESULTS AT EACH