00001 #ifndef __CameraModelPointCorrector__ 00002 #define __CameraModelPointCorrector__ 00003 00004 #include <image_geometry/pinhole_camera_model.h> 00005 00006 #include <sensor_msgs/CameraInfo.h> 00007 00008 #include "EdgeDetection/PointCorrector.h" 00009 #include "EdgeDetection/Vector2.h" 00010 00011 class CameraModelPointCorrector : public EdgeDetection::PointCorrector 00012 { 00013 private: image_geometry::PinholeCameraModel cameraModel; 00014 00015 public: EdgeDetection::Vector2 CorrectPoint(EdgeDetection::Vector2 point) 00016 { 00017 Point2d rawPoint(point.GetX(), point.GetY()); 00018 Point2d correctedPoint = cameraModel.rectifyPoint(rawPoint); 00019 00020 return EdgeDetection::Vector2(correctedPoint.x, correctedPoint.y); 00021 } 00022 public: void updateCameraModel(const sensor_msgs::CameraInfoConstPtr& cameraInfo) 00023 { 00024 cameraModel.fromCameraInfo(cameraInfo); 00025 } 00026 public: void updateCameraModel(sensor_msgs::CameraInfo& cameraInfo) 00027 { 00028 cameraModel.fromCameraInfo(cameraInfo); 00029 } 00030 }; 00031 00032 #endif