多摄像头拼接

主要用到

hconcat
vconcat

主要代码
  

#include "stdafx.h"
#include 
   
   
    
    
#include 
    
    
     
     
#include 
     
     
      
      
#include
      
      
       
       
using namespace cv;
using namespace std;

Mat frame;
Mat frame1;
Mat b;
Mat b1;
 Mat roi_img_left;
 Mat roi_img_right;
 Mat roi_img_left1;
 Mat roi_img_right1;
char fileNameBmpLeft[64];
char fileNameBmpRight[64];
int calibStep = 1;
int ret = 0;

int main()
{
    VideoCapture capture(0);

    VideoCapture capture1(1);

    while (1)
    {
        capture1 >> frame1;
        capture >> frame;
        imshow("d", frame);
        imshow("d1", frame1);
        cout << frame1.size << endl;

        roi_img_left = frame(Range(0, 480),  Range(0, 320));
        roi_img_right = frame(Range(0, 480),  Range(320, 640));
        
        roi_img_left1 = frame1( Range(0, 480),  Range(0, 320));
        roi_img_right1 = frame1( Range(0, 480),  Range(320, 640));

        Mat combine, combine1, combine2;

        hconcat(roi_img_left, roi_img_right1, combine1);
        hconcat(roi_img_left1, roi_img_right, combine2);
        vconcat(combine1, combine2, combine);

        imshow("【display】", combine);
        waitKey(30);
    }

    capture.release();
    system("pause");
    return 0;
}


      
      
     
     
    
    
   
   

猜你喜欢

转载自www.cnblogs.com/elong1995/p/10891017.html