ImageSensorWrapper
public class ImageSensorWrapper : TransformNodeWrapperComponent-logic handle on an ImageSensor marker, exposed as Rendering.<Name>. A transform node (it can be aimed and moved like any pivot) that can photograph what is in front of it: Capture asks the host for a frame, and once FrameVersion has moved the pixel readers answer from it. The frame is the marker’s Width x Height, RGB, row-major, top row first, exactly as a camera module delivers it.
Agnostic: a line follower reads Luminance(x, 0) across one row, a reflectance sensor reads MeanLuminance of a tiny frame, a colour sensor reads Pixel, a camera module copies the whole thing out. Every reader is bounds-safe and never throws: out of range reads are black, and before the first frame everything reads zero.
Timing: call Capture from Update at whatever rate the device frames (real modules run at tens of frames per second, not the physics rate); the frame arrives one render frame later. Readers are safe from either logic entry point.
Properties you read and set
Section titled “Properties you read and set”public int Width { get; }Width of the frame in pixels (the marker’s authored width until a frame arrives).
Height
Section titled “Height”public int Height { get; }Height of the frame in pixels (the marker’s authored height until a frame arrives).
FrameVersion
Section titled “FrameVersion”public int FrameVersion { get; }Counts published frames. Compare against the value you last processed so a frame is read once, not once per Update.
HasFrame
Section titled “HasFrame”public bool HasFrame { get; }True once at least one frame has been delivered.
Methods you call
Section titled “Methods you call”Capture
Section titled “Capture”public void Capture();Ask for a frame. Rendered at the next draw and readable one frame later; asking again before it arrives is harmless (one frame is in flight at a time).
Luminance
Section titled “Luminance”public double Luminance(int x, int y);Relative luminance 0..1 of one pixel (x right, y down). Out of range or no frame = 0.
public Color Pixel(int x, int y);One pixel’s colour (components 0..1, alpha 1). Out of range or no frame = black.
MeanLuminance
Section titled “MeanLuminance”public double MeanLuminance();Mean relative luminance 0..1 of the whole frame - the single number a reflectance sensor or a light-level camera reduces to.
public double MeanLuminance(int x0, int y0, int x1, int y1);Mean relative luminance of the rectangle [x0, x1) x [y0, y1), clamped to the frame - one cell of an optical array, one side of a line sensor.
CopyPixels
Section titled “CopyPixels”public int CopyPixels(byte[] rgb);Copy the frame (RGB8, row-major, top row first) into rgb. Returns the number of bytes written (0 when there is no frame or the buffer is too small: it needs Width x Height x 3).
Generated from the CRUMB source, commit fcec660d, 2026-10-29.

