当前位置:网站首页>Opencv based real-time stitching of simple dual camera images
Opencv based real-time stitching of simple dual camera images
2022-07-28 17:28:00 【Dashan classmate】
#include"opencv2/opencv.hpp"
using namespace cv;
The number of rows is equal Peer splicing
Mat comMatR(Mat Matrix1,Mat Matrix2,Mat &MatrixCom)
{
CV_Assert(Matrix1.rows==Matrix2.rows);// The number of rows is not equal , An error interrupt occurred
MatrixCom.create(Matrix1.rows,Matrix1.cols+Matrix2.cols,Matrix1.type());
Mat temp=MatrixCom.colRange(0,Matrix1.cols);
Matrix1.copyTo(temp);
Mat temp1=MatrixCom.colRange(Matrix1.cols,Matrix1.cols+Matrix2.cols);
Matrix2.copyTo(temp1);
return MatrixCom;
}
The number of columns is equal Same column splicing
Mat comMatC(Mat Matrix1,Mat Matrix2,Mat &MatrixCom)
{
CV_Assert(Matrix1.cols==Matrix2.cols);// The number of columns is not equal , An error interrupt occurred
MatrixCom.create(Matrix1.rows+Matrix2.rows,Matrix1.cols,Matrix1.type());
Mat temp=MatrixCom.rowRange(0,Matrix1.rows);
Matrix1.copyTo(temp);
Mat temp1=MatrixCom.rowRange(Matrix1.rows,Matrix1.rows+Matrix2.rows);
Matrix2.copyTo(temp1);
return MatrixCom;
}
int main()
{
VideoCapture capture1(0); // call 1 Camera number
VideoCapture capture2(1); // call 2 Camera number
while(1)
{
Mat frame1,frame2; // Definition Mat Variable frame1 frame2
Mat combine; // Definition Mat Variable combine After the combination of Mat
capture1>>frame1; // Get images 1
capture2>>frame2; // Get images 2
comMatR(frame1,frame2,combine); // Start splicing
imshow(" video 1",combine);// Display the stitched image
waitKey(30);// Time delay 30MS
}
}
Learn from the following blog
opencv Image mosaic , That is, combine the two matrices into one (vconcat and hconcat)、Mat Member functions size()_mikedadong The blog of -CSDN Blog _cv::mat vconcat A little rookie , Don't laugh, big guys .
边栏推荐
- [Presto] details of the new version upgrade of Presto
- 【atlas】atlas 编译报错整理(全)
- How to protect image security during construction
- C# 导入Excel文件数据的几种方法
- 格雷码和二进制的转换及典型例题(4bits格雷码计数器)
- Code implementation additive attention
- Shell脚本之免交互操作
- Verilog daily question (VL2 asynchronous reset Series T trigger - Niuke network)
- 【impala】【报错解决】 Impala cannot read or execute the parent directory of dfs.domain.socket.path的解决方法
- Proof of the third scene (f) in 22 years
猜你喜欢

The practice of the beego framework for goweb development: Section V project construction and user registration

Source code of voice live broadcast app

利用SQL Server代理作业对数据库进行定时还原

Use of influxdb2

线性代数及矩阵论(九)

在PDF中插入文本水印

Analysis of kubernetes service principle

Visual studio 2012/2015 releases web applications together with.Cs source code

Proof of the third scene (f) in 22 years

influxdb2的使用
随机推荐
Pytorch Foundation: similarities and differences between torch.mul, torch.mm and torch.matmul
Export word according to the template, generate compound format tables and variable column tables
Firewalld防护墙
Verilog 每日一题 (VL30 RAM的简单实现)
2021年4月份自考
高速电路中电阻的选择
【impala】【报错解决】 Impala cannot read or execute the parent directory of dfs.domain.socket.path的解决方法
[Presto] details of the new version upgrade of Presto
Encountered.Sqlite file processing during Android Development
Basic principle of asynchronous FIFO (simple implementation based on Verilog)
线性代数及矩阵论(十)
批量下载文件
Proof of the third scene (f) in 22 years
Why do I choose to use go language?
Shopee code League 2022 - qualification round p3.connecting the numbers (segment tree / bipartite graph determination, to be discussed)
Verilog daily question (vl26 simple stopwatch)
Visual Studio 2015 团队开发之Azure DevOps篇
Asynchronous circuit design -- principle and example of synchronous pulser
SNAT、DNAT 防火墙规则的备份和还原
[ansible] the ansible shell encountered the problem of $symbol in awk when executing remote commands