opencv之图像叠加与图享混合
ROI区域
cv::Mat image_roi = image(cv::Rect(x, y, width, height));
cv::Mat image_roi = image(cv::Range(y, y + height), cv::Range(x, x + width));
线性混合
void addWeighted(InputArray src1, double alpha, InputArray src2,
double beta, double gamma, OutputArray dst, int dtype = -1);
注: dst = src1[I] * alpha + src2[I] * beta + gamma
实例
#include
#include
#include
using namespace cv;
using namespace std;
bool ROI_AddImage()
{
Mat srcImage1= imread("/home/test/dota_pa.jpg");
Mat logoImage= imread("/home/test/dota_logo.jpg");
if( !srcImage1.data ) { printf("srcImage1 dont exist!
"); return false; }
if( !logoImage.data ) { printf("logoImage dont exist!
"); return false; }