VisionConfig Reference
Fields of the VisionConfig structure passed to Vision.begin, with defaults and semantics.
VisionConfig is the configuration structure accepted by Vision.begin(). Most fields apply to both sensors; af is OV5640 only and isp_enabled is VD66GY only, as noted in the table. Its constructor assigns every field, so a freshly declared instance is valid. Fields are set individually; the structure is not brace-initialised.
VisionConfig cfg;
cfg.camera = CAMERA_VGA;
cfg.fps = FPS_30;
cfg.transport = TRANSPORT_USB;
Vision.begin(&NN_Instance_yolov8_iseg, PostProcess_YOLOv8_ISEG(0.4f, 0.5f), cfg);Fields
| Field | Default | Meaning |
|---|---|---|
camera | CAMERA_WVGA | Sensor output mode. See Resolutions and Frame Rates |
fps | FPS_DEFAULT | Frame rate, clamped to the mode's maximum. On TRANSPORT_LCD also the panel refresh |
mirror_flip | CAMERA_AUTO_FLIP | Orientation. Auto selects per carrier. Alternatives: CAMERA_MIRROR_FLIP_NONE, CAMERA_FLIP, CAMERA_MIRROR, CAMERA_MIRROR_FLIP |
nn.width, nn.height | 256, 256 | Model input size in pixels |
nn.aspect | ASPECT_STRETCH | Mapping of the camera frame into the model input |
nn.crop_x, nn.crop_y, nn.crop_w, nn.crop_h | 0 | Crop rectangle in camera pixels. Read only under ASPECT_CROP_OFFSET |
nn.max_fps | 0 (uncapped) | Maximum rate at which Vision.run() performs inference |
transport | TRANSPORT_USB | Destination of the video |
lcd | false | Also show the image on the display while using a host transport |
af | AF_DISABLED | OV5640 only. Autofocus mode: AF_SINGLE, AF_CONTINUOUS. Ignored on the VD66GY |
strobe | STROBE_DISABLED | Both sensors. Flash LED synchronised to exposure |
isp_enabled | isp_tuning_disabled | VD66GY only. ISP tuning: VD66_isp_tuning_auto, VD66_isp_tuning_manual. Ignored on the OV5640 |
band_loc | N6_MEM_AUTO | Location of the encoder line buffer |
framebuf_loc | N6_MEM_AUTO | Location of the display framebuffer |
Neural network pipe
The camera frame reaches the model through a hardware pipe that crops and scales it. nn.width and nn.height are the model's input dimensions and must match the model. The bundled YOLOv8 and Nia models take 256x256, the palm detector 192x192 and the face detector 128x128.
nn.aspect selects how a rectangular frame is fitted to the input:
| Value | Behaviour |
|---|---|
ASPECT_STRETCH | The whole frame is scaled non-uniformly into the input. Full field of view with distortion |
ASPECT_CROP_CENTER | The largest centred rectangle with the input's aspect ratio is scaled uniformly. No distortion; the sides are excluded from the model but remain in the stream and on the display |
ASPECT_CROP_OFFSET | The rectangle given by nn.crop_* is used |
Under ASPECT_CROP_OFFSET the rectangle must lie within the camera frame and be at least the model input size, because the pipe only downsizes. A rectangle violating either bound is rewritten and a single [VISION WARN] crop clamped line names the reason. Values are rounded down to even numbers.
Post-processors map results back to the full camera frame under every mode. See Aspect Modes and Coordinates.
nn.max_fps limits how often Vision.run() performs inference. The camera and video continue at cfg.fps; only the inference pass and its overlay refresh are skipped, with a short yield. It was introduced for the thermal camera, whose video link has a hard deadline and lost frames when a model ran at 45 fps. It applies to Vision.run() only; runWith() and runRoi() callers control their own cadence.
Transport
| Value | Destination | Requirement |
|---|---|---|
TRANSPORT_USB | Neuro Studio over USB | None |
TRANSPORT_WIFI_SOFTAP | Neuro Studio over a network hosted by the board | #include <MayaW476.h> |
TRANSPORT_WIFI_STA | Neuro Studio over an existing network | #include <MayaW476.h> |
TRANSPORT_LCD | The on-board panel, no host video | TFT carrier, mode at or below WVGA |
The destinations are mutually exclusive. Under TRANSPORT_LCD the JPEG encoder is not started. The serial console is available under every transport. A WiFi transport without the library, or on a board without the module, falls back to USB with a warning.
lcd = true shows the image and overlay on the panel while a host transport is active. It requires the TFT carrier and a mode at or below WVGA. The panel and the encoder share the PSRAM bus, and the panel may tear under load.
Memory placement
band_loc and framebuf_loc accept N6_MEM_AUTO, N6_MEM_AXISRAM and N6_MEM_PSRAM. Auto prefers on-chip AXISRAM and falls back to PSRAM when the buffer does not fit. AXISRAM forces on-chip placement and fails at begin() if the buffer does not fit. PSRAM forces external placement.
band_loc places the encoder line buffer used by USB and WiFi transports. On-chip placement keeps the encoder's reads off the external bus.
framebuf_loc places the camera framebuffer under TRANSPORT_LCD, about 750 KB at WVGA. On-chip placement keeps the camera's traffic off the bus the display reads from and reduces tearing. The overlay layer is always in PSRAM.
begin overloads
| Call | Use |
|---|---|
Vision.begin(model, pp) | One model, default configuration |
Vision.begin(model, pp, cfg) | One model, explicit configuration |
Vision.begin() or Vision.begin(cfg) | No bound model. Camera-only sketches, or sketches that dispatch through runWith() |
Vision.beginRawOnly(model) | Camera, NPU and USB with no post-processor. Paired with runRaw() |
Fixed after begin
Resolution, frame rate, transport and buffer placement are fixed at begin(). The model's crop can change per pass through runRoi(). Exposure, gain, white balance, focus and strobe can change at any time through the camera object.