43 #include <geometry_msgs/TransformStamped.h> 45 #include <sensor_msgs/CameraInfo.h> 46 #include <visualization_msgs/Marker.h> 75 bool AddPointsUsingMarkers(std::vector<PointDouble> &marker_corners, std::vector<PointDouble> &marker_corners_img, IplImage*
image);
86 CvMat calib_K;
double calib_K_data[3][3];
87 CvMat calib_D;
double calib_D_data[4];
97 void camInfoCallback (
const sensor_msgs::CameraInfoConstPtr &);
102 bool LoadCalibXML(
const char *calibfile);
103 bool LoadCalibOpenCV(
const char *calibfile);
104 bool SaveCalibXML(
const char *calibfile);
105 bool SaveCalibOpenCV(
const char *calibfile);
137 if (!ser->
Serialize(calib_x_res,
"width"))
return false;
138 if (!ser->
Serialize(calib_y_res,
"height"))
return false;
139 if (!ser->
Serialize(calib_K,
"intrinsic_matrix"))
return false;
140 if (!ser->
Serialize(calib_D,
"distortion"))
return false;
149 void SetCameraInfo(
const sensor_msgs::CameraInfo& camInfo);
153 return (2.0
f * atan2(
double(x_res) / 2.0
f, (
double)calib_K_data[0][0]));
157 return (2.0
f * atan2(
double(y_res) / 2.0
f, (
double)calib_K_data[1][1]));
160 void SetSimpleCalib(
int _x_res,
int _y_res,
double f_fac=1.);
168 bool SetCalib(
const char *calibfile,
int _x_res,
int _y_res,
181 void SetRes(
int _x_res,
int _y_res);
202 void GetOpenglProjectionMatrix(
double proj_matrix[16],
const int width,
const int height,
const float far_clip = 1000.0
f,
const float near_clip = 0.1
f);
205 void SetOpenglProjectionMatrix(
double proj_matrix[16],
const int width,
const int height);
208 void Undistort(std::vector<PointDouble >& points);
214 void Undistort(CvPoint2D32f& point);
217 void Distort(CvPoint2D32f& point);
220 void Distort(std::vector<PointDouble>& points);
226 void CalcExteriorOrientation(std::vector<CvPoint3D64f>& pw, std::vector<CvPoint2D64f>& pi,
Pose *pose);
230 void CalcExteriorOrientation(std::vector<CvPoint3D64f>& pw, std::vector<PointDouble >& pi,
231 CvMat *rodriques, CvMat *tra);
235 void CalcExteriorOrientation(std::vector<PointDouble >& pw, std::vector<PointDouble >& pi,
236 CvMat *rodriques, CvMat *tra);
240 void CalcExteriorOrientation(std::vector<PointDouble>& pw, std::vector<PointDouble >& pi,
Pose *pose);
243 bool CalcExteriorOrientation(
const CvMat* object_points, CvMat* image_points,
Pose *pose);
246 bool CalcExteriorOrientation(
const CvMat* object_points, CvMat* image_points, CvMat *rodriques, CvMat *tra);
249 void ProjectPoint(
const CvPoint3D64f pw,
const Pose *pose, CvPoint2D64f &pi)
const;
252 void ProjectPoint(
const CvPoint3D32f pw,
const Pose *pose, CvPoint2D32f &pi)
const;
255 void ProjectPoints(std::vector<CvPoint3D64f>& pw,
Pose *pose, std::vector<CvPoint2D64f>& pi)
const;
259 void ProjectPoints(
const CvMat* object_points,
const CvMat* rotation_vector,
260 const CvMat* translation_vector, CvMat* image_points)
const;
264 void ProjectPoints(
const CvMat* object_points,
double gl[16], CvMat* image_points)
const;
267 void ProjectPoints(
const CvMat* object_points,
const Pose* pose, CvMat* image_points)
const;
281 void Find(
const std::vector<PointDouble>& pw,
const std::vector<PointDouble>& pi);
284 void ProjectPoints(
const std::vector<PointDouble>& from, std::vector<PointDouble>& to);
std::string SerializeId()
One of the two methods to make this class serializable by Serialization class.
double GetFovX()
Get x-direction FOV in radians.
std::string cam_info_topic
std::vector< int > point_counts
Vector indicating how many points are detected for each frame.
Simple Homography class for finding and projecting points between two planes.
bool Serialize(Serialization *ser)
One of the two methods to make this class serializable by Serialization class.
Simple Camera class for calculating distortions, orientation or projections with pre-calibrated camer...
bool Serialize(int &data, const std::string &name)
Method for serializing 'int' data element. Used from your serializable class.
std::vector< CvPoint3D64f > object_points
3D object points corresponding with the detected 2D image points.
sensor_msgs::CameraInfo cam_info_
Simple structure for collecting 2D and 3D points e.g. for camera calibration.
Pose representation derived from the Rotation class
double GetFovY()
Get y-direction FOV in radians.
This file implements generic utility functions and a serialization interface.
std::vector< CvPoint2D64f > image_points
Detected 2D object points If point_counts[0] == 10, then the first 10 points are detected in the firs...
ALVAR_EXPORT Point< CvPoint2D64f > PointDouble
The default double point type.
This file implements a pose.
Class for serializing class content to/from file or std::iostream.
This file defines library export definitions, version numbers and build information.
std::string cameraInfoTopic_