opencv::自定义线性滤波
2024-09-01 11:04:56
卷积概念
常见算子
自定义卷积模糊
卷积概念
1、卷积是图像处理中一个操作,是kernel在图像的每个像素上的操作。
2、Kernel本质上一个固定大小的矩阵数组,其中心点称为锚点(anchor point)。
3、把kernel放到像素数组之上,求锚点周围覆盖的像素乘积之和(包括锚点),用来替换锚点覆盖下像素点值称为卷积处理。
常见算子
自定义卷积模糊 filter2D(
Mat src, // 输入图像
Mat dst, // 模糊图像
int depth, // 图像深度32/8
Mat kernel, // 卷积核/模板
Point anchor, // 锚点位置
double delta // 计算出来的像素+delta
)
int main(int argc, char** argv) {
Mat src, dst;
int ksize = ; src = imread(STRPAHT2);
if (!src.data) {
printf("could not load image...\n");
return -;
}
// Sobel X 方向
// Mat kernel_x = (Mat_<int>(3, 3) << -1, 0, 1, -2,0,2, -1, 0, 1);
// filter2D(src, dst, -1, kernel_x, Point(-1, -1), 0.0);
//imshow("Sobel X", dst); // Sobel Y 方向
//Mat kernel_y = (Mat_<int>(3, 3) << -1, -2, -1, 0,0,0, 1,2,1);
//filter2D(src, dst, -1, kernel_y, Point(-1, -1), 0.0);
//imshow("Sobel X", dst); // 拉普拉斯算子
// Mat kernel_y = (Mat_<int>(3, 3) << 0, -1, 0, -1, 4, -1, 0, -1, 0);
// filter2D(src, dst, -1, kernel_y, Point(-1, -1), 0.0);
//imshow("Sobel K_Y", dst); int c = ;
int index = ;
while (true) {
c = waitKey();
if ((char)c == ) {// ESC
break;
}
ksize = + (index % ) * ;
Mat kernel = Mat::ones(Size(ksize, ksize), CV_32F) / (float)(ksize * ksize);
filter2D(src, dst, -, kernel, Point(-, -));
index++;
imshow("OUTPUT_WIN", dst);
} waitKey();
return ;
}
最新文章
- CUBRID学习笔记 16 元数据支持
- typings的理解
- sudo su 提示没有配置JDK environment
- tomcat+JNDI+spring 的配置问题
- 当前位置: 银光首页 >; WPF >; WPF学习教程 >; WPF: ShowDialog() 切换到其他应用窗口后,再切换回来无法让子窗口总在最上方
- Android NDK开发Crash错误定位[转]
- Led控件
- ArrayList和List主要区别 就是ArrayList类型不安全。
- android 模拟器对应键盘快捷键
- 微信小程序在开发中遇到的问题与解决方法
- Java 学习笔记 IO流与File操作
- C# 发送电子邮件源码片段
- CSS gradient渐变之webkit核心浏览器下的使用以及实例
- C#复杂类型序列化
- iOS-构建自己的代码块【提高编码效率-Xcode代码块】
- 蓝牙开发<;coreBluetooth/CoreBluetooth.h>;
- iOS 代码片段的添加!
- python网络编程-线程队列queue
- java 多线程阻塞队列 与 阻塞方法与和非阻塞方法
- UNIX网络编程读书笔记:select函数
热门文章
- caffe学习三:使用Faster RCNN训练自己的数据
- 2019 DevOps 必备面试题——配置管理篇
- netty源码解解析(4.0)-22 ByteBuf的I/O
- Docker学习之Dockerfile
- 关闭vue的eslint代码检测和WebStorm的代码检测
- 生产环境轻量级dns服务器dnsmasq搭建文档
- java ThreadLocal使用
- Creating a Store Locator with PHP, MySQL &; Google Maps(保存地图坐标 经纬度方法 google mysql)
- CPU的物理数、核心数、线程数
- ThinkPHP5 清除runtime缓存文件