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()