Click or drag to resize
Accord.NET (logo)

ImageToArray Class

Bitmap to jagged array converter.
Inheritance Hierarchy
SystemObject
  Accord.Imaging.ConvertersImageToArray

Namespace:  Accord.Imaging.Converters
Assembly:  Accord.Imaging (in Accord.Imaging.dll) Version: 3.8.0
Syntax
public class ImageToArray : IConverter<Bitmap, double[]>, 
	IConverter<UnmanagedImage, double[]>, IConverter<Bitmap, double[][]>, 
	IConverter<UnmanagedImage, double[][]>, IConverter<Bitmap, float[]>, 
	IConverter<UnmanagedImage, float[]>, IConverter<Bitmap, float[][]>, 
	IConverter<UnmanagedImage, float[][]>, IConverter<Bitmap, Color[]>, 
	IConverter<UnmanagedImage, Color[]>
Request Example View Source

The ImageToArray type exposes the following members.

Constructors
  NameDescription
Public methodImageToArray
Initializes a new instance of the ImageToArray class.
Public methodImageToArray(Double, Double)
Initializes a new instance of the ImageToArray class.
Public methodImageToArray(Double, Double, Int32)
Initializes a new instance of the ImageToArray class.
Top
Properties
  NameDescription
Public propertyChannel
Gets or sets the channel to be extracted.
Public propertyMax
Gets or sets the maximum double value in the double array associated with the brightest color.
Public propertyMin
Gets or sets the minimum double value in the double array associated with the darkest color.
Top
Methods
  NameDescription
Public methodConvert(Bitmap, Double)
Converts an image from one representation to another.
Public methodConvert(Bitmap, Double)
Converts an image from one representation to another.
Public methodConvert(Bitmap, Color)
Converts an image from one representation to another.
Public methodConvert(Bitmap, Single)
Converts an image from one representation to another.
Public methodConvert(Bitmap, Single)
Converts an image from one representation to another.
Public methodConvert(UnmanagedImage, Double)
Converts an image from one representation to another.
Public methodConvert(UnmanagedImage, Double)
Converts an image from one representation to another.
Public methodConvert(UnmanagedImage, Color)
Converts an image from one representation to another.
Public methodConvert(UnmanagedImage, Single)
Converts an image from one representation to another.
Public methodConvert(UnmanagedImage, Single)
Converts an image from one representation to another.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks
This class converts images to single or jagged arrays of either double-precision or single-precision floating-point values.
Examples

This example converts a 16x16 Bitmap image into a double[] array with values between 0 and 1.

// Obtain a 16x16 bitmap image
// Bitmap image = ...

// Show on screen
ImageBox.Show(image, PictureBoxSizeMode.Zoom);

// Create the converter to convert the image to an
//   array containing only values between 0 and 1 
ImageToArray conv = new ImageToArray(min: 0, max: 1);

// Convert the image and store it in the array
double[] array; conv.Convert(image, out array);

// Show the array on screen
ImageBox.Show(array, 16, 16, PictureBoxSizeMode.Zoom);    ///

The resulting image is shown below.

See Also