1/12/2013

CvFilter2D example source code, various Filter masks

double K[] = { 1, 2, 1, 2, 4, 2, 1, 2, 1 };

float t=0;
for(int i=0; i< (3*3); ++i)
     t = t + K[i];
for(int i=0; i< (3*3); ++i)
     K[i] = K[i] / t;

CvMat Kernel=cvMat(3, 3, CV_64FC1, K); 
cvFilter2D(InputImg,OutputImg, &Kernel);


various type of filter mask
 
Gaussian Filter 
Average Filter
High pass Filter
Horizontal Prewitt Filter
Vertical Prewitt Filter
Horizontal Sobel Filter
Vertical Sobel Filter
Laplacian Filter
Sharpen Filter
 
Sharpen Low Filter

No comments:

Post a Comment