Applying Normalized Block Filter

void blur(InputArray src, OutputArray dst, Size ksize, Point anchor=Point(-1,-1), int borderType=BORDER_DEFAULT )

Parameters:
  • src – input image; it 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.
  • ksizeblurring kernel size.
  • anchor – anchor point; default value Point(-1,-1) means that the anchor is at the kernel center.
  • borderType – border mode used to extrapolate pixels outside of the image.
You can find a nice example in OpenCV Documentation.

 Example:

-------------
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"

using namespace std;
using namespace cv;

int main( int argc, char** argv )
 {
   
     Mat src = imread( "salt.tif", 1 );
     Mat dst;

     //Apply median filter
     blur( src, dst, Size( 5, 5 ), Point(-1,-1) );
     imshow("source", src);
     imshow("result", dst);   

     waitKey(0);
     return 0;
 }

-------------

No comments:

Post a Comment