Class BufferedImage2Matrix
- java.lang.Object
-
- edu.gsu.cs.dmlab.imageproc.imageparam.util.BufferedImage2Matrix
-
public abstract class BufferedImage2Matrix extends Object
This class is designed to wrap all minor manipulation tasks needed, such as converting aBufferedImage
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 Summary
Constructors Constructor Description BufferedImage2Matrix()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double[][]
get2DArrayFromImage(BufferedImage bImage)
This method converts a BufferedImage object into a 2D array of color intensity values.static double[][]
get2DArrayFromImageIgnoringColorPixels(BufferedImage bImage)
static double[]
getArrayFromImage(BufferedImage bImage)
This method converts a BufferedImage object into a 1D array of color intensity values.
-
-
-
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)
-
-