Image Class¶
Description¶
Image stores an image data and represents an image in memory.
Image raw data can be accessed as byte array. The width/height/etc information are also accessible.
You can always access image data since the first version of EasyAR Sense.
You can do this in 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);
}
Or 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();
}
Constructor¶
- C
void easyar_Image__ctor(easyar_Buffer * buffer, easyar_PixelFormat format, int width, int height, easyar_Image * * Return)
- C++17
Image(std::shared_ptr<Buffer> buffer, PixelFormat format, int width, int height)
- C++03
Image(Buffer * buffer, PixelFormat format, int width, int height)
- Java
public Image(@Nonnull Buffer buffer, int format, int width, int height)
- Kotlin
constructor(buffer: Buffer, format: Int, width: Int, height: Int)
- Objective-C
+ (easyar_Image *) create:(easyar_Buffer *)buffer format:(easyar_PixelFormat)format width:(int)width height:(int)height
- Swift
public convenience init(_ buffer: Buffer, _ format: PixelFormat, _ width: Int32, _ height: Int32)
- C#
public Image(Buffer buffer, PixelFormat format, int width, int height)
buffer¶
Returns buffer inside image. It can be used to access internal data of image. The content of Buffer shall not be modified, as they may be accessed from other threads.
- C
void easyar_Image_buffer(const easyar_Image * This, easyar_Buffer * * Return)
- C++17
std::shared_ptr<Buffer> buffer()
- C++03
void buffer(Buffer * * Return)
- Java
public @Nonnull Buffer buffer()
- Kotlin
fun buffer(): Buffer
- Objective-C
- (easyar_Buffer *)buffer
- Swift
public func buffer() -> Buffer
- C#
public virtual Buffer buffer()
format¶
Returns image format.
- C
easyar_PixelFormat easyar_Image_format(const easyar_Image * This)
- C++17
PixelFormat format()
- C++03
PixelFormat format()
- Java
public int format()
- Kotlin
fun format(): Int
- Objective-C
- (easyar_PixelFormat)format
- Swift
public func format() -> PixelFormat
- C#
public virtual PixelFormat format()
width¶
Returns image width.
- C
int easyar_Image_width(const easyar_Image * This)
- C++17
int width()
- C++03
int width()
- Java
public int width()
- Kotlin
fun width(): Int
- Objective-C
- (int)width
- Swift
public func width() -> Int32
- C#
public virtual int width()
height¶
Returns image height.
- C
int easyar_Image_height(const easyar_Image * This)
- C++17
int height()
- C++03
int height()
- Java
public int height()
- Kotlin
fun height(): Int
- Objective-C
- (int)height
- Swift
public func height() -> Int32
- C#
public virtual int height()