fake

package
v0.50.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package fake implements a fake camera which always returns the same image with a user specified resolution.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Model is the model of the fake buildin camera.
	Model = resource.DefaultModelFamily.WithModel("fake")
	// ErrRTPPassthroughNotEnabled indicates that rtp_passthrough is not enabled.
	ErrRTPPassthroughNotEnabled = errors.New("rtp_passthrough not enabled")
)

Functions

func NewCamera added in v0.2.36

func NewCamera(
	ctx context.Context,
	_ resource.Dependencies,
	conf resource.Config,
	logger logging.Logger,
) (camera.Camera, error)

NewCamera returns a new fake camera.

Types

type Camera

type Camera struct {
	resource.Named
	resource.AlwaysRebuild

	Model          *transform.PinholeCameraModel
	Width          int
	Height         int
	Animated       bool
	RTPPassthrough bool
	// contains filtered or unexported fields
}

Camera is a fake camera that always returns the same image.

func (*Camera) Close added in v0.2.36

func (c *Camera) Close(ctx context.Context) error

Close does nothing.

func (*Camera) NextPointCloud

func (c *Camera) NextPointCloud(ctx context.Context) (pointcloud.PointCloud, error)

NextPointCloud always returns a pointcloud of a yellow to blue gradient, with the depth determined by the intensity of blue.

func (*Camera) Read

func (c *Camera) Read(ctx context.Context) (image.Image, func(), error)

Read always returns the same image of a yellow to blue gradient.

func (*Camera) SubscribeRTP added in v0.27.0

func (c *Camera) SubscribeRTP(
	ctx context.Context,
	bufferSize int,
	packetsCB rtppassthrough.PacketCallback,
) (rtppassthrough.Subscription, error)

SubscribeRTP begins a subscription to receive RTP packets.

func (*Camera) Unsubscribe added in v0.27.0

func (c *Camera) Unsubscribe(ctx context.Context, id rtppassthrough.SubscriptionID) error

Unsubscribe terminates the subscription.

type Config added in v0.2.36

type Config struct {
	Width          int  `json:"width,omitempty"`
	Height         int  `json:"height,omitempty"`
	Animated       bool `json:"animated,omitempty"`
	RTPPassthrough bool `json:"rtp_passthrough,omitempty"`
	Model          bool `json:"model,omitempty"`
}

Config are the attributes of the fake camera config.

func (*Config) Validate added in v0.2.36

func (conf *Config) Validate(path string) ([]string, error)

Validate checks that the config attributes are valid for a fake camera.

type StaticSource added in v0.41.0

type StaticSource struct {
	ColorImg image.Image
	DepthImg image.Image
	Proj     transform.Projector
}

StaticSource is a fixed, stored image. Used primarily for testing.

func (*StaticSource) Close added in v0.41.0

func (ss *StaticSource) Close(ctx context.Context) error

Close does nothing.

func (*StaticSource) Images added in v0.41.0

Images returns the saved color and depth image if they are present.

func (*StaticSource) NextPointCloud added in v0.41.0

func (ss *StaticSource) NextPointCloud(ctx context.Context) (pointcloud.PointCloud, error)

NextPointCloud returns the point cloud from projecting the rgb and depth image using the intrinsic parameters.

func (*StaticSource) Read added in v0.41.0

func (ss *StaticSource) Read(ctx context.Context) (image.Image, func(), error)

Read returns the stored image.

Jump to

Keyboard shortcuts

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