Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Filters

Mircea Anton edited this page Feb 12, 2021 · 1 revision

Filters

This wiki page gives a high level overview of all of the filters implemented in this project.

Available filters

  • AbstractBinaryFilter
    • ANDFilter

    Performs a bitwise AND operation between the pixels of 2 images

    • ORFilter

    Performs a bitwise OR operation between the pixels of 2 images

    • XORFilter

    Performs a bitwise XOR operation between the pixels of 2 images

  • BrightnessFilter

    Adds a given value to each color channel of the pixels of the image in order to adjust the brightness
    Note: the value can be negative in order to reduce brightness

  • ColorDepthReductionFilter

    Trims down a given number of bits from all color channels in order to reduce color depth Note: bits can be removed either starting from MSB or LSB

  • ContrastFilter

    Adjusts the contrast of the image by performing the following operation on each color channel: value = (value - 128) * factor + 128,
    where factor = $\frac{259 * (given contrast level + 255)}{255 * (259 - given contrast level)}$

  • ConvolutionFilter

    Performs matrix convolution against the pixel matrix and various convolution masks.
    Available convlution masks:

    • Blur Masks
      • Box Blur (3x3 or 5x5)
      • Gaussian Blur (3x3 or 5x5)
    • Laplacian Mask (3x3)
    • Prewitt Mask (3x3 horizontal or 3x3 vertical)
    • Sharpen Mask (3x3 low/high intensity)
    • Sobel Mask (3x3 horizontal or 3x3 vertical)
  • AbstractGrayLevelFilter
    • LinearGrayLevelFilter

      The linear transformations can be defined by this formula
      value = 255 - value
      It is basically the asme thing as a NegativeFilter

    • LogarithmicGrayLevelFilter

      The log transformations can be defined by this formula
      value = c * log(value + 1)
      for each color channel, where c is a given constant

    • PoweLawGrayLevelFilter

      The power law transformations can be defined by this formula
      value = c * (value ^ y)
      for each color channel, where c and y are given constants

  • AbstractGrayscaleFilter
    • AverageGrayscaleFilter

      averages all 3 color channels, by setting value = (red + green + blue) / 3

    • WeightedGrayscaleFilter

      Applies a given weight to each color channel, with the constraint that the 3 weights must add up to 1
      value = (red * redWeight + green * greenWeight + blue * blueWeight)

    • GrayscaleToBinaryFilter

      Makes all pixels of a grayscale image either black or white, depending on whether or not their color intensity is lower or greater than a given threshold

  • AbstractHistogramFilter

    Keeps track of how often each color intensity is encountered in an image and plots the result in a histogram

    • RedHistogramFilter

      Constructs a histogram for the red channel

    • GreenHistogramFilter

      Constructs a histogram for the green channel

    • BlueHistogramFilter

      Constructs a histogram for the blue channel

    • GrayHistogramFilter

      Constructs a histogram for the red channel on a grayscaled image

  • NegativeFilter

    Sets value = 255-value for each color channel

  • MirrorFilter

    Mirrors the pixel matrix either against he y axis or the x axis.

  • NormalizationFilter

    Normalizes the color intensities by setting: value = (value / (red + green + blue)) * 255 for each color channel

  • RotateFilter

    Simply performs matrix rotation on the pixel matrix

  • TranslateFilter

    Moves all pixels to the right and down by a given amount, basically enlarging the matrix and the image itself.
    The newly generated whitespace is either filled with black or a custom color.

  • AbstractZoomFilter
    • KTimesZoomFilter

      Let K be the zoom level:
      for each adjacent pixel, we call the bigger value max and smaller min:
      for i = 0 : K-1
      pixel[xK+i+1][yK] = min + (max - min) / K * i

    • PixelReplicationZoomFilter

      In this method, we just replicate the neighboring pixels for each given pixel firstly row-wise, and then column-wise

    • ZeroOrderHoldZoomFilter

      In this method, we pick two adjacent elements and then place their average between them

Description

Based on the list above, each base level filter, such as BrightnessFilter, ContrastFilter or NegativeFilter are standalone classes that extend the GenericFilter and override the filter(Image) method in order to apply their associated algorythms.
The entries that have sublists, such as AbstactBinaryFilter, AbstractHistogramFilter and AbstractGrayscaleFilter are implemented as abstract classes and provide a general implementation in the filter(Image) method, so that the child classes, such as ANDBinaryFilter etc can tweak various parameters to customize the algorythm.

Clone this wiki locally