Class Image
- Namespace
- easyar
- Assembly
- EasyAR.Sense.dll
Image stores image data, used to represent images in memory. Image provides access to raw data in the form of a byte array, and also provides an interface to access information such as width/height. In all versions of EasyAR Sense, you can access image data.
In iOS, you can access it like this ::
#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); }
In Android, ::
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 in the image. You can use the `Buffer`_ API to access the internal data. 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 to the right of the image data.
public virtual int width()