core核心模块--使用OpenCV对两幅图像求和(求混合(blending))
来源:互联网 发布:淘宝自动纸箱封箱机 编辑:程序博客网 时间:2024/05/16 04:17
1.目的
(1)线性混合(linear blending)是什么以及有什么优势
(2)如何使用addWeighted函数进行两幅图像求和
2.原理
线性混合操作是一种经典的二元操作:
通过在范围 0->1 内改变a,以及改变gamma值,这个操可以用来对两幅图像或两段视频产生时间上的 画面叠化 (cross-dissolve)效果
3.代码实现
#include<iostream>using namespace std;#include<opencv2/core/core.hpp>#include<opencv2/highgui/highgui.hpp>#include<opencv2/imgproc/imgproc.hpp>using namespace cv;int main(int argc, char** argv){ if(argc < 2){ cout << "more parameters are required!!!" << endl; return(-1); } double alpha, beta, gamma; Mat result; alpha = 0.5; beta = 1-alpha; gamma = 0; Mat image1 = imread(argv[1]); Mat image2 = imread(argv[2]); //判断是否成功读入图片数据 if(!image1.data || !image2.data){ cout << "error reading images!!!" << endl; return(-1); } //判断读入的图片是否大小相同 cout << image1.size() << endl; cout << image2.size() << endl; //CV_Assert(image1.rows!=image2.rows && image1.rows!=image2.rows); //使用addWeighted函数混合图片,PS:图片的大小要一致 addWeighted(image1, alpha, image2, beta, gamma, result); imshow("blending images", result); waitKey(0); return(0);}
参考文献
1.http://www.opencv.org.cn/opencvdoc/2.3.2/html/doc/tutorials/core/adding_images/adding_images.html#adding-images
阅读全文
0 0
- core核心模块--使用OpenCV对两幅图像求和(求混合(blending))
- OpenCV之core 模块. 核心功能(1)Mat - 基本图像容器 OpenCV如何扫描图像、利用查找表和计时 矩阵的掩码操作 使用OpenCV对两幅图像求和(求混合(blending))
- opencv c++函数 基础4 使用OpenCV对两幅图像求和(求混合(blending))
- opencv学习笔记10 使用OpenCV对两幅图像求和(求混合(blending))¶
- OpenCV学习:使用OpenCV对两幅图像求和(求混合(blending))
- 使用OpenCV对两幅图像求和(求混合(blending))
- 学习OpenCV范例(四)——使用OpenCV对两幅图像求和(求混合(blending))
- 两幅图像求和:求混合(blending)-----学习记录(3)
- 使用OpenCV对两幅图像求和
- opencv之图像混合(blending)
- Class02 图像混合Blending
- OpenCV学习笔记2 OpenCV核心模块与核心功能Core Module & Core Functionality(一)
- OpenCV学习笔记3 OpenCV核心模块与核心功能Core Module & Core Functionality(二)
- OpenCV学习笔记4 OpenCV核心模块与核心功能Core Module & Core Functionality(三)
- OpenCV学习笔记5 OpenCV核心模块与核心功能Core Module & Core Functionality(四)
- OpenCV学习笔记6 OpenCV核心模块与核心功能Core Module & Core Functionality(五)
- OpenCV学习笔记7 OpenCV核心模块与核心功能Core Module & Core Functionality(六)
- 【python图像处理】两幅图像的合成一幅图像(blending two images)
- 【Ctrl】 + 【Alt】 + 【F1~F6】 和 【Ctrl】 + 【Alt】 + 【T】打开的终端有什么不同?
- Node.js与包管理工具npm
- PHP操作mysql数据库总结
- Raspberry_pi允许mysql远程连接
- 金字塔原理
- core核心模块--使用OpenCV对两幅图像求和(求混合(blending))
- 定时任务
- LeetCode Trie树(前缀树)
- Java8 重新认识HashMap
- 利用词间语义先验关系提升词嵌入表示
- c++字符串流
- SDUT 3916 上色的纱雾
- 运算符重载(2)———流运算符重载函数
- LeetCode 17. Letter Combinations of a Phone Number 递归回溯法