#include<opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
double alpha = 0.5;
double beta;
double input;
cout << "please input alpha(0 - 1)" << endl;
cin >> input;
if (input > 0 && input < 1) //check input alpha
alpha = input;
beta = 1 - alpha;
Mat src1 = imread("C:\\Users\\dell\\Desktop\\xin1.jpg", IMREAD_COLOR);
Mat src2 = imread("C:\\Users\\dell\\Desktop\\xin2.jpg", IMREAD_COLOR);
if (src1.empty()) //check src1
{
cout << "src1 load failed." << endl;
return -1;
}
if (src2.empty()) //check src2
{
cout << "src2 load failed." << endl;
return -2;
}
if (src1.size != src2.size) //check size
{
cout << "the size not equal." << endl;
return -3;
}
Mat dst; //dst = alpha*src1 + beta*src2 + gamma
addWeighted(src1, alpha, src2, beta, 0.0, dst);
waitKey(0);
return 0;
}
OpenCV_tutorials 03 core module-Adding(blending) two images
猜你喜欢
转载自blog.csdn.net/weixin_42142612/article/details/80852445
今日推荐
周排行