camera

package
v0.0.0-...-7a59755 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

View Source
const (
	HorizontalResolutionPoints = 1280
	VerticalResolutionPoints   = 720
	HorizontalFOVDegrees       = 96
	VerticalFOVDegrees         = 54
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Camera

type Camera struct {
	*internal.BaseModule
	// contains filtered or unexported fields
}

Camera provides support for managing the camera attached to the robot.

func New

New creates a new Camera instance with the given UnityBridge instance and logger.

func (*Camera) AddVideoCallback

func (c *Camera) AddVideoCallback(vc VideoCallback) (token.Token, error)

AddVideoCallback adds a callback function to be called when a new video frame is received from the robot. The callback function will be called in a separate goroutine. Returns a token that can be used to remove the callback later.

func (*Camera) DigitalZoomFactor

func (c *Camera) DigitalZoomFactor() (uint64, error)

ExposureMode returns the current digital zoom factor.

func (*Camera) IsRecordingVideo

func (c *Camera) IsRecordingVideo() (bool, error)

IsRecordingVideo returns whether the robot is currently recording video to its internal storage.

func (*Camera) Mode

func (c *Camera) Mode() (Mode, error)

Mode returns the current camera mode.

func (*Camera) RecordingTime

func (c *Camera) RecordingTime() time.Duration

RecordingTime returns the current recording time in seconds.

func (*Camera) RemoveVideoCallback

func (c *Camera) RemoveVideoCallback(t token.Token) error

RemoveVideoCallback removes the callback function associated with the given token.

func (*Camera) SetDigitalZoomFactor

func (c *Camera) SetDigitalZoomFactor(factor uint64) error

SetDigitalZoomFactor sets the digital zoom factor.

func (*Camera) SetMode

func (c *Camera) SetMode(mode Mode) error

SetMode sets the camera mode.

func (*Camera) SetVideoFormat

func (c *Camera) SetVideoFormat(format VideoFormat) error

SetVideoFormat sets the video resolution.

TODO(bga): Other then actually limiting the available resolutions, it looks like changing resolutions is not working. Need to investigate further as there might be some setup that is needed and is not being done. It might be that this is only for the video recorded in the robot and not for the video being streamed from it.

func (*Camera) SetVideoQuality

func (c *Camera) SetVideoQuality(quality VideoQuality) error

SetVideoQuality sets the video quality.

func (*Camera) Start

func (c *Camera) Start() error

Start starts the camera manager.

func (*Camera) StartRecordingVideo

func (c *Camera) StartRecordingVideo() error

StartRecordingVideo starts recording video to the robot's internal storage.

func (*Camera) Stop

func (c *Camera) Stop() error

Stop stops the camera manager.

func (*Camera) StopRecordingVideo

func (c *Camera) StopRecordingVideo() error

StopRecordingVideo stops recording video to the robot's internal storage.

func (*Camera) VideoFormat

func (c *Camera) VideoFormat() (VideoFormat, error)

VideoFormat returns the currently set video format.

type Mode

type Mode uint8
const (
	ModePhoto Mode = iota
	ModeVideo
	ModeCount
)

func (Mode) String

func (cm Mode) String() string

String returns the camera mode as a string.

func (Mode) Valid

func (cm Mode) Valid() bool

Valid returns true if the camera mode is valid.

type RGB

type RGB struct {
	Pix    []uint8
	Stride int
	Rect   image.Rectangle
}

func NewRGB

func NewRGB(r image.Rectangle) *RGB

func NewRGBFromBytes

func NewRGBFromBytes(data []byte, r image.Rectangle) *RGB

func (*RGB) At

func (im *RGB) At(x, y int) color.Color

func (*RGB) Bounds

func (im *RGB) Bounds() image.Rectangle

func (*RGB) ColorModel

func (im *RGB) ColorModel() color.Model

func (*RGB) PixOffset

func (im *RGB) PixOffset(x, y int) int

func (*RGB) Set

func (im *RGB) Set(x, y int, c color.Color)

type VideoCallback

type VideoCallback func(frame *RGB)

VideoCallback is the type of the callback function used to receive video frames.

type VideoFormat

type VideoFormat uint8
const (
	VideoFormat720p_30 VideoFormat = iota
	VideoFormat1080p_30
	VideoFormat720p_60  // this might not be actually supported
	VideoFormat1080p_60 // this might not be actually supported
	VideoFormatCount
)

func (VideoFormat) String

func (vf VideoFormat) String() string

String returns the video format as a string.

func (VideoFormat) Valid

func (vf VideoFormat) Valid() bool

Valid returns true if the video format is valid.

type VideoQuality

type VideoQuality uint8
const (
	VideoQualityNormal VideoQuality = iota
	VideoQualityGood
	VideoQualityBest
	VideoQualityCount
)

func VideoQualityFromRate

func VideoQualityFromRate(rate float32) VideoQuality

VideoQualityFromRate returns the video quality from a rate (in megabits per second).

func (VideoQuality) String

func (vq VideoQuality) String() string

String returns the video quality as a string.

func (VideoQuality) ToRate

func (vq VideoQuality) ToRate() float32

ToRate returns the video quality as a rate (in megabits per second).

func (VideoQuality) Valid

func (vq VideoQuality) Valid() bool

Valid returns true if the video quality is valid.

Jump to

Keyboard shortcuts

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