public class Image
Image object with attributes.
Important: image pixel data copied by Image.copyPixels
must be processed within interface VisionEventsListener
callbacks on same thread or it may become unavailable.
If image processing happens later or in another thread please use Image.lockPixels
and Image.unlockPixels
methods.
Constructor and Description |
---|
Image(long peer,
ImageFormat format,
ImageSize size)
Image object with attributes.
|
Modifier and Type | Method and Description |
---|---|
boolean |
copyPixels(byte[] bytes)
Copy image pixels to ByteArray.
|
boolean |
copyPixels(java.nio.ByteBuffer bytes)
Copy image pixels to ByteBuffer. ByteBuffer must be direct.
|
void |
finalize() |
ImageFormat |
getFormat()
Image format.
|
ImageSize |
getSize()
Image size.
|
void |
lockPixels()
Lock image.
After calling this method image pixel data could be copied via
Image.copyPixels at any moment and any thread.
Image must be unlocked with Image.unlockPixels method when image data is no longer needed.
Important: if Image.unlockPixels is not called after Image.lockPixels it will lead to memory leak. |
int |
sizeInBytes() |
void |
unlockPixels()
Unlock image.
Must be called after
Image.lockPixels when image pixel data is no longer needed. |
public Image(long peer, ImageFormat format, ImageSize size)
Image object with attributes.
Important: image pixel data copied by Image.copyPixels
must be processed within interface VisionEventsListener
callbacks on same thread or it may become unavailable.
If image processing happens later or in another thread please use Image.lockPixels
and Image.unlockPixels
methods.
format
- Image format.size
- Image size.format
- Image format.size
- Image size.Image.copyPixels
,
interface VisionEventsListener
,
Image.lockPixels
,
Image.unlockPixels
public void finalize()
public boolean copyPixels(byte[] bytes)
Copy image pixels to ByteArray.
public boolean copyPixels(java.nio.ByteBuffer bytes)
Copy image pixels to ByteBuffer. ByteBuffer must be direct.
bytes
- image pixel data represented as direct ByteBuffer
public void lockPixels()
Lock image.
After calling this method image pixel data could be copied via Image.copyPixels
at any moment and any thread.
Image must be unlocked with Image.unlockPixels
method when image data is no longer needed.
Important: if Image.unlockPixels
is not called after Image.lockPixels
it will lead to memory leak.
public void unlockPixels()
Unlock image.
Must be called after Image.lockPixels
when image pixel data is no longer needed.
Image.lockPixels
public int sizeInBytes()
public ImageFormat getFormat()
Image format.
public ImageSize getSize()
Image size.