資源簡介
MATLAB單雙目標定程序(Opencv C++代碼):完成圖像獲取及標定還可以參考我的博客:http://blog.csdn.net/u011344545/article/details/78447688
以及MATLAB標定工具箱:http://download.csdn.net/download/u011344545/10104530
代碼片段和文件信息
//?cvCaptureImage.cpp?:?定義控制臺應用程序的入口點。
//
#include?“stdafx.h“
#include???
#include???????
using?namespace?std;??
using?namespace?cv;
?
int?main()??????
{??????
????int?i=0;????
????
VideoCapture?cap_left(1);
VideoCapture?cap_right(0);
if?(cap_left.isOpened()?&&?cap_right.isOpened())
cout?<“camera?is?opened“?< else
cout?<“camera?is?not?opened“?<????bool?stop?=?false;
Mat?frame;
cap_left.set(CAP_PROP_frame_WIDTH?480);
cap_left.set(CAP_PROP_frame_HEIGHT?640);
cap_right.set(CAP_PROP_frame_WIDTH?480);
cap_right.set(CAP_PROP_frame_HEIGHT?640);
VideoWriter?writer0(“two_test0.avi“VideoWriter::fourcc(‘M‘?‘J‘?‘P‘?‘G‘)30?Size(640480)true);????
????VideoWriter?writer1(“two_test1.avi“VideoWriter::fourcc(‘M‘?‘J‘?‘P‘?‘G‘)30?Size(640480)true);??
Mat?img0??img1;??????
????namedWindow(“camera_left“);??????
????namedWindow(“camera_right“);???
int?count?=?130;
while?(count)????
????{????
?????????cap_left?>>?img0;??//??
????????????????????????????????
????????if(!cap_left.read(img0))??//?讀取下一幀圖像???
?????????????????break;???
????????writer0?<????????imshow(“camera_left“?img0);???
??
?????????cap_right?>>?img1;????
????????if(!cap_right.read(img1))??//?讀取下一幀圖像???
?????????????????break;???
????????writer1?<????????imshow(“camera_right“?img1);???
????????waitKey(30);????
????????count?--;????
????}????
??
??
???//讀取獲取到的視頻,進行圖像采集??
????VideoCapture?cap00(“two_test0.avi“);???
????VideoCapture?cap11(“two_test1.avi“);???
????if(cap00.isOpened()?&&?cap11.isOpened())????
????????cout?<“ok?have?a?video“?<????else???
????????cout?<“no?video“?<??
??
????Mat?frame00?frame11;??
????int?num0?=?1?num1?=?1;??
????string?filename0;????
????char?temp_file0[100];????
????string?path0?=?“C:\\Users\\Administrator\\Desktop\\標定圖像獲取\\left\\left“;//can?change?the?path????
????for?(int?i?=?1;?i?131;?i++)????
????{????
????????cap00?>>?frame00;????
????????if(frame00.empty())????
????????????break;????
????????if(i?%?5?==?0)????
????????{????
???????????_itoa_s(num0?temp_file0?4?10);????
???????????filename0?=?temp_file0;????
???????????filename0?=?path0?+?filename0?+?“.jpg“;????
???????????num0?++;???
???????????imwrite?(filename0frame00);????
????????}????
???????}????
????cap00.release();???
??
????//重復上一步驟??
????string?filename1;????
????char?temp_file1[100];????
????string?path1?=?“C:\\Users\\Administrator\\Desktop\\標定圖像獲取\\right\\right“;//can?change?the?path????
????for?(int?i?=?1;?i?131;i++)????
????{????
????????cap11?>>?frame11;????
????????if(frame11.empty())????
????????????break;????
????????if(i?%?5?==?0)????
????????{????
???????????_itoa_s(num1?temp_file1?4?10);????
???????????filename1?=?temp_file1;????
???????????filename1?=?path1?+?filename1?+?“.jpg“;????
???????????num1?++;????
??????????imwrite?(filename1frame11);???
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3150??2017-11-03?21:24??標定圖像獲取\cvCaptureImage\cvCaptureImage.cpp
?????文件???????4921??2017-09-15?09:56??標定圖像獲取\cvCaptureImage\cvCaptureImage.vcxproj
?????文件???????1318??2017-09-15?09:21??標定圖像獲取\cvCaptureImage\cvCaptureImage.vcxproj.filters
?????文件????????143??2017-09-15?09:21??標定圖像獲取\cvCaptureImage\cvCaptureImage.vcxproj.user
?????文件???????1321??2017-09-15?09:47??標定圖像獲取\cvCaptureImage\Debug\cvCaptureImage.Build.CppClean.log
?????文件????????452??2017-09-15?09:47??標定圖像獲取\cvCaptureImage\Debug\cvCaptureImage.log
?????文件??????????0??2017-09-15?09:47??標定圖像獲取\cvCaptureImage\Debug\cvCaptureImage.unsuccessfulbuild
?????文件???????1602??2017-09-15?09:21??標定圖像獲取\cvCaptureImage\ReadMe.txt
?????文件????????219??2017-09-15?09:21??標定圖像獲取\cvCaptureImage\stdafx.cpp
?????文件????????233??2017-09-15?09:21??標定圖像獲取\cvCaptureImage\stdafx.h
?????文件????????236??2017-09-15?09:21??標定圖像獲取\cvCaptureImage\targetver.h
?????文件????2438988??2017-11-03?21:22??標定圖像獲取\cvCaptureImage\two_test0.avi
?????文件????2019254??2017-11-03?21:22??標定圖像獲取\cvCaptureImage\two_test1.avi
?????文件???????3274??2017-11-03?21:21??標定圖像獲取\cvCaptureImage\x64\Debug\cl.command.1.tlog
?????文件??????24846??2017-11-03?21:21??標定圖像獲取\cvCaptureImage\x64\Debug\CL.read.1.tlog
?????文件???????2230??2017-11-03?21:21??標定圖像獲取\cvCaptureImage\x64\Debug\CL.write.1.tlog
?????文件????????381??2017-11-03?21:21??標定圖像獲取\cvCaptureImage\x64\Debug\cvCaptureImage.exe.intermediate.manifest
?????文件?????????75??2017-11-03?21:21??標定圖像獲取\cvCaptureImage\x64\Debug\cvCaptureImage.lastbuildstate
?????文件???????2747??2017-11-03?21:21??標定圖像獲取\cvCaptureImage\x64\Debug\cvCaptureImage.log
?????文件?????242980??2017-11-03?21:21??標定圖像獲取\cvCaptureImage\x64\Debug\cvCaptureImage.obj
?????文件????1179648??2017-11-03?14:37??標定圖像獲取\cvCaptureImage\x64\Debug\cvCaptureImage.pch
?????文件????????713??2017-10-09?09:49??標定圖像獲取\cvCaptureImage\x64\Debug\cvCaptureImage.vcxprojResolveAssemblyReference.cache
?????文件??????????0??2017-10-09?09:49??標定圖像獲取\cvCaptureImage\x64\Debug\cvCaptureImage.write.1.tlog
?????文件??????????2??2017-11-03?21:21??標定圖像獲取\cvCaptureImage\x64\Debug\li
?????文件??????????2??2017-11-03?21:21??標定圖像獲取\cvCaptureImage\x64\Debug\li
?????文件???????3498??2017-11-03?21:21??標定圖像獲取\cvCaptureImage\x64\Debug\li
?????文件???????6986??2017-11-03?21:21??標定圖像獲取\cvCaptureImage\x64\Debug\li
?????文件???????1966??2017-11-03?21:21??標定圖像獲取\cvCaptureImage\x64\Debug\li
?????文件???????1106??2017-11-03?21:21??標定圖像獲取\cvCaptureImage\x64\Debug\mt.command.1.tlog
?????文件????????766??2017-11-03?21:21??標定圖像獲取\cvCaptureImage\x64\Debug\mt.read.1.tlog
............此處省略43個文件信息
評論
共有 條評論