Resurgence (PY2022)
Codebase for the Husky Robotics 2021-2022 rover Resurgence
|
Represents a set of intrinsic camera parameters. More...
#include <CameraParams.h>
Public Member Functions | |
CameraParams () | |
Constructs a default or empty set of camera parameters. | |
CameraParams (const cv::Mat &camera_matrix, const cv::Mat &dist_coeff, cv::Size image_size=cv::Size(640, 480)) | |
Constructs a set of camera parameters with the given camera matrix, distortion coefficients, and image size. | |
CameraParams (const CameraParams &other) | |
Copy constructor. | |
bool | empty () const |
cv::Mat | getCameraMatrix () const |
Gets the camera matrix associated with this set of camera parameters. | |
cv::Mat | getDistCoeff () const |
Gets the distortion coefficients (as a column vector) associated with this set of camera parameters. | |
cv::Size | getImageSize () const |
Gets the image size this set of intrinsic parameters was calibrated for. | |
std::vector< double > | getIntrinsicList () |
Gets the camera intrinsics as a 1d list. | |
CameraParams & | operator= (const CameraParams &other) |
Define a copy assignment operator. | |
void | readFromFileNode (const cv::FileNode &file_node) |
Reads the data for this CameraParams object from the given cv::FileNode object. | |
void | writeToFileStorage (cv::FileStorage &file_storage) const |
Writes the data for this CameraParams object to the given cv::FileStorage object. | |
Represents a set of intrinsic camera parameters.
Camera parameters (also called "intrinsic parameters") are obtained from camera calibration and are unique to and constant for every camera. They define how the camera projects a 3D space onto a 2D image plane.
Each set of CameraParams contains a camera matrix which defines how points in 3D space are linearly projected to the 2D image plane of the camera, and a set of distortion coefficients which can be used to correct for radial distortion in the image. The projection is linear which means that projected points are unique only up to scaling.
cam::CameraParams::CameraParams | ( | ) |
Constructs a default or empty set of camera parameters.
cam::CameraParams::CameraParams | ( | const cv::Mat & | camera_matrix, |
const cv::Mat & | dist_coeff, | ||
cv::Size | image_size = cv::Size(640, 480) ) |
Constructs a set of camera parameters with the given camera matrix, distortion coefficients, and image size.
camera_matrix | A 3x3 matrix defining the projection of the camera. |
dist_coeff | A set of distortion coefficients defining the lens distortion of the camera. Must be a 1xN or Nx1 matrix where N is the number of coefficients. N must be 4, 5, 8, 12, or 14. |
image_size | The size of the image the parameters are calibrated for. Defaults to 640x480 as this is the default resolution of many webcams. |
cam::CameraParams::CameraParams | ( | const CameraParams & | other | ) |
Copy constructor.
Constructs a set of camera parameters by copying another. Underlying data like the camera matrix and distortion coefficients are actually copied, so the copy may be modified without affecting the original.
void cam::CameraParams::readFromFileNode | ( | const cv::FileNode & | file_node | ) |
Reads the data for this 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.
void cam::CameraParams::writeToFileStorage | ( | cv::FileStorage & | file_storage | ) | const |
Writes the data for this 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.