I am trying to get a Bitmap image from a fingerprint device SDK. The SDK provided a struct for preview image, I failed to convert it to Bitmap:
public struct IBSU_ImageData
{
/* Pointer to image buffer. If this structure is supplied by a callback function, this pointer
* must not be retained; the data should be copied to an application buffer for any processing
* after the callback returns. */
public IntPtr Buffer;
/* Image horizontal size (in pixels). */
public uint Width;
/* Image vertical size (in pixels). */
public uint Height;
/* Horizontal image resolution (in pixels/inch). */
public double ResolutionX;
/* Vertical image resolution (in pixels/inch). */
public double ResolutionY;
/* Image acquisition time, excluding processing time (in seconds). */
public double FrameTime;
/* Image line pitch (in bytes). A positive value indicates top-down line order; a negative
* value indicates bottom-up line order. */
public int Pitch;
/* Number of bits per pixel. */
public byte BitsPerPixel;
/* Image color format. */
public IBSU_ImageFormat Format;
/* Marks image as the final processed result from the capture. If this is FALSE, the image is
* a preview image or a preliminary result. */
public bool IsFinal;
/* Threshold of image processing. */
public uint ProcessThres;
}
public enum IBSU_ImageFormat
{
IBSU_IMG_FORMAT_GRAY, /* Gray scale image. */
IBSU_IMG_FORMAT_RGB24, /* 24 bit RGB color image. */
IBSU_IMG_FORMAT_RGB32, /* True color RGB image. */
IBSU_IMG_FORMAT_UNKNOWN /* Unknown format. */
}
I've tried use Image.FromHbitmap(imageData) but not work.
I debug and give the IBSU_ImageData content:
Buffer : 0x1741d020
Width : 1600
Height : 1500
ResolutionX : 500
ResolutionY : 500
FrameTime : 0.100421
Pitch : -1600
BitsPerPixel : 8
Format : IBSU_IMG_FORMAT_GRAY
IsFinal : false
ProcessThres : 2