VideoCapture capleft(0);
VideoCapture capright(1);
//int width=640, height = 480;
Mat frameLeft,frameRight,both;
both= Mat(1080,1920,CV_MAKETYPE(8,3),CV_RGB(255,255,255));
if(!capleft.isOpened() || !capright.isOpened())
{
cout<<"Please check your connection!"<<endl;
system ("pause");
return -1;
}
while(true)
{
capleft>>frameLeft;
capright>>frameRight;
if(frameLeft.data==NULL|| frameRight.data==NULL)
break;
frameLeft.copyTo(Mat(both,Rect(50,50,960,1080)));
frameRight.copyTo(Mat(both,Rect(693,50,960,1080)));
imshow("images", both);
waitKey(30);
switch(waitKey(30))
{
case 27:
return 0;
}
}
return 0;
我試圖將分辨率調整爲1080,960左,右1080,960。
Unhandled exception at at 0x7781D8A8 in Playing_images2.exe: Microsoft C++ exception: cv::Exception at memory location 0x0017F628.
我會很感激,如果有人能指導我:如果我改變
frameLeft.copyTo(Mat(both,Rect(50,50,960,1080))); // 960->640 and 1080->480
frameRight.copyTo(Mat(both,Rect(693,50,960,1080)));
否則,我得到的錯誤此代碼的工作。
什麼錯誤? –
請正確編輯您的代碼,並添加錯誤 – Miki
並且您在哪裏更改值以更改分辨率? – agold