Published
Oct 18, 2025
1y ago
Total Downloads
2.1K
2,063
Install
dotnet add package CameraInterface --version 2.1.0
| Product | Versions |
|---|---|
| .NET |
README
CameraInterface
A lightweight .NET library providing a clean abstraction for working with camera devices and image data. It defines common camera properties, supported pixel formats.
Features
- π₯ Camera Abstraction β Provides the
ICamerainterface with common properties (resolution, offsets, ranges, exposure, and image format). - πΌ Image Data Handling β Encapsulates pixel buffers in the
ImageDatastruct with width, height, stride, and format metadata. - π§© Supported Formats β Multiple pixel formats such as Mono8, Mono16, Rgb24, Rgb32, Raw8, Raw16.
- β‘ Zero-Copy Parsing β Optimized APIs like
TryFromMemoryavoid unnecessary allocations when possible. - β± Units Integration β Exposure times use UnitsNet for type-safe duration handling.
Installation
Add the project or library to your solution. If published as a NuGet package, install via:
dotnet add package CameraInterface
Usage
Implementing a Camera
using CameraInterface;
using UnitsNet;
public class DummyCamera : ICamera
{
public int Width { get; set; } = 640;
public int Height { get; set; } = 480;
public int XOffset { get; set; } = 0;
public int YOffset { get; set; } = 0;
public (int Min, int Max) WidthRange { get; set; } = (320, 1920);
public (int Min, int Max) HeightRange { get; set; } = (240, 1080);
public (int Min, int Max) XOffsetRange { get; set; } = (0, 100);
public (int Min, int Max) YOffsetRange { get; set; } = (0, 100);
public CameraImageFormat ImageFormat { get; set; } = CameraImageFormat.Rgb24;
public Duration Exposure { get; set; } = Duration.FromMilliseconds(10);
public ImageData GetImage()
{
// Provide pixel data from the camera here
var pixels = new byte[Width * Height * 3]; // Rgb24 = 3 bytes per pixel
return new ImageData(pixels, Width, Height, Width * 3, ImageFormat);
}
}
Supported Image Formats
- Mono8 β 8-bit grayscale
- Mono16 β 16-bit grayscale
- Rgb24 β 24-bit RGB
- Rgb32 β 32-bit RGB (with alpha or padding)
License
MIT License β free to use, modify, and distribute.
Changes from Previous Version
No structural changes between v2.0.0 and v2.1.0.
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.