camera

package module
v0.0.0-...-cdfd2c3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2024 License: CC0-1.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompressionUndefined = Compression("")
	CompressionAuto      = Compression("*")

	CompressionMJPEG = Compression("MJPG")
	CompressionHEIC  = Compression("HEIC")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Camera

type Camera interface {
	CameraCommon
	GetFrame(context.Context) (Frame, error)
	ReleaseFrame(Frame) error
}

type CameraCommon

type CameraCommon interface {
	io.Closer
	StartStreaming() error
	StopStreaming() error
	GetFormat() Format
}

type CameraCompressed

type CameraCompressed interface {
	CameraCommon
	GetCompressedFrames(context.Context) (FramesCompressed, error)
	ReleaseFrames(FramesCompressed) error
}

type Compression

type Compression string

type CompressionQuality

type CompressionQuality int64

type DevicePath

type DevicePath = string

type DevicePathAndPlatform

type DevicePathAndPlatform struct {
	DevicePath DevicePath
	Platform   Platform
}

func ListCameras

func ListCameras() ([]DevicePathAndPlatform, error)

func (DevicePathAndPlatform) ListFormats

func (d DevicePathAndPlatform) ListFormats() (Formats, error)

func (DevicePathAndPlatform) OpenCamera

func (d DevicePathAndPlatform) OpenCamera(format Format) (Camera, error)

type Format

type Format struct {
	Width       uint64
	Height      uint64
	PixelFormat PixelFormat
	FPS         Fraction
}

type Formats

type Formats []Format

func (Formats) BestResolution

func (s Formats) BestResolution() Format

func (Formats) FilterByFPS

func (s Formats) FilterByFPS(fps float64) Formats

func (Formats) FilterByPixelFormat

func (s Formats) FilterByPixelFormat(pixFmt PixelFormat) Formats

func (Formats) FilterByWidth

func (s Formats) FilterByWidth(width uint64) Formats

type Fraction

type Fraction struct {
	Numerator   uint
	Denominator uint
}

func (Fraction) Float32

func (f Fraction) Float32() float32

func (Fraction) Float64

func (f Fraction) Float64() float64

type Frame

type Frame interface {
	Image() image.Image
}

type FrameDecompressor

type FrameDecompressor interface {
	io.Closer

	WriteCompressed(FramesCompressed) error
	DecompressNext() (Frame, error)
	ReleaseFrame(Frame)
}

func NewFrameDecompressor

func NewFrameDecompressor(
	compression Compression,
) (FrameDecompressor, error)

type FramesCompressed

type FramesCompressed interface {
	Bytes() []byte
}

type PixelFormat

type PixelFormat string

func PixelFormatByName

func PixelFormatByName(pixFmtName string) PixelFormat

func PixelFormatFromUint32

func PixelFormatFromUint32(v uint32) PixelFormat

func (PixelFormat) Uint32

func (pixFmt PixelFormat) Uint32() uint32

type Platform

type Platform interface {
	ListCameras() ([]DevicePath, error)

	OpenCamera(
		devicePath DevicePath,
		format Format,
	) (Camera, error)

	OpenCameraCompressed(
		devicePath DevicePath,
		format Format,
		compression Compression,
		compressionQuality CompressionQuality,
	) (CameraCompressed, error)

	ListFormats(
		devicePath string,
	) (Formats, error)
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func DefaultRegistry

func DefaultRegistry() *Registry

func NewRegistry

func NewRegistry() *Registry

func (*Registry) ListCameras

func (r *Registry) ListCameras() ([]DevicePathAndPlatform, error)

func (*Registry) RegisterPlatform

func (r *Registry) RegisterPlatform(plat Platform)

Directories

Path Synopsis
cmd
platform

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL