camera

package
v0.2.22 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: AGPL-3.0 Imports: 31 Imported by: 32

Documentation

Overview

Package camera defines an image capturing device.

Index

Constants

View Source
const (
	UnspecifiedStream = ImageType("")
	ColorStream       = ImageType("color")
	DepthStream       = ImageType("depth")
)

The allowed types of streams that can come from a VideoSource.

View Source
const SubtypeName = resource.SubtypeName("camera")

SubtypeName is a constant that identifies the camera resource subtype string.

Variables

Subtype is a constant that identifies the camera resource subtype.

Functions

func DependencyTypeError

func DependencyTypeError(name string, actual interface{}) error

DependencyTypeError is used when a resource doesn't implement the expected interface.

func Named

func Named(name string) resource.Name

Named is a helper for getting the named camera's typed resource name.

func NamesFromRobot

func NamesFromRobot(r robot.Robot) []string

NamesFromRobot is a helper for getting all camera names from the given Robot.

func NewPinholeModelWithBrownConradyDistortion added in v0.2.13

func NewPinholeModelWithBrownConradyDistortion(pinholeCameraIntrinsics *transform.PinholeCameraIntrinsics,
	distortion *transform.BrownConrady,
) transform.PinholeCameraModel

NewPinholeModelWithBrownConradyDistortion creates a transform.PinholeCameraModel from a *transform.PinholeCameraIntrinsics and a *transform.BrownConrady. If *transform.BrownConrady is `nil`, transform.PinholeCameraModel.Distortion is not set & remains nil, to prevent https://go.dev/doc/faq#nil_error.

func NewPropertiesError

func NewPropertiesError(cameraIdentifier string) error

NewPropertiesError returns an error specific to a failure in Properties.

func NewServer

NewServer constructs an camera gRPC service server.

func NewUnimplementedInterfaceError

func NewUnimplementedInterfaceError(actual interface{}) error

NewUnimplementedInterfaceError is used when there is a failed interface check.

func NewUnsupportedImageTypeError added in v0.2.4

func NewUnsupportedImageTypeError(s ImageType) error

NewUnsupportedImageTypeError is when the stream type is unknown.

func ReadImage

func ReadImage(ctx context.Context, src gostream.VideoSource) (image.Image, func(), error)

ReadImage reads an image from the given source that is immediately available.

func SimultaneousColorDepthNext

func SimultaneousColorDepthNext(ctx context.Context, color, depth gostream.VideoStream) (image.Image, *rimage.DepthMap)

SimultaneousColorDepthNext will call Next on both the color and depth camera as simultaneously as possible.

func SourceFromCamera added in v0.2.2

func SourceFromCamera(cam Camera) (gostream.VideoSource, error)

SourceFromCamera returns a gostream.VideoSource from a camera.Camera if possible, else nil.

func WrapWithReconfigurable

func WrapWithReconfigurable(r interface{}, name resource.Name) (resource.Reconfigurable, error)

WrapWithReconfigurable wraps a camera with a reconfigurable and locking interface.

Types

type Camera

type Camera interface {
	generic.Generic

	// Stream returns a stream that makes a best effort to return consecutive images
	// that may have a MIME type hint dictated in the context via gostream.WithMIMETypeHint.
	Stream(ctx context.Context, errHandlers ...gostream.ErrorHandler) (gostream.VideoStream, error)

	// NextPointCloud returns the next immediately available point cloud, not necessarily one
	// a part of a sequence. In the future, there could be streaming of point clouds.
	NextPointCloud(ctx context.Context) (pointcloud.PointCloud, error)
	// Properties returns properties that are intrinsic to the particular
	// implementation of a camera
	Properties(ctx context.Context) (Properties, error)
	Close(ctx context.Context) error
	// contains filtered or unexported methods
}

A Camera represents anything that can capture frames.

func FromDependencies

func FromDependencies(deps registry.Dependencies, name string) (Camera, error)

FromDependencies is a helper for getting the named camera from a collection of dependencies.

func FromRobot

func FromRobot(r robot.Robot, name string) (Camera, error)

FromRobot is a helper for getting the named Camera from the given Robot.

func NewClientFromConn

func NewClientFromConn(ctx context.Context, conn rpc.ClientConn, name string, logger golog.Logger) Camera

NewClientFromConn constructs a new Client from connection passed in.

func NewFromReader

func NewFromReader(
	ctx context.Context,
	reader gostream.VideoReader,
	syst *transform.PinholeCameraModel, imageType ImageType,
) (Camera, error)

NewFromReader creates a Camera either with or without a projector. The stream type argument is for detecting whether or not the resulting camera supports return of pointcloud data in the absence of an implemented NextPointCloud function. If this is unknown or not applicable, a value of camera.Unspecified stream can be supplied.

func NewFromSource

func NewFromSource(
	ctx context.Context,
	source gostream.VideoSource,
	syst *transform.PinholeCameraModel, imageType ImageType,
) (Camera, error)

NewFromSource creates a Camera either with or without a projector. The stream type argument is for detecting whether or not the resulting camera supports return of pointcloud data in the absence of an implemented NextPointCloud function. If this is unknown or not applicable, a value of camera.Unspecified stream can be supplied.

type ImageType added in v0.2.4

type ImageType string

ImageType specifies what kind of image stream is coming from the camera.

type LivenessMonitor added in v0.2.18

type LivenessMonitor interface {
	Monitor(notifyReset func())
}

A LivenessMonitor is responsible for monitoring the liveness of a camera. An example is connectivity. Since the model itself knows best about how to maintain this state, the reconfigurable offers a safe way to notify if a state needs to be reset due to some exceptional event (like a reconnect). It is expected that the monitoring code is tied to the lifetime of the resource and once the resource is closed, so should the monitor. That is, it should no longer send any resets once a Close on its associated resource has returned.

type PointCloudSource

type PointCloudSource interface {
	NextPointCloud(ctx context.Context) (pointcloud.PointCloud, error)
}

A PointCloudSource is a source that can generate pointclouds.

type Properties

type Properties struct {
	// SupportsPCD indicates that the Camera supports a valid
	// implementation of NextPointCloud
	SupportsPCD      bool
	ImageType        ImageType
	IntrinsicParams  *transform.PinholeCameraIntrinsics
	DistortionParams transform.Distorter
}

Properties is a lookup for a camera's features and settings.

Directories

Path Synopsis
Package align defines the camera models that are used to align a color camera's output with a depth camera's output, in order to make point clouds.
Package align defines the camera models that are used to align a color camera's output with a depth camera's output, in order to make point clouds.
Package fake implements a fake camera which always returns the same image with a user specified resolution.
Package fake implements a fake camera which always returns the same image with a user specified resolution.
Package ffmpeg provides an implementation for an ffmpeg based camera
Package ffmpeg provides an implementation for an ffmpeg based camera
Package register registers all relevant cameras and also subtype specific functions
Package register registers all relevant cameras and also subtype specific functions
Package rtsp implements an RTSP camera client for RDK
Package rtsp implements an RTSP camera client for RDK
Package transformpipeline defines image sources that apply transforms on images, and can be composed into an image transformation pipeline.
Package transformpipeline defines image sources that apply transforms on images, and can be composed into an image transformation pipeline.
Package velodyne implements a general velodyne LIDAR as a camera.
Package velodyne implements a general velodyne LIDAR as a camera.
Package videosource defines various image sources typically registered as cameras in the API.
Package videosource defines various image sources typically registered as cameras in the API.

Jump to

Keyboard shortcuts

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