camera

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: Apache-2.0 Imports: 18 Imported by: 4

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 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 Module added in v0.0.10

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

Module 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 (*Module) AddVideoCallback added in v0.0.10

func (m *Module) 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 (*Module) DigitalZoomFactor added in v0.0.10

func (m *Module) DigitalZoomFactor() (uint64, error)

ExposureMode returns the current digital zoom factor.

func (*Module) GLTextureData added in v0.0.10

func (c *Module) GLTextureData() (value.GLTextureData, error)

GLTextureData returns information about the current texture used for rendering frames. See RenderNextFrame() above.

func (*Module) IsRecordingVideo added in v0.0.10

func (m *Module) IsRecordingVideo() (bool, error)

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

func (*Module) Mode added in v0.0.10

func (m *Module) Mode() (Mode, error)

Mode returns the current camera mode.

func (*Module) RecordingTime added in v0.0.10

func (m *Module) RecordingTime() time.Duration

RecordingTime returns the current recording time in seconds.

func (*Module) RemoveVideoCallback added in v0.0.10

func (m *Module) RemoveVideoCallback(t token.Token) error

RemoveVideoCallback removes the callback function associated with the given token.

func (*Module) RenderNextFrame added in v0.0.10

func (m *Module) RenderNextFrame()

RenderNextFrame requests the next frame to be rendered. This is used by iOS and the frame will be rendered to a texture associated with an OpenGLES 2.0 context that was current when Start() is called. This should be called for for each frame to be rendered (up to 60 times per second).

func (*Module) SetDigitalZoomFactor added in v0.0.10

func (m *Module) SetDigitalZoomFactor(factor uint64) error

SetDigitalZoomFactor sets the digital zoom factor.

func (*Module) SetMode added in v0.0.10

func (m *Module) SetMode(mode Mode) error

SetMode sets the camera mode.

func (*Module) SetVideoFormat added in v0.0.10

func (m *Module) 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 (*Module) SetVideoQuality added in v0.0.10

func (m *Module) SetVideoQuality(quality VideoQuality) error

SetVideoQuality sets the video quality.

func (*Module) Start added in v0.0.10

func (m *Module) Start() error

Start starts the camera module.

func (*Module) StartRecordingVideo added in v0.0.10

func (m *Module) StartRecordingVideo() error

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

func (*Module) Stop added in v0.0.10

func (m *Module) Stop() error

Stop stops the camera manager.

func (*Module) StopRecordingVideo added in v0.0.10

func (m *Module) StopRecordingVideo() error

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

func (*Module) VideoFormat added in v0.0.10

func (m *Module) VideoFormat() (VideoFormat, error)

VideoFormat returns the currently set video format.

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