标签:return util 原理 efficient justify 一个 middle files ret
/* Various border types, image boundaries are denoted with ‘|‘ * BORDER_REPLICATE: aaaaaa|abcdefgh|hhhhhhh * BORDER_REFLECT: fedcba|abcdefgh|hgfedcb * BORDER_REFLECT_101: gfedcb|abcdefgh|gfedcba * BORDER_WRAP: cdefgh|abcdefgh|abcdefg * BORDER_CONSTANT: iiiiii|abcdefgh|iiiiiii with some specified ‘i‘ */
? |
|
---|
The function smoothes an image using the kernel:
高斯滤波。对去除正态分布的噪声非常实用
? |
|
---|
用自己的核函数进行滤波
? |
|
---|
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
using namespace cv;
Mat src,dst;
int i = 1;
static void change_dst(int, void*)
{
if(i%2 == 0)i++;
blur( src, dst, Size( i, i ), Point(-1,-1));
imshow("dstImage", dst);
}
int main( int, char** argv )
{
src = imread( argv[1] );
namedWindow("srcImage", 1);
namedWindow("dstImage", 1);
createTrackbar( "mean filter:", "dstImage", &i, 20, change_dst);
change_dst(0, 0);
imshow("srcImage", src);
waitKey();
return 0;
}
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
using namespace cv;
Mat src,dst;
int i = 1;
static void change_dst(int, void*)
{
if(i%2 == 0)i++;
GaussianBlur( src, dst, Size( i, i ), 0, 0 );
imshow("dstImage", dst);
}
int main( int, char** argv )
{
src = imread( argv[1] );
namedWindow("srcImage", 1);
namedWindow("dstImage", 1);
createTrackbar( "gauss filter:", "dstImage", &i, 20, change_dst);
change_dst(0, 0);
imshow("srcImage", src);
waitKey();
return 0;
}
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
using namespace cv;
Mat src,dst,Kernel;
int main( int, char** argv )
{
src = imread( argv[1] );
namedWindow("srcImage", 1);
namedWindow("dstImage", 1);
Kernel = (Mat_<double>(3,3) << 1, 2, 1, 2, 4, 2, 1, 2, 1)/16;
filter2D(src, dst, -1 , Kernel, Point(-1,-1));
imshow("dstImage", dst);
imshow("srcImage", src);
waitKey();
return 0;
}
K?=vhT ?
? |
|
---|
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
using namespace cv;
Mat src,dst,kernelX,kernelY;
int main( int, char** argv )
{
src = imread( argv[1] );
namedWindow("srcImage", 1);
namedWindow("dstImage", 1);
kernelX = (Mat_<double>(1,5) << 1,4,6,4,1)/16;
kernelY = (Mat_<double>(1,5) << 1,4,6,4,1)/16;
sepFilter2D(src, dst, -1, kernelX, kernelY);
imshow("dstImage", dst);
imshow("srcImage", src);
waitKey();
return 0;
}
标签:return util 原理 efficient justify 一个 middle files ret
原文地址:https://www.cnblogs.com/mqxnongmin/p/10628655.html