- Platform - Windows
- Microsoft Visual Studio 2022
- OpenCV 4.0 or above
- Clone this repository to your local system.
- Open the
OpenCV-Image-Filtering.sln
in visual studio. - Now setup path directories for opencv in the project properties.
- Under Configuration Properties, go to VC++ Directories and set the path for include directories and library directories to
path\to\opencv-folder\opencv\build\include
andpath\to\opencv-folder\opencv\build\x64\vc16\lib
respectively. - Under Linker Properties, go to Input and add
opencv_world480d.lib
under Additional Dependencies.
- Under Configuration Properties, go to VC++ Directories and set the path for include directories and library directories to
The Program includes a total of 5 image filters from opencv library.
- Gaussian Blur
- Dilate
- Erode
- Median Blur
- Filter2D
The program requires 2 header files imgproc.hpp
for using the filters and highgui.hpp
for displaying images.
The function convolves the source image with the specified Gaussian kernel.
For more information regarding the parameters please visit here
void cv::GaussianBlur ( InputArray src,
OutputArray dst,
Size ksize,
double sigmaX,
double sigmaY = 0,
int borderType = BORDER_DEFAULT
)
Original | Output |
Dilates an image by using a specific structuring element. The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken:
For more information regarding the parameters please visit here
void cv::dilate ( InputArray src,
OutputArray dst,
InputArray kernel,
Point anchor = Point(-1,-1),
int iterations = 1,
int borderType = BORDER_CONSTANT,
const Scalar & borderValue = morphologyDefaultBorderValue()
)
Original | Output |
Erodes an image by using a specific structuring element. The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken:
For more information regarding the parameters please visit here
void cv::erode ( InputArray src,
OutputArray dst,
InputArray kernel,
Point anchor = Point(-1,-1),
int iterations = 1,
int borderType = BORDER_CONSTANT,
const Scalar & borderValue = morphologyDefaultBorderValue()
)
Original | Output |
Blurs an image using the median filter.
The function smoothes an image using the median filter with the ksize × ksize
aperture. Each channel of a multi-channel image is processed independently.
For more information regarding the parameters please visit here
void cv::medianBlur ( InputArray src,
OutputArray dst,
int ksize
)
Original | Output |
Convolves an image with the kernel.
The function applies an arbitrary linear filter to an image. In-place operation is supported. When the aperture is partially outside the image, the function interpolates outlier pixel values according to the specified border mode.
The function does actually compute correlation, not the convolution:
For more information regarding the parameters please visit here
void cv::filter2D ( InputArray src,
OutputArray dst,
int ddepth,
InputArray kernel,
Point anchor = Point(-1,-1),
double delta = 0,
int borderType = BORDER_DEFAULT
)
Original | Output |