Luxand FaceSDK – Using CImage class in .NET

CImage is a class for Microsoft .NET for easy manipulation of images. CImage encapsulates an HImage handle and provides convenient methods for applying FaceSDK functions to that image.

To start working with CImage, just create an instance of it. You can pass a file path, HImage handle, HBITMAP handle or System.Drawing.Image object to the constructor to load the corresponding object into the image. Alternatively, call the constructor without parameters to create an empty image. Refer to the functions FSDK_LoadImageFromFile, FSDK_LoadImageFromHBitmap, FSDK.LoadImageFromCLRImage and FSDK_CreateEmptyImage for further details.

A CImage instance has three properties: ImageHandle, Width and Height. ImageHandle is a handle of the internal representation of the image encapsulated by the class. Width and Height properties are the width and height of an image in pixels (see FSDK_GetImageWidth and FSDK_GetImageHeight). If you alter the ImageHandle handle directly (for example, executing an FSDK. method applied to that image handle), you must update the CImage object by calling the CImage.ReloadFromHandle() method. CImage throws an exception if any FaceSDK function, called within the CImage method, has returned an error.

Most CImage methods operating with an image (for example, the Resize() method) return the processed image as the result.

The CImage destructor releases ImageHandle, so there is no need to call FSDK.FreeImage explicitly after the instance has been destroyed.

Note that when you pass an existing image handle to the constructor, it will be freed after the destruction of the CImage class instance, and become invalid. If you need the original image handle to be valid after the CImage class instance is destroyed, consider creating a copy of the image handle and passing the copy to the CImage constructor.

CImage();

Creates an empty CImage instance.

Syntax:

FSDK.CImage();

CImage(Int);

Creates a CImage instance from image already loaded to FaceSDK.

Syntax:

FSDK.CImage(int ImageHandle);

Parameters:

ImageHandle – the internal handle of an image already loaded to FaceSDK. The destructor will free the ImageHandle handle.

CImage.ReloadFromHandle();

Updates the internal properties of a CImage instance in accordance with the ImageHandle.

Syntax:

FSDK.CImage.ReloadFromHandle();

 

Next chapterUsing with C/C++

Contents

Get in touch

Luxand, Inc.
815 N. Royal St. Suite 202
Alexandria, VA
22314
USA
Freephone:
+1 800 471 5636

Join our newsletter

And always stay informed of the latest company news and events!

Sign up >>

DMCA.com Protection Status