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, selected by the M2CaptureOptions passed to startCapture:

Mode Options Class Description
Still M2StillOptions Camera stays ready; one frame is delivered per takePicture()
Continuous M2ContinuousOptions Independent photographs, the next requested as soon as the previous arrives
Video M2VideoOptions.TargetBandwidth / M2VideoOptions.FixedQuality Continuous stream with a capture-rate ceiling (M2CaptureRate)

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 (e.g. RES_1920x1080, RES_960x540_x2, RES_640x480_x2).

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

// Register for vision events first
Evs.visionService.registerListener(object : IM2AIVisionEvents {
    override fun onCaptureStateChanged(isOn: Boolean) { }

    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.Errors, message: String) {
        // handle error
    }
})

// Then start capture with the desired options
val options = M2ContinuousOptions(
    resolution = M2AIFrameResolution.RES_960x540_x2
)
Evs.visionService.startCapture(options)

Taking a snapshot

Evs.visionService.registerListener(object : IM2AIVisionEvents {
    override fun onCaptureStateChanged(isOn: Boolean) { }

    override fun onFrameReceived(frame: IM2AIFrame) {
        // single full-resolution frame
        frame.release()
    }

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

Evs.visionService.startCapture(
    M2StillOptions(resolution = M2AIFrameResolution.RES_1920x1080)
)
// The camera stays ready - request one frame at a time:
Evs.visionService.takePicture()

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.
  • For video, a lower M2CaptureRate (or a lower TargetBandwidth) reduces BLE bandwidth and power consumption.

See Also