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

1 comment:

  1. Mechanical filtration is simply a device much like a sieve that strains the water of the tank so as to remove any debris. Bacterial Filtration Efficiency Tester