資源簡介
基于opencv2.4.9中的立體匹配三種算法,去掉了校正圖像的步驟,可以直接使用校正好的標準圖像進行實驗,對比視差圖的效果!環境是VS2010!
代碼片段和文件信息
/*
?*??stereo_match.cpp
?*??calibration
?*
?*??Created?by?Victor??Eruhimov?on?1/18/10.
?*??Copyright?2010?Argus?Corp.?All?rights?reserved.
?*
?*/
#include?“opencv2/calib3d/calib3d.hpp“
#include?“opencv2/imgproc/imgproc.hpp“
#include?“opencv2/highgui/highgui.hpp“
#include?“opencv2/contrib/contrib.hpp“
#include?
using?namespace?cv;
static?void?print_help()
{
????printf(“\nDemo?stereo?matching?converting?L?and?R?images?into?disparity?and?point?clouds\n“);
????printf(“\nUsage:?stereo_match???[--algorithm=bm|sgbm|hh|var]?[--blocksize=]\n“
???????????“[--max-disparity=]?[--scale=scale_factor>]?[-i?]?[-e?]\n“
???????????“[--no-display]?[-o?]?[-p?]\n“);
}
static?void?saveXYZ(const?char*?filename?const?Mat&?mat)
{
????const?double?max_z?=?1.0e4;
????FILE*?fp?=?fopen(filename?“wt“);
????for(int?y?=?0;?y?????{
????????for(int?x?=?0;?x?????????{
????????????Vec3f?point?=?mat.at(y?x);
????????????if(fabs(point[2]?-?max_z)??max_z)?continue;
????????????fprintf(fp?“%f?%f?%f\n“?point[0]?point[1]?point[2]);
????????}
????}
????fclose(fp);
}
int?main(int?argc?char**?argv)
{
argc=8;
argv[0]=“ex“;
argv[1]=“view1.png“;
argv[2]=“view5.png“;
//-----------此參數可調整立體匹配算法--------------------/
argv[3]=“--algorithm=bm“;
//----------共三種算法bm,sgbm,var---------------------/
argv[4]=“-i“;
// argv[5]=“intrinsics.txt“;
argv[6]=“-e“;
// argv[7]=“extrinsics.txt“;
????const?char*?algorithm_opt?=?“--algorithm=“;
????const?char*?maxdisp_opt?=?“--max-disparity=“;
????const?char*?blocksize_opt?=?“--blocksize=“;
????const?char*?nodisplay_opt?=?“--no-display“;
????const?char*?scale_opt?=?“--scale=“;
????if(argc?3)
????{
????????print_help();
????????return?0;
????}
????const?char*?img1_filename?=?0;
????const?char*?img2_filename?=?0;
????const?char*?intrinsic_filename?=?0;
????const?char*?extrinsic_filename?=?0;
????const?char*?disparity_filename?=?0;
????const?char*?point_cloud_filename?=?0;
????enum?{?STEREO_BM=0?STEREO_SGBM=1?STEREO_HH=2?STEREO_VAR=3?};
????int?alg?=?STEREO_SGBM;
????int?SADWindowSize?=?0?numberOfDisparities?=?0;
????bool?no_display?=?false;
????float?scale?=?1.f;
????StereoBM?bm;
????StereoSGBM?sgbm;
????StereoVar?var;
????for(?int?i?=?1;?i?????{
????????if(?argv[i][0]?!=?‘-‘?)
????????{
????????????if(?!img1_filename?)
????????????????img1_filename?=?argv[i];
????????????else
????????????????img2_filename?=?argv[i];
????????}
????????else?if(?strncmp(argv[i]?algorithm_opt?strlen(algorithm_opt))?==?0?)
????????{
????????????char*?_alg?=?argv[i]?+?strlen(algorithm_opt);
????????????alg?=?strcmp(_alg?“bm“)?==?0???STEREO_BM?:
??????????????????strcmp(_alg?“sgbm“)?==?0???STEREO_SGBM?:
??????????????????strcmp(_alg?“hh“)?==
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????61952??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\Debug\stereo_match.exe
?????文件?????502568??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\Debug\stereo_match.ilk
?????文件????1305600??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\Debug\stereo_match.pdb
?????文件???54919168??2019-03-08?17:47??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\ipch\stereo_match-6b0451e3\stereo_match-132f894a.ipch
?????文件????????758??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\cl.command.1.tlog
?????文件??????15458??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\CL.read.1.tlog
?????文件????????482??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\CL.write.1.tlog
?????文件??????????2??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\li
?????文件??????????2??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\li
?????文件??????????2??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\li
?????文件??????????2??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\li
?????文件??????????2??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\li
?????文件??????????2??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\li
?????文件???????3562??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\li
?????文件???????9888??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\li
?????文件???????1014??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\li
?????文件????????452??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\mt.command.1.tlog
?????文件????????216??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\mt.read.1.tlog
?????文件????????414??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\mt.write.1.tlog
?????文件????????654??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\rc.command.1.tlog
?????文件????????386??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\rc.read.1.tlog
?????文件????????394??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\rc.write.1.tlog
?????文件???????3171??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.Build.CppClean.log
?????文件????????406??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.exe.em
?????文件????????472??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.exe.em
?????文件????????381??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.exe.intermediate.manifest
?????文件?????????74??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.lastbuildstate
?????文件???????5276??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.log
?????文件?????180542??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.obj
?????文件??????????0??2019-03-08?17:48??BM+SGBM+VAR\20190308-Testbm_match_2.4.9\stereo_match\Debug\stereo_match.write.1.tlog
............此處省略127個文件信息
- 上一篇:全國省級地市級縣市級shp圖層.zip
- 下一篇:公司員工考勤管理系統
評論
共有 條評論