Resurgence (PY2022)
Codebase for the Husky Robotics 2021-2022 rover Resurgence
Loading...
Searching...
No Matches
Camera Access

This module provides an interface for defining and accessing the different cameras attached to the rover. More...

Classes

class  cam::Camera
 Represents a camera on the rover, from which a video feed can be retrieved. More...
 
class  cam::invalid_camera_config
 Exception for errors in the camera configuration. More...
 
struct  cam::CameraConfig
 A struct that represents the information outlined in Camera Configuration. More...
 
class  cam::CameraParams
 Represents a set of intrinsic camera parameters. More...
 

Functions

CameraConfig cam::readConfigFromFile (const std::string &filename)
 Read the camera config from the specified file.
 
void cam::read (const cv::FileNode &node, CameraParams &params, const CameraParams &default_value=CameraParams())
 Reads a CameraParams object from the given cv::FileNode object.
 
void cam::write (cv::FileStorage &fs, const std::string &name, const CameraParams &params)
 Writes the given CameraParams object to the given cv::FileStorage object.
 

Configuration File Keys

The following are constants for the keys used in the camera configuration files.

See Camera Configuration for more details.

const std::string cam::KEY_FILENAME = "filename"
 Config file key for camera filename.
 
const std::string cam::KEY_CAMERA_ID = "camera_id"
 Config file key for camera id.
 
const std::string cam::KEY_INTRINSIC_PARAMS = "intrinsic_params"
 Config file key for intrinsic parameters.
 
const std::string cam::KEY_EXTRINSIC_PARAMS = "extrinsic_params"
 Config file key for extrinsic parameters.
 
const std::string cam::KEY_CALIB_INFO = "calib_info"
 Config file key for calibration information.
 
const std::string cam::KEY_NAME = "name"
 Config file key for camera name.
 
const std::string cam::KEY_DESCRIPTION = "description"
 Config file key for camera description.
 
const std::string cam::KEY_IMAGE_WIDTH = "image_width"
 Config file key for image width.
 
const std::string cam::KEY_IMAGE_HEIGHT = "image_height"
 Config file key for image height.
 
const std::string cam::KEY_CAMERA_MATRIX = "camera_matrix"
 Config file key for the camera matrix.
 
const std::string cam::KEY_DIST_COEFFS = "distortion_coefficients"
 Config file key for the distortion coefficients.
 

Detailed Description

This module provides an interface for defining and accessing the different cameras attached to the rover.

Cameras can be defined in YAML files (see Camera Configuration) and opened using these files at runtime (see Camera::openFromConfigFile()).

Function Documentation

◆ read()

void cam::read ( const cv::FileNode & node,
CameraParams & params,
const CameraParams & default_value = CameraParams() )

Reads a CameraParams object from the given cv::FileNode object.

Used for serialization - you should not need to call this method directly but should instead use the >> operator on a cv::FileNode object.

◆ readConfigFromFile()

CameraConfig cam::readConfigFromFile ( const std::string & filename)

Read the camera config from the specified file.

Parameters
filenameThe path to the configuration file to open and read. Configuration file should be formatted as described in Camera Configuration.
Returns
CameraConfig The parsed camera config object.
Exceptions
invalid_camera_configIf the configuration is invalid for any reason.
invalid_argumentIf the file does not exist.

◆ write()

void cam::write ( cv::FileStorage & fs,
const std::string & name,
const CameraParams & params )

Writes the given CameraParams object to the given cv::FileStorage object.

Used for serialization - you should not need to call this method directly but should instead use the << operator on a cv::FileStorage object.