MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MyCaffe.basecode.ImageData Class Reference

The ImageData class is a helper class used to convert between Datum, other raw data, and Images such as a Bitmap. More...

Static Public Member Functions

static Datum GetImageData (Bitmap bmp, SimpleDatum sd, bool? bIsDataRealOverride=null, int[] rgFocusMap=null)
 The GetImageData function converts a Bitmap into a Datum. More...
 
static Datum GetImageDataD (Bitmap bmp, int nChannels, bool bDataIsReal, int nLabel, bool bUseLockBitmap=true, int[] rgFocusMap=null)
 The GetImageDataD function converts a Bitmap into a Datum using the double type for real data. More...
 
static Datum GetImageDataF (Bitmap bmp, int nChannels, bool bDataIsReal, int nLabel, bool bUseLockBitmap=true, int[] rgFocusMap=null)
 The GetImageDataF function converts a Bitmap into a Datum using the float type for real data. More...
 
static Datum GetImageData< T > (T[] rgData, int nChannels, int nHeight, int nWidth, bool bDataIsReal, int nStartIdx=0, int nCount=-1)
 The GetImageData function converts an array of type 'T' into a Datum. More...
 
static Bitmap GetImageAtChannel (SimpleDatum d, int nChannel, ColorMapper clrMap=null, List< int > rgClrOrder=null)
 Converts a SimplDatum (or Datum) into an image, optionally using a ColorMapper. More...
 
static Bitmap GetImage (SimpleDatum d, ColorMapper clrMap=null, List< int > rgClrOrder=null)
 Converts a SimplDatum (or Datum) into an image, optionally using a ColorMapper. More...
 
static Bitmap GetImage (List< Result > rg, Size sz, ColorMapper clrMap)
 Converts a list of KeyValuePairs into an image using a ColorMapper. More...
 
static int[] LoadFocusMap (string strImgFile)
 Load a black/white image as a focus map where any area not colored black is attributed focus. The resulting map is used to mask out all other data in the actual data images. More...
 

Detailed Description

The ImageData class is a helper class used to convert between Datum, other raw data, and Images such as a Bitmap.

Definition at line 13 of file ImageData.cs.

Member Function Documentation

◆ GetImage() [1/2]

static Bitmap MyCaffe.basecode.ImageData.GetImage ( List< Result rg,
Size  sz,
ColorMapper  clrMap 
)
static

Converts a list of KeyValuePairs into an image using a ColorMapper.

Parameters
rgSpecifies a KeyValuePair where the Value is converted to a color.
szSpecifies the size of the image.
clrMapSpecifies a color mapper to use when converting each value into a color.
Returns
The Image of the data is returned.

Definition at line 651 of file ImageData.cs.

◆ GetImage() [2/2]

static Bitmap MyCaffe.basecode.ImageData.GetImage ( SimpleDatum  d,
ColorMapper  clrMap = null,
List< int >  rgClrOrder = null 
)
static

Converts a SimplDatum (or Datum) into an image, optionally using a ColorMapper.

Parameters
dSpecifies the Datum to use.
clrMapOptionally, specifies a color mapper to use when converting each value into a color (default = null, not used).
rgClrOrderOptionally, specifies the color ordering. Note, this list must have the same number of elements as there are channels.
Returns
The Image of the data is returned.

Definition at line 506 of file ImageData.cs.

◆ GetImageAtChannel()

static Bitmap MyCaffe.basecode.ImageData.GetImageAtChannel ( SimpleDatum  d,
int  nChannel,
ColorMapper  clrMap = null,
List< int >  rgClrOrder = null 
)
static

Converts a SimplDatum (or Datum) into an image, optionally using a ColorMapper.

Parameters
dSpecifies the Datum to use.
nChannelSpecifies to only use the data along a given channel to color the image.
clrMapOptionally, specifies a color mapper to use when converting each value into a color (default = null, not used).
rgClrOrderOptionally, specifies the color ordering. Note, this list must have the same number of elements as there are channels.
Returns
The Image of the data is returned.

Definition at line 371 of file ImageData.cs.

◆ GetImageData()

static Datum MyCaffe.basecode.ImageData.GetImageData ( Bitmap  bmp,
SimpleDatum  sd,
bool?  bIsDataRealOverride = null,
int[]  rgFocusMap = null 
)
static

The GetImageData function converts a Bitmap into a Datum.

Parameters
bmpSpecifies the Bitmap containing the image.
sdSpecifies the SimpleDatum that defines the channels, 'IsDataReal' and label settings.
bIsDataRealOverrideOptionally, specifies an override for the 'IsDataReal' setting.
rgFocusMapSpecifies a focus map previously loaded with LoadFocusMap.
Returns
The Datum representing the image is returned.

Definition at line 23 of file ImageData.cs.

◆ GetImageData< T >()

static Datum MyCaffe.basecode.ImageData.GetImageData< T > ( T[]  rgData,
int  nChannels,
int  nHeight,
int  nWidth,
bool  bDataIsReal,
int  nStartIdx = 0,
int  nCount = -1 
)
static

The GetImageData function converts an array of type 'T' into a Datum.

Parameters
rgDataSpecifies the array of type 'T'.
nChannelsSpecifies the number of channels contained in the Bitmap (e.g. 3 = color, 1 = black and white).
nHeightSpecifies the height of the data.
nWidthSpecifies the width of the data.
bDataIsRealSpecifies whether or not to add each color to the List of double or to the list of byte. Using the byte array is more common for it already separates a 3 color Bitmap into 3 channels of data.
nStartIdxSpecifies where to start the conversion within the data.
nCountSpecifies the number of items within the data to convert.
Returns
The Datum representing the image is returned.

Definition at line 319 of file ImageData.cs.

◆ GetImageDataD()

static Datum MyCaffe.basecode.ImageData.GetImageDataD ( Bitmap  bmp,
int  nChannels,
bool  bDataIsReal,
int  nLabel,
bool  bUseLockBitmap = true,
int[]  rgFocusMap = null 
)
static

The GetImageDataD function converts a Bitmap into a Datum using the double type for real data.

Parameters
bmpSpecifies the Bitmap containing the image.
nChannelsSpecifies the number of channels contained in the Bitmap (e.g. 3 = color, 1 = black and white).
bDataIsRealSpecifies whether or not to add each color to the List of double or to the list of byte. Using the byte array is more common for it already separates a 3 color Bitmap into 3 channels of data.
nLabelSpecifies the known label.
bUseLockBitmapOptionally, use the Lock Bitmap which is faster but may produce corrupted images in a few scenarios (default = true).
rgFocusMapOptionally, specifies a focus map where values = 1 are used, and all other values are masked out to 0.
Returns
The Datum representing the image is returned.

Definition at line 44 of file ImageData.cs.

◆ GetImageDataF()

static Datum MyCaffe.basecode.ImageData.GetImageDataF ( Bitmap  bmp,
int  nChannels,
bool  bDataIsReal,
int  nLabel,
bool  bUseLockBitmap = true,
int[]  rgFocusMap = null 
)
static

The GetImageDataF function converts a Bitmap into a Datum using the float type for real data.

Parameters
bmpSpecifies the Bitmap containing the image.
nChannelsSpecifies the number of channels contained in the Bitmap (e.g. 3 = color, 1 = black and white).
bDataIsRealSpecifies whether or not to add each color to the List of double or to the list of byte. Using the byte array is more common for it already separates a 3 color Bitmap into 3 channels of data.
nLabelSpecifies the known label.
bUseLockBitmapOptionally, use the Lock Bitmap which is faster but may produce corrupted images in a few scenarios (default = true).
rgFocusMapOptionally, specifies a focus map where values = 1 are used, and all other values are masked out to 0.
Returns
The Datum representing the image is returned.

Definition at line 181 of file ImageData.cs.

◆ LoadFocusMap()

static int[] MyCaffe.basecode.ImageData.LoadFocusMap ( string  strImgFile)
static

Load a black/white image as a focus map where any area not colored black is attributed focus. The resulting map is used to mask out all other data in the actual data images.

Parameters
strImgFileSpecifies the black and white focus image.
Returns
Returns a list of integers in the form WWWWW1 WWWWW2 ... WWWWWH

Definition at line 758 of file ImageData.cs.


The documentation for this class was generated from the following file: