Table of Contents

Class Image

命名空间
easyar
程序集
EasyAR.Sense.dll

Image存储了图像数据,用来表示内存中的图像。 Image以字节数组的方式提供了对原始数据的访问,同时也提供了访问width/height等信息的接口。 在EasyAR Sense的所有版本中,你都可以访问图像数据。

 在iOS中可以这样访问
 ::

     #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);
     }

 在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();
     }
 </p>
public class Image : RefBase, IDisposable
继承
Image
实现
继承成员

构造函数

Image(Buffer, PixelFormat, int, int)

public Image(Buffer buffer, PixelFormat format, int width, int height)

参数

buffer
format
width
height

方法

Clone()

public Image Clone()

CloneObject()

protected override object CloneObject()

buffer()

返回图像中的数据buffer。可以使用 `Buffer`_ API访问内部数据。不应对获得的数据 `Buffer`_ 的内容进行修改,因为这些内容可能在其他线程被使用。

public virtual Buffer buffer()

create(Buffer, PixelFormat, int, int, int, int)

public static Image create(Buffer buffer, PixelFormat format, int width, int height, int pixelWidth, int pixelHeight)

参数

buffer
format
width
height
pixelWidth
pixelHeight

format()

返回图像格式。

public virtual PixelFormat format()

height()

返回图像高度。图像数据的下方会有 pixelHeight - height 像素的padding。

public virtual int height()

pixelHeight()

返回图像编码时使用的像素高度。

public virtual int pixelHeight()

pixelWidth()

返回图像编码时使用的像素宽度。

public virtual int pixelWidth()

width()

返回图像宽度。图像数据的右方会有 pixelWidth - width 像素的padding。

public virtual int width()