Class ImageReader


  • public final class ImageReader
    extends java.lang.Object
    BufferedImage reader that exports the raw bytes as a feature vectors with different encodings.
    Author:
    thomas.jungblut
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<java.awt.image.BufferedImage> getSlidingWindowPatches​(java.awt.image.BufferedImage source, int windowWidth, int windowHeight, int verticalStride, int horizontalStride)
      Calculates subimage windows with the sliding window algorithm.
      static de.jungblut.math.DoubleVector readImageAsGreyScale​(java.awt.image.BufferedImage img)
      Returns the given image as a vector, where each dimension is mapped to a given pixel in the image.
      static de.jungblut.math.DoubleVector[] readImageAsLUV​(java.awt.image.BufferedImage img)
      Returns the given image as a list of points in space, where each point is encoded by its LUV value.
      static de.jungblut.math.DoubleVector[] readImageAsRGB​(java.awt.image.BufferedImage img)
      Returns the given image as a list of points in space, where each point is encoded by its RGB values.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getSlidingWindowPatches

        public static java.util.List<java.awt.image.BufferedImage> getSlidingWindowPatches​(java.awt.image.BufferedImage source,
                                                                                           int windowWidth,
                                                                                           int windowHeight,
                                                                                           int verticalStride,
                                                                                           int horizontalStride)
        Calculates subimage windows with the sliding window algorithm.
        Parameters:
        source - the source image to chunk.
        windowWidth - the window width.
        windowHeight - the window height.
        verticalStride - the vertical stride between image offsets.
        horizontalStride - the horizontal stride between image offsets.
        Returns:
        a list of subimages containing the windows, internally pointing to the source image.
      • readImageAsGreyScale

        public static de.jungblut.math.DoubleVector readImageAsGreyScale​(java.awt.image.BufferedImage img)
        Returns the given image as a vector, where each dimension is mapped to a given pixel in the image. The value of each dimension is the greyscaled value that was calculated by averaging the RGB information at each pixel and thus guaranteed to be between 0 and 255.
        Parameters:
        img - a buffered image.
        Returns:
        height*width dimensional vector.
      • readImageAsRGB

        public static de.jungblut.math.DoubleVector[] readImageAsRGB​(java.awt.image.BufferedImage img)
        Returns the given image as a list of points in space, where each point is encoded by its RGB values.
        Parameters:
        img - a buffered image.
        Returns:
        height*width number of vectors, each vector is 3 dimensional encoded for the RGB of the image.
      • readImageAsLUV

        public static de.jungblut.math.DoubleVector[] readImageAsLUV​(java.awt.image.BufferedImage img)
        Returns the given image as a list of points in space, where each point is encoded by its LUV value. LUV is: L = Luminescence; u = saturation; v = hue angle.
        Parameters:
        img - a buffered image.
        Returns:
        height*width number of vectors, each vector is 3 dimensional encoded for the LUV of the image.