![]() |
My Project
|
Simple Camera class for calculating distortions, orientation or projections with pre-calibrated camera. More...
#include <Camera.h>
Public Member Functions | |
| std::string | SerializeId () |
| One of the two methods to make this class serializable by Serialization class. | |
| bool | Serialize (Serialization *ser) |
| One of the two methods to make this class serializable by Serialization class. More... | |
| Camera () | |
| Constructor. | |
| double | GetFovX () |
| Get x-direction FOV in radians. | |
| double | GetFovY () |
| Get y-direction FOV in radians. | |
| void | SetSimpleCalib (int _x_res, int _y_res, double f_fac=1.) |
| bool | SetCalib (const char *calibfile, int _x_res, int _y_res, FILE_FORMAT format=FILE_FORMAT_DEFAULT) |
| Set the calibration file and the current resolution for which the calibration is adjusted to. More... | |
| bool | SaveCalib (const char *calibfile, FILE_FORMAT format=FILE_FORMAT_DEFAULT) |
| Save the current calibration information to a file. More... | |
| void | Calibrate (ProjPoints &pp) |
| Calibrate using the collected ProjPoints. | |
| void | SetRes (int _x_res, int _y_res) |
| If we have no calibration file we can still adjust the default calibration to current resolution | |
| void | GetOpenglProjectionMatrix (double proj_matrix[16], const int width, const int height, const float far_clip=1000.0f, const float near_clip=0.1f) |
| Get OpenGL matrix Generates the OpenGL projection matrix based on OpenCV intrinsic camera matrix K. More... | |
| void | SetOpenglProjectionMatrix (double proj_matrix[16], const int width, const int height) |
| Invert operation for GetOpenglProjectionMatrix. | |
| void | Undistort (std::vector< PointDouble > &points) |
| Unapplys the lens distortion for points on image plane. | |
| void | Undistort (PointDouble &point) |
| Unapplys the lens distortion for one point on an image plane. | |
| void | Undistort (cv::Point2f &point) |
| Unapplys the lens distortion for one point on an image plane. | |
| void | Distort (cv::Point2f &point) |
| Applys the lens distortion for one point on an image plane. | |
| void | Distort (std::vector< PointDouble > &points) |
| Applys the lens distortion for points on image plane. | |
| void | Distort (PointDouble &point) |
| Applys the lens distortion for points on image plane. | |
| void | CalcExteriorOrientation (const std::vector< cv::Point3d > &pw, const std::vector< PointDouble > &pi, cv::Mat &rodriques, cv::Mat &tra) const |
| Calculate exterior orientation. | |
| void | CalcExteriorOrientation (const std::vector< PointDouble > &pw, const std::vector< PointDouble > &pi, cv::Mat &rodriques, cv::Mat &tra) const |
| Calculate exterior orientation. | |
| void | CalcExteriorOrientation (const std::vector< PointDouble > &pw, const std::vector< PointDouble > &pi, Pose *pose) const |
| Update existing pose (in rodriques&tra) based on new observations. Use (CV_32FC3 and CV_32FC2) for matrices. | |
| void | CalcExteriorOrientation (std::vector< cv::Point3d > &pw, std::vector< cv::Point2d > &pi, Pose *pose) |
| bool | CalcExteriorOrientation (const cv::Mat &object_points, cv::Mat &image_points, Pose *pose) |
| bool | CalcExteriorOrientation (const cv::Mat &object_points, cv::Mat &image_points, cv::Mat &rodriques, cv::Mat &tra) |
| void | ProjectPoint (const cv::Point3d &pw, const Pose *pose, cv::Point2d &pi) const |
| Project one point. | |
| void | ProjectPoint (const cv::Point3f &pw, const Pose *pose, cv::Point2f &pi) const |
| Project one point. | |
| void | ProjectPoints (std::vector< cv::Point3d > &pw, Pose *pose, std::vector< cv::Point2d > &pi) const |
| Project points. | |
| void | ProjectPoints (const cv::Mat &object_points, const cv::Mat &rotation_vector, const cv::Mat &translation_vector, cv::Mat &image_points) const |
| Project points. | |
| void | ProjectPoints (const cv::Mat &object_points, double gl[16], cv::Mat &image_points) const |
| Project points. | |
| void | ProjectPoints (const cv::Mat &object_points, const Pose *pose, cv::Mat &image_points) const |
| Project points | |
Public Attributes | |
| cv::Mat | calib_K |
| double | calib_K_data [3][3] |
| cv::Mat | calib_D |
| double | calib_D_data [4] |
Protected Attributes | |
| int | calib_x_res |
| int | calib_y_res |
| int | x_res |
| int | y_res |
Simple Camera class for calculating distortions, orientation or projections with pre-calibrated camera.
| void GetOpenglProjectionMatrix | ( | double | proj_matrix[16], |
| const int | width, | ||
| const int | height, | ||
| const float | far_clip = 1000.0f, |
||
| const float | near_clip = 0.1f |
||
| ) |
Get OpenGL matrix Generates the OpenGL projection matrix based on OpenCV intrinsic camera matrix K.
Note, that the sign of the element [2][0] is changed. It should be
The sign change is due to the fact that with OpenCV and OpenGL projection matrices both y and z should be mirrored. With other matrix elements the sign changes eliminate each other, but with principal point in x-direction we need to make the change by hand.
| bool SaveCalib | ( | const char * | calibfile, |
| FILE_FORMAT | format = FILE_FORMAT_DEFAULT |
||
| ) |
Save the current calibration information to a file.
| calibfile | File to save. |
| format | FILE_FORMAT_OPENCV (default) or FILE_FORMAT_XML (see doc/Camera.xsd). |
|
inline |
One of the two methods to make this class serializable by Serialization class.
You can serialize the Camera class using filename or any std::iostream as follows:
| bool SetCalib | ( | const char * | calibfile, |
| int | _x_res, | ||
| int | _y_res, | ||
| FILE_FORMAT | format = FILE_FORMAT_DEFAULT |
||
| ) |
Set the calibration file and the current resolution for which the calibration is adjusted to.
| calibfile | File to load. |
| _x_res | Width of images captured from the real camera. |
| _y_res | Height of images captured from the real camera. |
| format | FILE_FORMAT_OPENCV (default) or FILE_FORMAT_XML (see doc/Camera.xsd). |