talsperre / Fast-Weighted-Median-Filter

DIP Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fast Weighted Median Filter

Weighted median is used in many of computer vision applications for its properties in sparsity representation. We re-implement an efficient algorithm to reduce computation complexity from O(r2) to O(r) where r is the kernel size.

The paper contributes a new joint-histogram representation, median tracking, and a new data structure that enables fast data access. The running time is largely shortened from several minutes to less than 1 second.

img

Prerequisites

  1. C++11 or higher: The algorithm scheme is implemented in C++.

  2. GCC compiler: For compiling C++ code.

Install gcc

  1. OpenCV 3.0 or higher: For image processing tasks.

Install opencv

Testing

Please, follow the following instructions for testing the code:

  1. Clone this repository
git clone https://github.com/gulshan-mittal/Fast-Weighted-Median-Filter.git
  1. Go to the root directory of the repository.
cd Fast-Weighted-Median-Filter
  1. Compile the files
make
  1. run the output file using the following arguments
./output dataset/ComObj/lena.png results/ComObj/lena_out.png 3 0 1

Arguments:

  • relative image filepath
  • output image path
  • kernel radius
  • type of weights
    • 0: unweighted
    • 1: gaussian
    • 2: Jacard
  • comparison with naive implementaion (This argument is not compulsory, you can skip it)
    • 0: Yes
    • 1: No

Example

Example-1: Removing salt-pepper noise from image

#Kernel size: 3
#Kernel type: Unweighted

./output ./dataset/ComObj/lena.png ./results/ComObj/lena_out.png 3 0
Input Image Output image
input image input image

Example-1: Removing Artifacts from image using Gaussian filter

#Kernel size: 10
#Kernel type: Gaussian

./output ./dataset/Artifacts/snail_artifact.jpg ./results/Artifacts/snail_artifact_out.jpg 10 1
Input Image Output image
input image input image

Analysis

Plot Details Plot
Time Vs Kernel Size (Gaussian Kernel) input image
Time Vs Image Size (Gaussian Kernel) input image
Time Vs Kernel Size (Unweighted) input image
Time Vs Image Size (Unweighted) input image

Collaborators

  1. Gulshan Kumar
  2. Nikhil Bansal
  3. Aditya Aggarwal

About

DIP Project


Languages

Language:C++ 89.6%Language:Python 9.8%Language:Makefile 0.6%