Skip to content

AI Vision

Overview

Maverick AI glasses include an on-board AI vision sensor. The SDK handles vision functionality via the M2AIVisionService (accessed from Evs.visionService).

Designed for computer vision, not photography

The AI vision sensor is optimized for machine perception - feeding frames to AI/ML models for scene understanding. It is not intended for high-quality photography or media capture.

The vision service supports three modes of operation:

Mode Config Class Description
Snapshot M2AIVisionSnapConfig Capture a single frame
Stream M2AIVisionStreamConfig Continuous frame delivery at configurable FPS
Continuous Snap M2AIVisionContinuousSnapConfig Repeated snapshots at intervals

Resolution

The frame resolution is defined using M2AIFrameResolution(w, h, decimateX2). The developer can specify any width and height within the sensor bounds. The optional decimateX2 flag captures at 2x resolution and downscales by half.

Pre-defined convenience resolutions are available via M2AIFrameResolution companion constants.

Image Format and Decoding

Frames are transmitted from the glasses in GFWX compressed format.

The SDK decodes GFWX frames internally using 16-bit debayering, producing standard RGBA bitmap data that is delivered to the application via the IM2AIFrame interface.

Usage

Starting capture (stream)

// Register for vision events first
Evs.visionService.registerListener(object : IM2AIVisionEvents {
    override fun onFrameReceived(frame: IM2AIFrame) {
        // frame.getImageBitmap() - decoded bitmap
        // frame.getWidth() / frame.getHeight() - dimensions
        frame.release() // MUST release - pool-based lifecycle
    }

    override fun onError(type: M2AIVisionService.M2AIVisionServiceErrors, message: String) {
        // handle error
    }
})

// Then start capture with desired config
val config = M2AIVisionStreamConfig(
    resolution = M2AIFrameResolution(960, 540, decimateX2 = true),
    fpsDiv = M2AIVisionStreamConfig.FpsDividers.Fps10
)
Evs.visionService.startCapture(config)

Taking a snapshot

Evs.visionService.registerListener(object : IM2AIVisionEvents {
    override fun onFrameReceived(frame: IM2AIFrame) {
        // single full-resolution frame
        frame.release()
    }

    override fun onError(type: M2AIVisionService.M2AIVisionServiceErrors, message: String) { }
})

val config = M2AIVisionSnapConfig(
    resolution = M2AIFrameResolution(1920, 1080, decimateX2 = false)
)
Evs.visionService.startCapture(config)

Stopping capture

Evs.visionService.stopCapture()

Frame Pool Lifecycle

Always release frames

AI vision frames (IM2AIFrame) are delivered from a pool of 10 reusable buffers. You must call frame.release() after processing each frame. Failing to release frames will exhaust the buffer pool and stop frame delivery.

Notes

  • The vision sensor operates on the glasses hardware; starting capture starts a hardware pipeline that consumes additional power.
  • Stop capture when not in use to save battery.
  • When streaming, lower FPS dividers reduce BLE bandwidth and power consumption.

See Also