Applying Median and Wiener Filters - Denoise Image in Java

Applying Median and Wiener Filters

The median filter is a nonlinear digital filtering technique, often used to remove noise. Such noise reduction is a typical pre-processing step to improve the results of later processing.

The Wiener filter is the MSE(mean squared error) optimal stationary linearfilter for images degraded by additive noise and blurring.

Using Aspose.Imaging for Java API developers can apply median filter to denoise the image and can apply gauss wiener filter on images. This article demonstrates how median filter and gauss wiener filter can be applied to images.

Applying Median Filter

Aspose.Imaging provides MedianFilterOptions class to apply filter on a RasterImage. The code snippet provided below demonstrates how to apply median filter to a raster image.

Applying Gauss Wiener Filter

Aspose.Imaging provides GaussWienerFilterOptions class to apply filter on a RasterImage. The code snippet provided below demonstrates how to apply gauss wiener filter to a raster image.

Applying Gauss Wiener Filter For Colored image

Applying Motion Wiener Filter

Aspose.Imaging provides MotionWienerFilterOptions class to apply filter on a RasterImage. The code snippet provided below demonstrates how to apply motion wiener filter to a raster image.

Apply Correction Filter On An Image

This article demonstrates the usage of Aspose.Imaging for Java to perform correction filters on an image. Aspose.Imaging API have exposed efficient & easy to use methods to achieve this goal.

Aspose.Imaging for Java has exposed the BilateralSmoothingFilterOptions and SharpenFilterOptions classes for filtration. BilateralSmoothingFilterOptions class needs an integer as size.

The steps to perform Resize are as simple as below:

  1. Load an image using the factory method Load exposed by Image class.
  2. Convert the image into RasterImage.
  3. Create an instances of BilateralSmoothingFilterOptions and SharpenFilterOptions classes.
  4. Call the RasterImage.Filter method while specifying rectangle as image bounds and BilateralSmoothingFilterOptions class instance.
  5. Call the RasterImage.Filter method while specifying rectangle as image bounds and SharpenFilterOptions class instance.
  6. Adjust the contrast
  7. Set brightness
  8. Save the results.

The following code example demonstrates how to apply correction filter.

Use Bradley threshold algorithm

Image thresholding is used in graphics applications. The goal of thresholding an image is to classify pixels as either “dark” or “light”. Aspose.Imaging API allows you to use Bradley thresholding while converting images. The following code snippet shows you how to define the threshold value and then invoke the Bradley’s threshold algorithm.