Image🔗

class Image(width, height, type, buffer, byteOffset)🔗

An image. Corresponds to the va_image C type.

Creates a new image with the given width and height. If buffer is given, the image will reference data in it. Optionally, a non-zero byteOffset can be given to move the upper left pixel to any position in buffer.

Arguments
  • width (number) –

  • height (number) –

  • type (number) –

  • buffer (BufferSource) –

  • byteOffset (number) –

Image.cameraFrame🔗

type: CoordinateFrame

Image.cameraParameters🔗

type: CameraParameters

Image.data🔗

type: TypedArray

Image.dimensions🔗

type: Uint32Array

Image.focalLength🔗

type: Point2D

Image.height🔗

type: number

Image.info🔗

type: MdArrayInfo

Image.principalPoint🔗

type: Point2D

Image.sensorType🔗

type: number

Image.width🔗

type: number

Image.worldFrame🔗

type: CoordinateFrame

Image.Type🔗

type: Readonly<AnyObject>

Image.elementCount()🔗

Returns the total number of elements in the array.

Returns

number –

Image.entry(row, column)🔗
Arguments
  • row (number) –

  • column (number) –

Returns

number –

Image.equals(other)🔗
Arguments
  • other (any) –

Returns

boolean –

Image.forEach(callback)🔗
Arguments
  • reflection> callback (<TODO:) –

Image.pixel(x, y)🔗
Arguments
  • x (number) –

  • y (number) –

Returns

number –

Image.setEntry(row, column, value)🔗
Arguments
  • row (number) –

  • column (number) –

  • value (number) –

Image.setPixel(x, y, value)🔗
Arguments
  • x (number) –

  • y (number) –

  • value (number) –

Image.toBlob()🔗

Returns the data buffer as a compressed Blob. If the buffer is already compressed, returns it as such. If not, converts it to a PNG.

Returns

Promise<Blob> –

Image.toHtmlImage(htmlImage)🔗

Converts the image to a Blob and puts it as data to the given htmlImage. If htmlImage is not given, creates a new HTML image element.

Arguments
  • htmlImage (HTMLImageElement) –

Returns

Promise<HTMLImageElement> –

Image.toImageData(context)🔗

Converts the image to an ImageData for drawing on a Canvas. The function needs a rendering context that provides a createImageData() function. If context is not given, it will be created using the HTML5 Canvas API, which may not be available in a Node.js environment.

Arguments
  • context (CanvasRenderingContext2D) –

Returns

ImageData –

Image.toIndex(indices)🔗

Flattens a multi-dimensional array index to one-dimensional index for array look-up.

Arguments
  • indices (NumericArray) –

Returns

number –

Image.transform(callback)🔗
Arguments
  • reflection> callback (<TODO:) –

Image.write(stream)🔗
Arguments
  • stream (default) –

Image.fromBlob(blob, type=...)🔗

Creates an Image object out of a Blob. This function loads the blob to an HTML Image element to make it accessible as an image. If type is Rgb32 or Argb32, the image will be drawn onto a canvas, whose pixel buffer will be transferred to the returned Image object. If type is Compressed or undefined, the data buffer in the blob will be used as such.

Due to the asynchronous nature of loading the HTML Image, the function returns a promise that resolves with the new Image once the operation is done.

This function only works in a browser environment.

Arguments
  • blob (Blob) –

  • type (number) –

Returns

Promise<Image> –

Image.fromHtmlImage(htmlImg, type=...)🔗

Creates a new Image object from the pixel data in htmlImg. The type of the image can be either Compressed, Rgb32 or Argb32.

Arguments
  • htmlImg (HTMLImageElement) –

  • type (number) –

Returns

Image –

Image.fromImageData(imageData)🔗

Creates an Image out of an ImageData object. This function converts the data buffer of imageData from big-endian RGBA to BGRA and returns a new Argb32 image.

Arguments
  • imageData (ImageData) –

Returns

Image –

Image.fromUrl(url)🔗

Asynchronously loads url to a new compressed Image object.

Arguments
  • url (string) –

Returns

Promise<Image> –

Image.htmlImageFromBlob(blob, htmlImg)🔗

Loads image data from blob to an HTML img element. If htmlImg is not given, a new element will be created.

Arguments
  • blob (Blob) –

  • htmlImg (HTMLImageElement) –

Returns

Promise<HTMLImageElement> –

Image.read(stream)🔗
Arguments
  • stream (default) –

Returns

Image –