Steps to Apply Blur Filter Effect on an Image | OpenCV with Visual Studio in Windows 10. In this Tutorial, we are going to apply Blur Filter Effect on an image using OpenCV.
Explaination : Function used: GaussianBlur(img, img, cv::Size(3, 3), 0) - This function can process images and blur an image.
Like, Share and Comment Below. You may also like these:
Apply Erode Filter Effect on an Image
Apply Dilate Filter Effect on an Image
Apply Negative Filter Effect on an Image
- First of all, Follow this tutorial to Install & Configure OpenCV with Visual Studio 2015
- Copy the Full Source Code to Apply Blur Filter on an Image from here:
- Paste full source code and Run it (Ctrl+F5 or F5).
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
using namespace cv;
int main()
{
//Load an Image
Mat img = imread("C:/Briefcase/Chess.jpg", CV_LOAD_IMAGE_COLOR);
namedWindow("Image", CV_WINDOW_AUTOSIZE);
imshow("Image", img);
//Blur Effect
GaussianBlur(img, img, cv::Size(3, 3), 0);
namedWindow("BlurEffect", CV_WINDOW_AUTOSIZE);
imshow("BlurEffect", img);
//Wait Key press
cvWaitKey(0);
//destroy
cvDestroyWindow("Image");
cvDestroyWindow("BlurEffect");
return 0;
}
ORGet BlurEffect.cpp from Github:
Download BlurEffect.cpp
| Load Image OpenCV |
| Blur Image OpenCV |
Explaination : Function used: GaussianBlur(img, img, cv::Size(3, 3), 0) - This function can process images and blur an image.
- 1st parameter is the source image.
- 2nd parameter is the destination or resultant image which is a blur image.
- 3rd parameter is the structuring element used.
- 4th parameter is gaussian standard deviation in x direction (sigmaX)
Like, Share and Comment Below. You may also like these:
Thankyou.. useful but also post on 'how can i add blur effect on a video'
ReplyDeleteif its a live vide follow this link;
ReplyDeletehttp://opencv-cpp.blogspot.com/2016/11/canny-edge-detection-on-webcam.html