当前位置:网站首页>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
CoreData存储待办事项
OC -- object replication
Class (2) and protocol
[code source] score split of one question per day
Kotlin collaboration: foundation and use of collaboration
服务器cuda toolkit多版本切换
¥ 1-3 SWUST OJ 942: reverse sequence table
Operation 7.19 sequence table
缺陷检测网络--混合监督(kolektor缺陷数据集复现)
Laravel calls a third party to send mail (PHP)
A picture explains SQL join left and right
基于stm32的恒功率无线充电
OC -- first acquaintance
Voice chat app source code - produced by NASS network source code
初识Opencv4.X----为图像添加椒盐噪声
OC--Foundation--数组
## 使用 Kotlin USE 简化文件读写
降低程序空间复杂度的一些技巧









