ViSP
2.9.0
|
#include <vpCameraParameters.h>
Public Types | |
enum | vpCameraParametersProjType { perspectiveProjWithoutDistortion, perspectiveProjWithDistortion } |
Public Member Functions | |
vpCameraParameters () | |
vpCameraParameters (const vpCameraParameters &c) | |
vpCameraParameters (const double px, const double py, const double u0, const double v0) | |
vpCameraParameters (const double px, const double py, const double u0, const double v0, const double kud, const double kdu) | |
vpCameraParameters & | operator= (const vpCameraParameters &c) |
virtual | ~vpCameraParameters () |
void | init () |
void | init (const vpCameraParameters &c) |
void | initFromCalibrationMatrix (const vpMatrix &_K) |
void | initPersProjWithoutDistortion (const double px, const double py, const double u0, const double v0) |
void | initPersProjWithDistortion (const double px, const double py, const double u0, const double v0, const double kud, const double kdu) |
bool | isFovComputed () const |
void | computeFov (const unsigned int &w, const unsigned int &h) |
double | getFovAngleX () const |
double | getFovAngleY () const |
std::vector< vpColVector > | getFovNormals () const |
double | get_px () const |
double | get_px_inverse () const |
double | get_py_inverse () const |
double | get_py () const |
double | get_u0 () const |
double | get_v0 () const |
double | get_kud () const |
double | get_kdu () const |
vpCameraParametersProjType | get_projModel () const |
vpMatrix | get_K () const |
vpMatrix | get_K_inverse () const |
void | printParameters () |
Friends | |
class | vpMeterPixelConversion |
class | vpPixelMeterConversion |
VISP_EXPORT std::ostream & | operator<< (std::ostream &os, const vpCameraParameters &cam) |
Generic class defining intrinsic camera parameters.
Two kinds of camera modelisation are implemented:
The main intrinsic camera parameters are the ratio between the focal length and the size of a pixel, and the coordinates of the principal point in pixel. The lens distortion can also be considered by two additional parameters .
1. Camera parameters for a perspective projection without distortion model
In this modelisation, only parameters are used. If we denote the position of a pixel in the digitized image, this position is related to the corresponding coordinates in the normalized space (in meter) by:
The conversion from pixel coordinates in the normalized space is implemented in vpPixelMeterConversion, whereas the conversion from normalized coordinates into pixel is implemented in vpMeterPixelConversion.
2. Camera parameters for a perspective projection with distortion model
In this modelisation, parameters are used. If a model with distortion is considered, we got:
where and are geometrical distortions introduced in the camera model. These distortions are due to imperfections in the lenses design and assembly there usually are some positional errors that have to be taken into account. and can be modeled as follow:
with
This model is useful to convert meter to pixel coordinates because in this case :
The conversion from normalized coordinates into pixel is implemented in vpMeterPixelConversion.
with
This model is useful to convert pixel to meter coordinates because in this case :
The conversion from pixel coordinates in the normalized space is implemented in vpPixelMeterConversion.
The selection of one of these modelisations is done during vpCameraParameters initialisation.
Here an example of camera initialisation, for a model without distortion:
Here an example of camera initialisation, for a model with distortion:
The code below shows how to know the currently used projection model:
An XML parser for camera parameters is also provided in vpXmlParserCamera.
Definition at line 202 of file vpCameraParameters.h.
Enumerator | |
---|---|
perspectiveProjWithoutDistortion |
Perspective projection without distortion model. |
perspectiveProjWithDistortion |
Perspective projection with distortion model. |
Definition at line 207 of file vpCameraParameters.h.
vpCameraParameters::vpCameraParameters | ( | ) |
Default constructor. By default, a perspective projection without distortion model is set.
Definition at line 77 of file vpCameraParameters.cpp.
References init().
vpCameraParameters::vpCameraParameters | ( | const vpCameraParameters & | c | ) |
vpCameraParameters::vpCameraParameters | ( | const double | cam_px, |
const double | cam_py, | ||
const double | cam_u0, | ||
const double | cam_v0 | ||
) |
Constructor for perspective projection without distortion model
cam_px,cam_py | : pixel size |
cam_u0,cam_v0 | : principal points |
Definition at line 113 of file vpCameraParameters.cpp.
References initPersProjWithoutDistortion().
vpCameraParameters::vpCameraParameters | ( | const double | cam_px, |
const double | cam_py, | ||
const double | cam_u0, | ||
const double | cam_v0, | ||
const double | cam_kud, | ||
const double | cam_kdu | ||
) |
Constructor for perspective projection with distortion model
cam_px,cam_py | : pixel size |
cam_u0,cam_v0 | : principal points |
cam_kud | : undistorted to distorted radial distortion |
cam_kdu | : distorted to undistorted radial distortion |
Definition at line 136 of file vpCameraParameters.cpp.
References initPersProjWithDistortion().
|
virtual |
void vpCameraParameters::computeFov | ( | const unsigned int & | w, |
const unsigned int & | h | ||
) |
Compute angles and normals of the FOV.
w | : Width of the image |
h | : Height of the image. |
Definition at line 326 of file vpCameraParameters.cpp.
References vpColVector::normalize().
Referenced by vpMbtDistanceLine::display(), vpMbKltTracker::display(), vpMbtDistanceLine::initMovingEdge(), vpMbtKltPolygon::updateMask(), and vpMbtDistanceLine::updateMovingEdge().
vpMatrix vpCameraParameters::get_K | ( | ) | const |
Return the calibration matrix .
is 3x3 matrix given by:
Definition at line 388 of file vpCameraParameters.cpp.
References vpException::notImplementedError, perspectiveProjWithDistortion, perspectiveProjWithoutDistortion, vpMatrix::resize(), and vpERROR_TRACE.
Referenced by vpMbEdgeTracker::downScale(), vpPose::poseFromRectangle(), vpHomography::project(), vpMbKltTracker::setPose(), and vpMbEdgeTracker::upScale().
vpMatrix vpCameraParameters::get_K_inverse | ( | ) | const |
Return the calibration matrix .
is 3x3 matrix given by:
Definition at line 428 of file vpCameraParameters.cpp.
References vpException::notImplementedError, perspectiveProjWithDistortion, perspectiveProjWithoutDistortion, vpMatrix::resize(), and vpERROR_TRACE.
Referenced by vpHomography::project(), and vpMbKltTracker::setPose().
|
inline |
Definition at line 292 of file vpCameraParameters.h.
Referenced by vpCalibration::computeStdDeviation_dist().
|
inline |
Definition at line 291 of file vpCameraParameters.h.
Referenced by vpCalibration::computeStdDeviation_dist(), vpCalibration::displayGrid(), and vpImageTools::undistort().
|
inline |
Definition at line 294 of file vpCameraParameters.h.
Referenced by vpXmlParserCamera::save().
|
inline |
Definition at line 285 of file vpCameraParameters.h.
Referenced by vpFeatureLuminance::buildFrom(), vpMbtDistanceLine::computeInteractionMatrixError(), vpMbtDistanceCylinder::computeInteractionMatrixError(), vpCalibration::computeStdDeviation(), vpCalibration::computeStdDeviation_dist(), vpMbEdgeKltTracker::computeVVS(), vpMbKltTracker::computeVVS(), vpMbEdgeTracker::computeVVS(), vpCalibration::displayGrid(), vpMomentObject::fromImage(), vpSimulatorAfma6::initDisplay(), vpSimulatorViper850::initDisplay(), vpMbXmlParser::read_camera(), vpMbtEdgeKltXmlParser::readMainClass(), vpMbtXmlParser::readMainClass(), vpMbtKltXmlParser::readMainClass(), vpMbXmlParser::readMainClass(), vpSimulatorAfma6::setCameraParameters(), vpSimulatorViper850::setCameraParameters(), vpSimulator::setExternalCameraParameters(), vpWireFrameSimulator::setExternalCameraParameters(), vpSimulator::setInternalCameraParameters(), vpWireFrameSimulator::setInternalCameraParameters(), vpImageTools::undistort(), and vpAROgre::updateCameraProjection().
|
inline |
Definition at line 286 of file vpCameraParameters.h.
|
inline |
Definition at line 288 of file vpCameraParameters.h.
Referenced by vpFeatureLuminance::buildFrom(), vpMbtDistanceLine::computeInteractionMatrixError(), vpMbtDistanceCylinder::computeInteractionMatrixError(), vpCalibration::computeStdDeviation(), vpCalibration::computeStdDeviation_dist(), vpCalibration::displayGrid(), vpMomentObject::fromImage(), vpSimulatorAfma6::initDisplay(), vpSimulatorViper850::initDisplay(), vpMbXmlParser::read_camera(), vpMbtEdgeKltXmlParser::readMainClass(), vpMbtXmlParser::readMainClass(), vpMbtKltXmlParser::readMainClass(), vpMbXmlParser::readMainClass(), vpSimulatorAfma6::setCameraParameters(), vpSimulatorViper850::setCameraParameters(), vpSimulator::setExternalCameraParameters(), vpWireFrameSimulator::setExternalCameraParameters(), vpSimulator::setInternalCameraParameters(), vpWireFrameSimulator::setInternalCameraParameters(), vpImageTools::undistort(), and vpAROgre::updateCameraProjection().
|
inline |
Definition at line 287 of file vpCameraParameters.h.
|
inline |
Definition at line 289 of file vpCameraParameters.h.
Referenced by vpMbtDistanceLine::computeInteractionMatrixError(), vpMbtDistanceCylinder::computeInteractionMatrixError(), vpCalibration::computeStdDeviation(), vpCalibration::computeStdDeviation_dist(), vpCalibration::displayGrid(), vpMbXmlParser::read_camera(), vpMbtEdgeKltXmlParser::readMainClass(), vpMbtXmlParser::readMainClass(), vpMbtKltXmlParser::readMainClass(), vpMbXmlParser::readMainClass(), vpImageTools::undistort(), and vpAROgre::updateCameraProjection().
|
inline |
Definition at line 290 of file vpCameraParameters.h.
Referenced by vpMbtDistanceLine::computeInteractionMatrixError(), vpMbtDistanceCylinder::computeInteractionMatrixError(), vpCalibration::computeStdDeviation(), vpCalibration::computeStdDeviation_dist(), vpCalibration::displayGrid(), vpMbXmlParser::read_camera(), vpMbtEdgeKltXmlParser::readMainClass(), vpMbtXmlParser::readMainClass(), vpMbtKltXmlParser::readMainClass(), vpMbXmlParser::readMainClass(), vpImageTools::undistort(), and vpAROgre::updateCameraProjection().
|
inline |
Get the horizontal angle of the field of view.
Definition at line 252 of file vpCameraParameters.h.
References vpTRACE.
|
inline |
Get the vertical angle of the field of view.
Definition at line 264 of file vpCameraParameters.h.
References vpTRACE.
|
inline |
Get the list of the normals corresponding to planes describing the field of view.
Definition at line 280 of file vpCameraParameters.h.
References vpTRACE.
Referenced by vpMbtPolygon::computeRoiClipped().
void vpCameraParameters::init | ( | ) |
basic initialization with the default parameters
Definition at line 155 of file vpCameraParameters.cpp.
References vpException::divideByZeroError, and vpERROR_TRACE.
Referenced by vpCameraParameters().
void vpCameraParameters::init | ( | const vpCameraParameters & | c | ) |
initialization from another vpCameraParameters object
Definition at line 259 of file vpCameraParameters.cpp.
void vpCameraParameters::initFromCalibrationMatrix | ( | const vpMatrix & | _K | ) |
initialise the camera from a calibration matrix. Using a calibration matrix leads to a camera without distortion
The K matrix in parameters must be like:
_K | : the 3by3 calibration matrix |
Definition at line 280 of file vpCameraParameters.cpp.
References vpException::badValue, vpException::dimensionError, vpMatrix::getCols(), vpMatrix::getRows(), and initPersProjWithoutDistortion().
Referenced by vpMbEdgeTracker::downScale(), and vpMbEdgeTracker::upScale().
void vpCameraParameters::initPersProjWithDistortion | ( | const double | cam_px, |
const double | cam_py, | ||
const double | cam_u0, | ||
const double | cam_v0, | ||
const double | cam_kud, | ||
const double | cam_kdu | ||
) |
Initialization with specific parameters using perpective projection with distortion model.
cam_px,cam_py | : pixel size |
cam_u0,cam_v0 | : principal points |
cam_kud | : undistorted to distorted radial distortion |
cam_kdu | : distorted to undistorted radial distortion |
Definition at line 217 of file vpCameraParameters.cpp.
References vpException::divideByZeroError, perspectiveProjWithDistortion, and vpERROR_TRACE.
Referenced by vpViper650::getCameraParameters(), vpViper850::getCameraParameters(), vpAfma6::getCameraParameters(), vpKinect::start(), and vpCameraParameters().
void vpCameraParameters::initPersProjWithoutDistortion | ( | const double | cam_px, |
const double | cam_py, | ||
const double | cam_u0, | ||
const double | cam_v0 | ||
) |
Initialization with specific parameters using perpective projection without distortion model.
cam_px,cam_py | : pixel size |
cam_u0,cam_v0 | : principal point |
Definition at line 180 of file vpCameraParameters.cpp.
References vpException::divideByZeroError, perspectiveProjWithoutDistortion, and vpERROR_TRACE.
Referenced by vpViper650::getCameraParameters(), vpViper850::getCameraParameters(), vpAfma6::getCameraParameters(), vpSimulatorAfma6::getCameraParameters(), vpSimulatorViper850::getCameraParameters(), vpSimulatorAfma6::initDisplay(), vpSimulatorViper850::initDisplay(), initFromCalibrationMatrix(), vpMbXmlParser::read_camera(), and vpCameraParameters().
|
inline |
Specify if the fov has been computed.
Definition at line 241 of file vpCameraParameters.h.
Referenced by vpMbtPolygon::computeRoiClipped().
vpCameraParameters & vpCameraParameters::operator= | ( | const vpCameraParameters & | cam | ) |
copy operator
Definition at line 296 of file vpCameraParameters.cpp.
void vpCameraParameters::printParameters | ( | ) |
Print the camera parameters on the standard output
Definition at line 459 of file vpCameraParameters.cpp.
References perspectiveProjWithDistortion, and perspectiveProjWithoutDistortion.
Referenced by vpCalibration::computeCalibration(), and vpCalibration::computeCalibrationMulti().
|
friend |
Print on the output stream os the camera parameters.
os | : Output stream. |
cam | : Camera parameters. |
Definition at line 490 of file vpCameraParameters.cpp.
|
friend |
Definition at line 204 of file vpCameraParameters.h.
|
friend |
Definition at line 205 of file vpCameraParameters.h.