documentation

VLImageWrapper Class Reference

The VLImageWrapper is a wrapper for an Image object. More...

Inherits IDisposable.

Public Member Functions

 VLImageWrapper (IntPtr handle, bool owner)
 Constructor of VLImageWrapper. More...
 
 VLImageWrapper (byte[] vlImage, int width, int height)
 
VLImageWrapper Clone ()
 Creates a copy of this object and returns a Wrapper of it. More...
 
bool CopyFromBuffer (byte[] buffer, int width, int height)
 Copies the given byte array into the VisionLib image. More...
 
bool CopyToBuffer (byte[] buffer)
 Copies the VisionLib image into the given byte array. More...
 
void Dispose ()
 Explicitly releases references to unmanaged resources. More...
 
int GetBytesPerPixel ()
 Returns the number of bytes per pixel. More...
 
VLUnitySdk.ImageFormat GetFormat ()
 Returns an enumeration with the internal type of the image. More...
 
IntPtr getHandle ()
 
int GetHeight ()
 Returns the height of the image. More...
 
int GetWidth ()
 Returns the width of the image. More...
 

Static Public Member Functions

static VLImageWrapper CreateFromTexture (Texture2D texture, ref byte[] byteBuffer)
 
static VLImageWrapper CreateFromTexture (Texture2D texture)
 
static VLImageWrapper CreateFromTexture (WebCamTexture texture, ref byte[] byteBuffer)
 
static VLImageWrapper CreateFromTexture (WebCamTexture texture)
 

Detailed Description

The VLImageWrapper is a wrapper for an Image object.

See also
VLDataSetWrapper.GetImage

Constructor & Destructor Documentation

◆ VLImageWrapper()

VLImageWrapper.VLImageWrapper ( IntPtr  handle,
bool  owner 
)
inline

Constructor of VLImageWrapper.

Don't call this constructor directly. Use the VLAbstractApplicationWrapper.GetDataSet and VLDataSetWrapper.GetImage methods instead.

Parameters
handleHandle to the native object.
ownertrue, if the VLImageWrapper is the owner of the native object; false, otherwise.

Member Function Documentation

◆ Clone()

VLImageWrapper VLImageWrapper.Clone ( )
inline

Creates a copy of this object and returns a Wrapper of it.

Returns
A wrapper of a copy of this object.

◆ CopyFromBuffer()

bool VLImageWrapper.CopyFromBuffer ( byte []  buffer,
int  width,
int  height 
)
inline

Copies the given byte array into the VisionLib image.

The VisionLib image will be resized according to the width and height parameter.

Please make sure, that the data stored in the byte array has the same format as the image. The image format can be acquired using the GetFormat function.

Returns
true, if the data was copied into the image successfully; false otherwise.
Parameters
bufferByte array with the image data.
widthNew width of the image.
heightNew height of the image.

◆ CopyToBuffer()

bool VLImageWrapper.CopyToBuffer ( byte []  buffer)
inline

Copies the VisionLib image into the given byte array.

Please make sure, that the byte array is large enough for storing the whole image date (width * height * bytesPerPixel). The number of bytes per pixel an be acquired using the GetBytesPerPixel function.

Returns
true, if the data was copied to the byte array successfully; false otherwise.
Parameters
bufferByte array for storing the raw image data.

◆ Dispose()

void VLImageWrapper.Dispose ( )
inline

Explicitly releases references to unmanaged resources.

Call Dispose when you are finished using the VLImageWrapper. The Dispose method leaves the VLImageWrapper in an unusable state. After calling Dispose, you must release all references to the VLImageWrapper so the garbage collector can reclaim the memory that the VLImageWrapper was occupying.

◆ GetBytesPerPixel()

int VLImageWrapper.GetBytesPerPixel ( )
inline

Returns the number of bytes per pixel.

Returns
The number of bytes per pixel.

◆ GetFormat()

VLUnitySdk.ImageFormat VLImageWrapper.GetFormat ( )
inline

Returns an enumeration with the internal type of the image.

Returns
VLUnitySdk.ImageFormat enumeration with the internal type of the image.

◆ GetHeight()

int VLImageWrapper.GetHeight ( )
inline

Returns the height of the image.

Returns
The height in pixels.

◆ GetWidth()

int VLImageWrapper.GetWidth ( )
inline

Returns the width of the image.

Returns
The width in pixels.