图片的加法运算:
常用函数:+,add(),addWeighted()
#include"opencv2/opencv.hpp"
#include<iostream>
using namespace cv;
using namespace std;
void main()
{
Mat img1 = imread("1.jpg");
Mat img2 = imread("2.jpg");
Mat dst;
//相加图片的尺寸必须相同!!
//②add(img1,img2,dst);①Mat dst = img1 + img2;
addWeighted(img1,0.5,img2,0.5,0,dst);//权重各位0.5
imshow("img1",img1);
imshow("img2",img2);
imshow("dst",dst);
//输出坐标(10,10)的蓝色通道的像素值
cout << "img1:" <<int(img1.at<Vec3b>(10, 10)[0]) << endl;//Vec3b是一种短向量的数据类型(3通道uchar类型的矩阵)
cout << "img2:" <<int(img2.at<Vec3b>(10, 10)[0])<< endl;
cout << "dst:" <<int(dst.at<Vec3b>(10, 10)[0]) << endl;
waitKey(0);
}