当前位置:网站首页>First knowledge of opencv4.x --- image convolution
First knowledge of opencv4.x --- image convolution
2022-07-25 09:47:00 【F l e】
// Image convolution principle
#include <stdio.h>
#include <iostream>
#include <string>
#include <opencv2\opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat src = (cv::Mat_<float>(5, 5) <<
1, 2, 3, 4, 5,
6, 7, 8, 9, 10,
11, 12, 13, 14, 15,
16, 17, 18, 19, 20,
21, 22, 23, 24, 25);// Enumeration assignment method , You have to put parentheses , Otherwise VS2017 Will report a mistake
Mat dst;
Mat kernel = (cv::Mat_<float>(3, 3) <<
1, 2, 1,
0, 2, 0,
1, 2, 1);
kernel = kernel / 10;// Divide 10 Normalization , Prevent the pixel value from crossing the boundary after convolution
filter2D(src, dst, CV_32F, kernel);
waitKey(0);
return 0;
}
adopt Image Watch Plug in view Mat Variable data :


边栏推荐
猜你喜欢
随机推荐
Matlab drawing | some common settings of axis
UI prototype resources
Preliminary understanding and implementation of wechat applet bottom navigation bar
【深度学习】卷积神经网络
自定义Dialog 实现 仿网易云音乐的隐私条款声明弹框
OC -- Foundation -- array
What is cerebral fissure?
cell的定义
OC -- Foundation -- string + date and time
[code source] daily question tree
[code source] National Railway
一张图讲解 SQL Join 左连 又连
【深度学习】自编码器
matlab如何导入大量数据
OC -- first acquaintance
微信小程序实现轮播图(自动切换&手动切换)
*6-1 CCF 2015-03-2 numerical sorting
[code source] I have a big head for a problem every day
*7-2 CCF 2015-09-2 date calculation
文件--初识









