OPENCV(4) —— ImgProc
2D图像滤波器基础类BaseFilter:dst(x,y) = F(src(x,y), src(x+1,y)... src(x+wdith-1,y), src(y+1,x)... src(x+width-1, y+height-1) );
相关的调用函数为getLinearFilter、getMorphologyFilter
单行核滤波器基础类BaseRowFilter:dst(x,y) = F(src(x,y), src(x+1,y),...src(x+width-1,y));
相关的调用函数为getLinearRowFilter、getMorphologyRowFilter
单列核滤波器基础类BaseColumnFilter:dst(x,y) = F(src(x,y), src(x,y+1),...src(x,y+width-1));
相关的调用函数为getColumnSumFilter、getLinearColumnFilter、getMorphologyColumnFilter
类FilterEngine:该类可以应用在对图像的任意滤波操作当中,在OpenCV滤波器函数中扮演着很重要的角色,相关的函数有createBoxFitler、createDerivFitlter、createGaussianFilter、createLinearFilter、createMorphologyFilter、createSeparableLinearFilter
这里介绍一下我使用Laplacian滤波的心得,这个函数的第三个参数为输出的图像的深度,注意经过拉普拉斯算子处理后得到的值是有正有负的,所以输出图像的深度最好为输入图像深度的2倍,才能有效防止数据溢出,如必须要使用8位的数据,可以再使用函数convertScaleAbs处理。而且要注意使用的拉普拉斯算子掩膜的中心系数为负。

GaussianBlur
Parameters:
- src – input image; the image can have any number of channels, which are processed independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
 - dst – output image of the same size and type as src.
 - ksize – Gaussian kernel size. ksize.width and ksize.height can differ but they both must be positive and odd. Or, they can be zero’s and then they are computed from sigma* .
 - sigmaX – Gaussian kernel standard deviation in X direction.
 - sigmaY – Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height , respectively (see getGaussianKernel() for details); to fully control the result regardless of possible future modifications of all this semantics, it is recommended to specify all of ksize,sigmaX, and sigmaY.
 - borderType – pixel extrapolation method (see borderInterpolate() for details).
 
void convertScaleAbs(InputArray src, OutputArray dst, double alpha=1, double beta=0)
Parameters:
- src – input array.
 - dst – output array.
 - alpha – optional scale factor.
 - beta – optional delta added to the scaled values.
 
#include "stdafx.h" #include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdlib.h>
#include <stdio.h> using namespace cv; /** @function main */
int main( int argc, char** argv )
{
Mat src, src_gray, dst;
int kernel_size = 3;
int scale = 1;
int delta = 0;
int ddepth = CV_16S;
char* window_name = "Laplace Demo"; // int c; /// Load an image
src = imread( "zhou.jpg" ); // Mat --- imread if( !src.data )
{ return -1; } /// Remove noise by blurring with a Gaussian filter
GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT ); /// Convert the image to grayscale
cvtColor( src, src_gray, CV_RGB2GRAY ); /// Create window
namedWindow( window_name, CV_WINDOW_AUTOSIZE ); // cvNamedWindow /// Apply Laplace function
Mat abs_dst; Laplacian( src_gray, dst, ddepth, kernel_size, scale, delta, BORDER_DEFAULT );
convertScaleAbs( dst, abs_dst ); // Scales, calculates absolute values, and converts the result to 8-bit. /// Show what you got
imshow( window_name, abs_dst ); waitKey(0); return 0;
}
转自:http://blog.csdn.net/yang_xian521/article/category/910716/4
OPENCV(4) —— ImgProc的更多相关文章
- [error]OpenCV Error: Assertion failed (ssize.width > 0 && ssize.height > 0) in resize, file modules/imgproc/src/resize.cpp, line 3289
		
error OpenCV Error: Assertion failed (ssize.width > && ssize.height > ) terminate call ...
 - OpenCV 之 边缘检测
		
上一篇 <OpenCV 之 图像平滑> 中,提到的图像平滑,从信号处理的角度来看,实际上是一种“低通滤波器”. 本篇中,数字图像的边缘,因为通常都是像素值变化剧烈的区域 (“高频”),故可 ...
 - opencv 简单模糊和高斯模糊 cvSmooth
		
cv::Mat 是C++版OpenCV的新结构. cvSmooth() 是老版 C API. 没有把C接口与C + + 结合. 建议你们也可以花一些时间看一下介绍. 同样,你如果查看opencv/mo ...
 - OpenCV图像金字塔:高斯金字塔、拉普拉斯金字塔与图片尺寸缩放
		
这篇已经写得很好,真心给作者点个赞.题目都是直接转过来的,直接去看吧. Reference Link : http://blog.csdn.net/poem_qianmo/article/detail ...
 - OpenCV图像的二值化
		
图像的二值化: 与边缘检测相比,轮廓检测有时能更好的反映图像的内容.而要对图像进行轮廓检测,则必须要先对图像进行二值化,图像的二值化就是将图像上的像素点的灰度值设置为0或255,这样将使整个图像呈现出 ...
 - OpenCV中对图像进行二值化的关键函数——cvThreshold()。
		
函数功能:采用Canny方法对图像进行边缘检测 函数原型: void cvThreshold( const CvArr* src, CvArr* dst, double threshold, doub ...
 - matlab调用opencv函数的配置
		
环境: VS2010 活动解决方案平台x64 WIN 8.1 Opencv 2.4.3 Matlab 2012a 1. 首先保证vs2010能正确调用opencv函数, 2. Matlab中选择编 ...
 - 【OpenCV新手教程之十三】OpenCV图像金字塔:高斯金字塔、拉普拉斯金字塔与图片尺寸缩放
		
本系列文章由@浅墨_毛星云 出品,转载请注明出处. 文章链接:http://blog.csdn.net/poem_qianmo/article/details/26157633 作者:毛星云(浅墨) ...
 - OpenCV 之 图像分割 (一)
		
1 基于阈值 1.1 基本原理 灰度阈值化,是最简单也是速度最快的一种图像分割方法,广泛应用在硬件图像处理领域 (例如,基于 FPGA 的实时图像处理). 假设输入图像为 f,输出图像为 g,则经 ...
 
随机推荐
- SSIS安装以及安装好找不到商业智能各种坑
			
原文:SSIS安装以及安装好找不到商业智能各种坑 这两天为了安装SSIS,各种头疼.记录一下,分享给同样遇到坑的.. 安装SSIS需要几个步骤. 先说一下我的情况,安装SQL的时候,一直默认下一步,没 ...
 - visual studio 2015下python编程的中文字符串问题
			
visual studio 2015强大的编程功能,编写起python来也是非常方便的,但其对中文字符的支持不是很好,经常发生莫名其妙的错误,最常见的错误是不报错,也不执行代码. 代码简单如下: x= ...
 - Matlab 图像的邻域和块操作
			
图像的邻域操作是指输出图像的像素点取值,由输入图像的某个像素点及其邻域内的像素,通常像素点的邻域是一个远小于图像本身尺寸.形状规则的像素块,如2×2,3×3正方形.2×3矩形等,或者近似圆形的多边形. ...
 - 洛谷 P2926 [USACO08DEC]拍头Patting Heads
			
P2926 [USACO08DEC]拍头Patting Heads 题目描述 It's Bessie's birthday and time for party games! Bessie has i ...
 - Android笔记——Activity中的数据传递案例(用户注冊)
			
1.创建程序activity_main: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/andro ...
 - IIS访问站点,出现connection refused
			
排查后,发现是因为使用了代理导致的. 需要设置 Don't use the proxy server for local addresses.
 - 查看spark是否有僵尸进程,有的话,先杀掉。可以使用下面命令
			
查看spark是否有僵尸进程,有的话,先杀掉.可以使用下面命令yarn application -listyarn application -kill <jobid>
 - 86.express里面的app.configure作用
			
以下摘自 express 3.0 的 文档 app.configure([env], callback) Conditionally invoke callback when env matches ...
 - 12.Intellij IDEA 添加jar包的三种方式
			
转自:https://blog.csdn.net/zwj1030711290/article/details/56678353/ 一.直接复制:(不推荐) 方法:直接将硬盘上的jar包复制粘贴到项目的 ...
 - String methods
			
A method is similar to a function – it takes arguments and returns a value – but the syntax is diffe ...
 
			
		