Class BufferedImage2Matrix


  • public abstract class BufferedImage2Matrix
    extends Object
    This class is designed to wrap all minor manipulation tasks needed, such as converting a BufferedImage to a one/two-dimensional array.
    The methods below are inspired from Tom Gibara's implementation of Canny Edge Detection > readLuminance().
    See his code here.
    Note: This class follows the convention of reading/writing matrices in a row-by-row fashion.
    Author:
    Azim Ahmadzadeh, Data Mining Lab, Georgia State University
    • Constructor Detail

      • BufferedImage2Matrix

        public BufferedImage2Matrix()
    • Method Detail

      • getArrayFromImage

        public static double[] getArrayFromImage​(BufferedImage bImage)
        This method converts a BufferedImage object into a 1D array of color intensity values. In this implementation, the conversion of the 2D image is done in such a way that rows are put one after another to form the 1D array (as opposed to a column-by-column conversion).
        Parameters:
        bImage - the given BufferedImage object to be converted.
        Returns:
        a 1D array of the color intensity values (double) extracted from the given image.
      • get2DArrayFromImage

        public static double[][] get2DArrayFromImage​(BufferedImage bImage)
        This method converts a BufferedImage object into a 2D array of color intensity values.
        Parameters:
        bImage - the given BufferedImage object to be converted.
        Returns:
        a 2D array of the color intensity values (double) extracted from the given image.
      • get2DArrayFromImageIgnoringColorPixels

        public static double[][] get2DArrayFromImageIgnoringColorPixels​(BufferedImage bImage)