shouzo / Add_Salt-Pepper_Noise

A program that add salt&pepper noise to an image using opencv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Salt&Pepper Noise

Code for adding Salt&Pepper noise to an image ,you can customize pa and pb to your need.

Requirement:

  • OpenCV (2.2.0+)

  • IDE: {QT(suggested) or VS} or maybe simply a g++ compiler

  • Some C++ standard libs

Notes: This is a project for adding salt&pepper noise to an image and try to remove it using median filter (I write this code in ubuntu 14.04)

First we have an image below as original image :(lena for example)

To add salt&pepper noise to the image above and the result is the following:(I set pa=0.1and pb =0.05)

After step2 we will generate an noise-image, we can remove the salt-pepper noise using Median filter

And the effect:

Note that the code is in main.cpp, I also add the add-guassian-noise section,again you can try different pa,pb of salt-pepper noise and different sigma,mean of guassian-noise.

About

A program that add salt&pepper noise to an image using opencv


Languages

Language:C++ 100.0%