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...
 
IntPtr getHandle ()
 
void Dispose ()
 Explicitly releases references to unmanaged resources. More...
 
VLUnitySdk.ImageFormat GetFormat ()
 Returns an enumeration with the internal type of the image. More...
 
int GetBytesPerPixel ()
 Returns the number of bytes per pixel. More...
 
int GetWidth ()
 Returns the width of the image. More...
 
int GetHeight ()
 Returns the height of the image. More...
 
bool CopyToBuffer (byte[] buffer)
 Copies the VisionLib image into the given byte array. More...
 
bool CopyFromBuffer (byte[] buffer, int width, int height)
 Copies the given byte array into the VisionLib 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() [1/2]

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.

◆ VLImageWrapper() [2/2]

VLImageWrapper.VLImageWrapper ( byte []  vlImage,
int  width,
int  height 
)
inline

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.

◆ CreateFromTexture() [1/4]

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

◆ CreateFromTexture() [2/4]

static VLImageWrapper VLImageWrapper.CreateFromTexture ( Texture2D  texture)
inlinestatic

◆ CreateFromTexture() [3/4]

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

◆ CreateFromTexture() [4/4]

static VLImageWrapper VLImageWrapper.CreateFromTexture ( WebCamTexture  texture)
inlinestatic

◆ 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.

◆ getHandle()

IntPtr VLImageWrapper.getHandle ( )
inline

◆ 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.