多摄像头拼接

博客介绍了使用hconcat和vconcat的相关内容,还提到用capture和capture1分别捕获笔记本自带相机和外接相机的视频,并给出了hconcat和vconcat的示例,代码转载自https://www.cnblogs.com/elong1995/p/10891017.html 。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

主要用到

hconcat
vconcat

capture和capture1分别捕获笔记本自带相机和外接相机的视频
hconcat[ A, B ,C]-->\(C=[ A, B ]\)
vconcat[ A, B ,C]-->\(C=[ A, B ]^T\)

主要代码

#include "stdafx.h"
#include <opencv2/opencv.hpp>
#include <iostream>
#include <time.h>
#include<windows.h>
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;
}

转载于:https://www.cnblogs.com/elong1995/p/10891017.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值