Simplifies interpreting images geometrically using the parameters from sensor_msgs/CameraInfo. More...
#include <pinhole_camera_model.h>
Classes | |
struct | Cache |
Public Member Functions | |
uint32_t | binningX () const |
Returns the number of columns in each bin. More... | |
uint32_t | binningY () const |
Returns the number of rows in each bin. More... | |
const sensor_msgs::CameraInfo & | cameraInfo () const |
Returns the camera info message held internally. More... | |
double | cx () const |
Returns the x coordinate of the optical center. More... | |
double | cy () const |
Returns the y coordinate of the optical center. More... | |
const cv::Mat_< double > & | distortionCoeffs () const |
Returns the distortion coefficients. More... | |
double | fovX () const |
Returns the horizontal field of view in radians. More... | |
double | fovY () const |
Returns the vertical field of view in radians. More... | |
bool | fromCameraInfo (const sensor_msgs::CameraInfo &msg) |
Set the camera parameters from the sensor_msgs/CameraInfo message. More... | |
bool | fromCameraInfo (const sensor_msgs::CameraInfoConstPtr &msg) |
Set the camera parameters from the sensor_msgs/CameraInfo message. More... | |
const cv::Matx33d & | fullIntrinsicMatrix () const |
Returns the original camera matrix for full resolution. More... | |
const cv::Matx34d & | fullProjectionMatrix () const |
Returns the projection matrix for full resolution. More... | |
cv::Size | fullResolution () const |
The resolution at which the camera was calibrated. More... | |
double | fx () const |
Returns the focal length (pixels) in x direction of the rectified image. More... | |
double | fy () const |
Returns the focal length (pixels) in y direction of the rectified image. More... | |
double | getDeltaU (double deltaX, double Z) const |
Compute delta u, given Z and delta X in Cartesian space. More... | |
double | getDeltaV (double deltaY, double Z) const |
Compute delta v, given Z and delta Y in Cartesian space. More... | |
double | getDeltaX (double deltaU, double Z) const |
Compute delta X, given Z in Cartesian space and delta u in pixels. More... | |
double | getDeltaY (double deltaV, double Z) const |
Compute delta Y, given Z in Cartesian space and delta v in pixels. More... | |
bool | initialized () const |
Returns true if the camera has been initialized. More... | |
const cv::Matx33d & | intrinsicMatrix () const |
Returns the original camera matrix. More... | |
PinholeCameraModel & | operator= (const PinholeCameraModel &other) |
PinholeCameraModel () | |
PinholeCameraModel (const PinholeCameraModel &other) | |
cv::Point2d | project3dToPixel (const cv::Point3d &xyz) const |
Project a 3d point to rectified pixel coordinates. More... | |
const cv::Matx34d & | projectionMatrix () const |
Returns the projection matrix. More... | |
cv::Point3d | projectPixelTo3dRay (const cv::Point2d &uv_rect) const |
Project a rectified pixel to a 3d ray. More... | |
cv::Point3d | projectPixelTo3dRay (const cv::Point2d &uv_rect, const cv::Matx34d &P) const |
cv::Rect | rawRoi () const |
The current raw ROI, as used for capture by the camera driver. More... | |
cv::Rect | rectifiedRoi () const |
The current rectified ROI, which best fits the raw ROI. More... | |
void | rectifyImage (const cv::Mat &raw, cv::Mat &rectified, int interpolation=cv::INTER_LINEAR) const |
Rectify a raw camera image. More... | |
cv::Point2d | rectifyPoint (const cv::Point2d &uv_raw) const |
Compute the rectified image coordinates of a pixel in the raw image. More... | |
cv::Point2d | rectifyPoint (const cv::Point2d &uv_raw, const cv::Matx33d &K, const cv::Matx34d &P) const |
cv::Rect | rectifyRoi (const cv::Rect &roi_raw) const |
Compute the rectified ROI best fitting a raw ROI. More... | |
cv::Size | reducedResolution () const |
The resolution of the current rectified image. More... | |
const cv::Matx33d & | rotationMatrix () const |
Returns the rotation matrix. More... | |
ros::Time | stamp () const |
Get the time stamp associated with this camera model. More... | |
std::string | tfFrame () const |
Get the name of the camera coordinate frame in tf. More... | |
cv::Point2d | toFullResolution (const cv::Point2d &uv_reduced) const |
cv::Rect | toFullResolution (const cv::Rect &roi_reduced) const |
cv::Point2d | toReducedResolution (const cv::Point2d &uv_full) const |
cv::Rect | toReducedResolution (const cv::Rect &roi_full) const |
double | Tx () const |
Returns the x-translation term of the projection matrix. More... | |
double | Ty () const |
Returns the y-translation term of the projection matrix. More... | |
void | unrectifyImage (const cv::Mat &rectified, cv::Mat &raw, int interpolation=cv::INTER_LINEAR) const |
Apply camera distortion to a rectified image. More... | |
cv::Point2d | unrectifyPoint (const cv::Point2d &uv_rect) const |
Compute the raw image coordinates of a pixel in the rectified image. More... | |
cv::Point2d | unrectifyPoint (const cv::Point2d &uv_rect, const cv::Matx33d &K, const cv::Matx34d &P) const |
cv::Rect | unrectifyRoi (const cv::Rect &roi_rect) const |
Compute the raw ROI best fitting a rectified ROI. More... | |
Protected Member Functions | |
void | initRectificationMaps () const |
void | initUnrectificationMaps () const |
Protected Attributes | |
std::shared_ptr< Cache > | cache_ |
sensor_msgs::CameraInfo | cam_info_ |
cv::Mat_< double > | D_ |
cv::Matx33d | K_ |
cv::Matx33d | K_full_ |
cv::Matx34d | P_ |
cv::Matx34d | P_full_ |
cv::Matx33d | R_ |
Friends | |
class | StereoCameraModel |
Simplifies interpreting images geometrically using the parameters from sensor_msgs/CameraInfo.
Definition at line 24 of file pinhole_camera_model.h.
image_geometry::PinholeCameraModel::PinholeCameraModel | ( | ) |
Definition at line 47 of file pinhole_camera_model.cpp.
image_geometry::PinholeCameraModel::PinholeCameraModel | ( | const PinholeCameraModel & | other | ) |
Definition at line 58 of file pinhole_camera_model.cpp.
|
inline |
Returns the number of columns in each bin.
Definition at line 336 of file pinhole_camera_model.h.
|
inline |
Returns the number of rows in each bin.
Definition at line 337 of file pinhole_camera_model.h.
|
inline |
Returns the camera info message held internally.
Definition at line 314 of file pinhole_camera_model.h.
|
inline |
Returns the x coordinate of the optical center.
Definition at line 324 of file pinhole_camera_model.h.
|
inline |
Returns the y coordinate of the optical center.
Definition at line 325 of file pinhole_camera_model.h.
|
inline |
Returns the distortion coefficients.
Definition at line 316 of file pinhole_camera_model.h.
|
inline |
Returns the horizontal field of view in radians.
Definition at line 329 of file pinhole_camera_model.h.
|
inline |
Returns the vertical field of view in radians.
Definition at line 332 of file pinhole_camera_model.h.
bool image_geometry::PinholeCameraModel::fromCameraInfo | ( | const sensor_msgs::CameraInfo & | msg | ) |
Set the camera parameters from the sensor_msgs/CameraInfo message.
Definition at line 97 of file pinhole_camera_model.cpp.
bool image_geometry::PinholeCameraModel::fromCameraInfo | ( | const sensor_msgs::CameraInfoConstPtr & | msg | ) |
Set the camera parameters from the sensor_msgs/CameraInfo message.
Definition at line 225 of file pinhole_camera_model.cpp.
|
inline |
Returns the original camera matrix for full resolution.
Definition at line 319 of file pinhole_camera_model.h.
|
inline |
Returns the projection matrix for full resolution.
Definition at line 320 of file pinhole_camera_model.h.
cv::Size image_geometry::PinholeCameraModel::fullResolution | ( | ) | const |
The resolution at which the camera was calibrated.
The maximum resolution at which the camera can be used with the current calibration; normally this is the same as the imager resolution.
Definition at line 230 of file pinhole_camera_model.cpp.
|
inline |
Returns the focal length (pixels) in x direction of the rectified image.
Definition at line 322 of file pinhole_camera_model.h.
|
inline |
Returns the focal length (pixels) in y direction of the rectified image.
Definition at line 323 of file pinhole_camera_model.h.
|
inline |
Compute delta u, given Z and delta X in Cartesian space.
For given Z, this is the inverse of getDeltaX().
deltaX | Delta X, in Cartesian space |
Z | Z (depth), in Cartesian space |
Definition at line 339 of file pinhole_camera_model.h.
|
inline |
Compute delta v, given Z and delta Y in Cartesian space.
For given Z, this is the inverse of getDeltaY().
deltaY | Delta Y, in Cartesian space |
Z | Z (depth), in Cartesian space |
Definition at line 345 of file pinhole_camera_model.h.
|
inline |
Compute delta X, given Z in Cartesian space and delta u in pixels.
For given Z, this is the inverse of getDeltaU().
deltaU | Delta u, in pixels |
Z | Z (depth), in Cartesian space |
Definition at line 351 of file pinhole_camera_model.h.
|
inline |
Compute delta Y, given Z in Cartesian space and delta v in pixels.
For given Z, this is the inverse of getDeltaV().
deltaV | Delta v, in pixels |
Z | Z (depth), in Cartesian space |
Definition at line 357 of file pinhole_camera_model.h.
|
inline |
Returns true if the camera has been initialized.
Definition at line 275 of file pinhole_camera_model.h.
|
protected |
Definition at line 499 of file pinhole_camera_model.cpp.
|
protected |
Definition at line 581 of file pinhole_camera_model.cpp.
|
inline |
Returns the original camera matrix.
Definition at line 315 of file pinhole_camera_model.h.
PinholeCameraModel & image_geometry::PinholeCameraModel::operator= | ( | const PinholeCameraModel & | other | ) |
Definition at line 51 of file pinhole_camera_model.cpp.
cv::Point2d image_geometry::PinholeCameraModel::project3dToPixel | ( | const cv::Point3d & | xyz | ) | const |
Project a 3d point to rectified pixel coordinates.
This is the inverse of projectPixelTo3dRay().
xyz | 3d point in the camera coordinate frame |
Definition at line 299 of file pinhole_camera_model.cpp.
|
inline |
Returns the projection matrix.
Definition at line 318 of file pinhole_camera_model.h.
cv::Point3d image_geometry::PinholeCameraModel::projectPixelTo3dRay | ( | const cv::Point2d & | uv_rect | ) | const |
Project a rectified pixel to a 3d ray.
Returns the unit vector in the camera coordinate frame in the direction of rectified pixel (u,v) in the image plane. This is the inverse of project3dToPixel().
In 1.4.x, the vector has z = 1.0. Previously, this function returned a unit vector.
uv_rect | Rectified pixel coordinates |
Definition at line 313 of file pinhole_camera_model.cpp.
cv::Point3d image_geometry::PinholeCameraModel::projectPixelTo3dRay | ( | const cv::Point2d & | uv_rect, |
const cv::Matx34d & | P | ||
) | const |
Definition at line 318 of file pinhole_camera_model.cpp.
cv::Rect image_geometry::PinholeCameraModel::rawRoi | ( | ) | const |
The current raw ROI, as used for capture by the camera driver.
Definition at line 276 of file pinhole_camera_model.cpp.
cv::Rect image_geometry::PinholeCameraModel::rectifiedRoi | ( | ) | const |
The current rectified ROI, which best fits the raw ROI.
Definition at line 284 of file pinhole_camera_model.cpp.
void image_geometry::PinholeCameraModel::rectifyImage | ( | const cv::Mat & | raw, |
cv::Mat & | rectified, | ||
int | interpolation = cv::INTER_LINEAR |
||
) | const |
Rectify a raw camera image.
Definition at line 336 of file pinhole_camera_model.cpp.
cv::Point2d image_geometry::PinholeCameraModel::rectifyPoint | ( | const cv::Point2d & | uv_raw | ) | const |
Compute the rectified image coordinates of a pixel in the raw image.
Definition at line 384 of file pinhole_camera_model.cpp.
cv::Point2d image_geometry::PinholeCameraModel::rectifyPoint | ( | const cv::Point2d & | uv_raw, |
const cv::Matx33d & | K, | ||
const cv::Matx34d & | P | ||
) | const |
Definition at line 389 of file pinhole_camera_model.cpp.
cv::Rect image_geometry::PinholeCameraModel::rectifyRoi | ( | const cv::Rect & | roi_raw | ) | const |
Compute the rectified ROI best fitting a raw ROI.
Definition at line 456 of file pinhole_camera_model.cpp.
cv::Size image_geometry::PinholeCameraModel::reducedResolution | ( | ) | const |
The resolution of the current rectified image.
The size of the rectified image associated with the latest CameraInfo, as reduced by binning/ROI and affected by distortion. If binning and ROI are not in use, this is the same as fullResolution().
Definition at line 236 of file pinhole_camera_model.cpp.
|
inline |
Returns the rotation matrix.
Definition at line 317 of file pinhole_camera_model.h.
|
inline |
Get the time stamp associated with this camera model.
Definition at line 308 of file pinhole_camera_model.h.
|
inline |
Get the name of the camera coordinate frame in tf.
Definition at line 302 of file pinhole_camera_model.h.
cv::Point2d image_geometry::PinholeCameraModel::toFullResolution | ( | const cv::Point2d & | uv_reduced | ) | const |
Definition at line 244 of file pinhole_camera_model.cpp.
cv::Rect image_geometry::PinholeCameraModel::toFullResolution | ( | const cv::Rect & | roi_reduced | ) | const |
Definition at line 251 of file pinhole_camera_model.cpp.
cv::Point2d image_geometry::PinholeCameraModel::toReducedResolution | ( | const cv::Point2d & | uv_full | ) | const |
Definition at line 260 of file pinhole_camera_model.cpp.
cv::Rect image_geometry::PinholeCameraModel::toReducedResolution | ( | const cv::Rect & | roi_full | ) | const |
Definition at line 267 of file pinhole_camera_model.cpp.
|
inline |
Returns the x-translation term of the projection matrix.
Definition at line 326 of file pinhole_camera_model.h.
|
inline |
Returns the y-translation term of the projection matrix.
Definition at line 327 of file pinhole_camera_model.h.
void image_geometry::PinholeCameraModel::unrectifyImage | ( | const cv::Mat & | rectified, |
cv::Mat & | raw, | ||
int | interpolation = cv::INTER_LINEAR |
||
) | const |
Apply camera distortion to a rectified image.
Definition at line 360 of file pinhole_camera_model.cpp.
cv::Point2d image_geometry::PinholeCameraModel::unrectifyPoint | ( | const cv::Point2d & | uv_rect | ) | const |
Compute the raw image coordinates of a pixel in the rectified image.
Definition at line 418 of file pinhole_camera_model.cpp.
cv::Point2d image_geometry::PinholeCameraModel::unrectifyPoint | ( | const cv::Point2d & | uv_rect, |
const cv::Matx33d & | K, | ||
const cv::Matx34d & | P | ||
) | const |
Definition at line 423 of file pinhole_camera_model.cpp.
cv::Rect image_geometry::PinholeCameraModel::unrectifyRoi | ( | const cv::Rect & | roi_rect | ) | const |
Compute the raw ROI best fitting a rectified ROI.
Definition at line 478 of file pinhole_camera_model.cpp.
|
friend |
Definition at line 297 of file pinhole_camera_model.h.
|
protected |
Definition at line 287 of file pinhole_camera_model.h.
|
protected |
Definition at line 278 of file pinhole_camera_model.h.
|
protected |
Definition at line 279 of file pinhole_camera_model.h.
|
protected |
Definition at line 281 of file pinhole_camera_model.h.
|
protected |
Definition at line 283 of file pinhole_camera_model.h.
|
protected |
Definition at line 282 of file pinhole_camera_model.h.
|
protected |
Definition at line 284 of file pinhole_camera_model.h.
|
protected |
Definition at line 280 of file pinhole_camera_model.h.