Skip to main content

Vision element flat

This is the base class for all vision elements, all will have the functions defined in this class. All other vision elements inherit from this abstract class.

class Image {
/** Create an empty invalid image */
constructor();
/** Create a valid image initialized with zeros */
constructor(width: number, height: number, pixelformat: EPixelFormat);
/** Create a valid image initialized with external data */
constructor(width: number, height: number, pixelformat: EPixelFormat, data: ArrayBuffer);

pixelformat(): EPixelFormat;
width(): number;
height(): number;
/** Returns the size of the image data in bytes */
byteSize(): number;
pixelCount(): number;
channelCount(): number;
bytesPerPixel(): number;
bitsPerPixel(): number;

/** Sets a new frame on the image, will throw if not valid */
setFrame(frame: Rect2d): void;
/** Returns a copy of the image frame */
getFrame(): Rect2d;
/** Set frame size equal full image size */
resetFrame(): void;

/**
* Returns a copy of the raw data as an array buffer that can be cast into a
* data view depending on the underlying type of the image
*/
copyBuffer(): ArrayBuffer;

/** Approximate size in memory of the object, not the same as the size of the image data */
allocatedSize(): number;

/**
* Copies the image data if it is owned, otherwise creates a new image pointing
* to the same external data
*/
clone(): Image;

/** Returns true if the data contained in the image represents a valid image */
isValid(): boolean;

// Props

timestamp: number;
opacity: number;
color: string;
colormode: EImageColormode;
transparency: EImageTransparency;
normalization: EImageNormalization;
normalizeMin: number;
normalizeMax: number;
}