#include <opencv2\opencv.hpp>
#include <iostream>
#include <math.h>
#include <vector>
using namespace cv;
using namespace std;
int main()
{
Mat M(2, 2, CV_8UC3, Scalar(0, 0, 255));
cout << "M = " << endl << M << endl;
Mat M;
M.create(4, 4, CV_8UC(2));
cout << "M = " << endl << M << endl;
Mat M = (Mat_<double>(3, 3) << 0, 1, 2, 3, 4, 5, 6, 7, 8);
cout << "M = " << endl << M << endl;
Mat e = Mat::eye(4, 4, CV_64F);
Mat o = Mat::ones(2, 2, CV_32F);
Mat z = Mat::zeros(3, 3, CV_8UC1);
system("pause");
return 1;
}
void sharpen2D(const Mat &image, Mat &result)
{
Mat kernel(3,3,CV_32F,Scalar(0));
kernel.at<float>(1,1) = 5.0;
kernel.at<float>(0,1) = -1.0;
kernel.at<float>(2,1) = -1.0;
kernel.at<float>(1,0) = -1.0;
kernel.at<float>(1,2) = -1.0;
filter2D(image,result,image.depth(),kernel);
}
//两个图像相加
addWeighted(image,0.7,image2,0.9,0,result);
//通道分割
vector<Mat>planes;
split(image1,planes);
planes[0]
merge(planes,result);
opencv和C++创建Mat的方法,二维卷积kernel,通道分离
最新推荐文章于 2024-02-01 11:52:19 发布