Saturday, April 18, 2015

Image Filtering with OpenCV

Last year I wanted put my hands on JavaCV and play little bit with that. But with time I couldn't continue that. Few weeks back I again got that crazy feel "The Machine" :D So I wanna start it again. But this time with c++.

Install OpenCV
I found a nice post that describe step by step to install OpenCV on ubuntu. You can follow that tutorial and get OpenCV on your machine. (If you are on Windows then it is just installing the .exe)
Installing OpenCV 3.0.0 on Ubuntu 14.04
In the post he is using OpenCV 3.0 alpha version. But now beta version is also available. I'm using the Beta version here. Just download the beta release from the officail OpenCV website. http://opencv.org/downloads.html
Then you can follow the same steps as mentioned.

Image Filtering
I'm not going to describe about what is image filtering or why we need that. You can find plenty of information about these topics if you really keen on. I'm just gonna show up the code that can be use to do Mode filtering and Median filtering.

Median Filtering
In Mode filtering what we do is simply break image into 3x3 segments and assign the median of those pixel values of each segment to the center pixel of the each segment.

Mode Filtering
In Mode filtering what we do is simply break image into 3x3 segments and assign the mode value of each segment to the center pixel of the each segment.

No comments:

Post a Comment