Skip to main content

CameraController Class

NuGet: GHIElectronics.TinyCLR.Devices.Camera
Assembly: GHIElectronics.TinyCLR.Devices.Camera
Namespace: GHIElectronics.TinyCLR.Devices.Camera

Represents a DCMI / parallel camera interface. Configure timing via SetActiveSettings, Enable the capture engine, then call Capture(byte[], int) to read a frame into a buffer.

public class CameraController : IDisposable

Properties​

Provider​

public ICameraControllerProvider Provider { get; }

The low-level provider backing this controller.

Methods​

GetDefault()​

public static CameraController GetDefault()

Returns the default camera controller for this device.

Returns CameraController

FromName(string name)​

public static CameraController FromName(string name)

Returns a camera controller identified by its native API name.

Returns CameraController

FromProvider(ICameraControllerProvider provider)​

public static CameraController FromProvider(ICameraControllerProvider provider)

Creates a controller from a custom ICameraControllerProvider.

Returns CameraController

Dispose()​

public void Dispose()

Releases the underlying provider.

SetActiveSettings(CaptureRate captureRate, bool horizontalSyncPolarity, bool verticalSyncPolarity, bool pixelClockPolarity, SynchronizationMode synchronizationMode, ExtendedDataMode extendedDataMode, uint sourceClock)​

public void SetActiveSettings(CaptureRate captureRate, bool horizontalSyncPolarity, bool verticalSyncPolarity, bool pixelClockPolarity, SynchronizationMode synchronizationMode, ExtendedDataMode extendedDataMode, uint sourceClock)

Applies a complete set of DCMI timing/protocol settings.

ParameterTypeDescription
captureRateCaptureRatePer-frame capture rate.
horizontalSyncPolarityboolHSYNC polarity (false = active low).
verticalSyncPolarityboolVSYNC polarity (false = active low).
pixelClockPolarityboolPixel-clock polarity (false = falling-edge sample).
synchronizationModeSynchronizationModeHardware vs. embedded synchronization.
extendedDataModeExtendedDataModeData bus width.
sourceClockuintSource clock feeding the camera, in Hz.

Capture(byte[] data, int timeoutMillisecond)​

public int Capture(byte[] data, int timeoutMillisecond)

Captures one frame into the supplied buffer.

ParameterTypeDescription
databyte[]Destination buffer. Must be large enough for one frame at the configured resolution/format.
timeoutMillisecondintMaximum time to wait for the frame, in milliseconds.

Returns int — Number of bytes actually captured.

Capture(byte[] data, int offset, int count, int timeoutMillisecond)​

public int Capture(byte[] data, int offset, int count, int timeoutMillisecond)

Captures one frame into a slice of the buffer.

Returns int

Enable()​

public void Enable()

Powers on the capture engine.

Disable()​

public void Disable()

Powers off the capture engine.