Class Image
- Namespace
- easyar
- Assembly
- EasyAR.Sense.dll
Image stores image data to represent an image in memory. Image provides access to raw data in the form of a byte array and also provides interfaces to access information such as width/height. Image data can be accessed in all versions of EasyAR Sense.
To access it in iOS, you can do the following:
::
#import <easyar/buffer.oc.h>
#import <easyar/image.oc.h>
easyar_OutputFrame * outputFrame = [outputFrameBuffer peek];
if (outputFrame != nil) {
easyar_Image * i = [[outputFrame inputFrame] image];
easyar_Buffer * b = [i buffer];
char * bytes = calloc([b size], 1);
memcpy(bytes, [b data], [b size]);
// use bytes here
free(bytes);
}
To access it in Android, you can do the following:
::
import cn.easyar.*;
OutputFrame outputFrame = outputFrameBuffer.peek();
if (outputFrame != null) {
InputFrame inputFrame = outputFrame.inputFrame();
Image i = inputFrame.image();
Buffer b = i.buffer();
byte[] bytes = new byte[b.size()];
b.copyToByteArray(0, bytes, 0, bytes.length);
// use bytes here
b.dispose();
i.dispose();
inputFrame.dispose();
outputFrame.dispose();
}
public class Image : RefBase, IDisposable
- Inheritance
-
Image
- Implements
- Inherited Members
Constructors
Image(Buffer, PixelFormat, int, int)
public Image(Buffer buffer, PixelFormat format, int width, int height)
Parameters
bufferformatwidthheight
Methods
Clone()
public Image Clone()
Returns
CloneObject()
protected override object CloneObject()
Returns
buffer()
Returns the data buffer of the image. Internal data can be accessed using the `Buffer`_ API. Do not modify the content of the obtained data `Buffer`_ as it may be used in other threads.
public virtual Buffer buffer()
Returns
create(Buffer, PixelFormat, int, int, int, int)
public static Image create(Buffer buffer, PixelFormat format, int width, int height, int pixelWidth, int pixelHeight)
Parameters
bufferformatwidthheightpixelWidthpixelHeight
Returns
format()
Returns the image format.
public virtual PixelFormat format()
Returns
height()
Returns the image height. There will be padding of (pixelHeight - height) pixels below the image data.
public virtual int height()
Returns
pixelHeight()
Returns the pixel height used when encoding the image.
public virtual int pixelHeight()
Returns
pixelWidth()
Returns the pixel width used when encoding the image.
public virtual int pixelWidth()
Returns
width()
Returns the image width. There will be padding of (pixelWidth - width) pixels on the right side of the image data.
public virtual int width()