38 #include <boost/thread/mutex.hpp> 40 #include <calibration_msgs/CalibrationPattern.h> 41 #include <sensor_msgs/Image.h> 43 #include <opencv2/imgproc/imgproc.hpp> 55 void processPair(
const sensor_msgs::ImageConstPtr& image,
const calibration_msgs::CalibrationPatternConstPtr& features);
76 local_ns_.param(
"scaling",
scaling_, 1.0);
87 const int scaled_width = (int) (.5 + cv_image->image.cols *
scaling_);
88 const int scaled_height = (int) (.5 + cv_image->image.rows *
scaling_);
89 cv::Mat cv_image_scaled;
90 cv::resize(cv_image->image, cv_image_scaled,
91 cv::Size(scaled_width, scaled_height), 0, 0, cv::INTER_LINEAR);
94 if (features->success)
96 cv::Point2i pt0(features->image_points[0].x*
scaling_,
97 features->image_points[0].y*
scaling_);
98 cv::circle(cv_image_scaled, pt0,
marker_size_*2, cv::Scalar(0,0,255), 1) ;
99 for (
unsigned int i=0; i<features->image_points.size(); i++)
101 cv::Point2i pt(features->image_points[i].x*
scaling_,
102 features->image_points[i].y*scaling_);
103 cv::circle(cv_image_scaled, pt,
marker_size_, cv::Scalar(0,255,0), 1) ;
108 for (
unsigned int i=0; i<features->image_points.size(); i++)
110 cv::Point2i pt(features->image_points[i].x*
scaling_,
111 features->image_points[i].y*scaling_);
112 cv::circle(cv_image_scaled, pt,
marker_size_, cv::Scalar(255,0,0), 1) ;
120 ROS_ERROR(
"cv_bridge exception: %s", e.what());
124 int main(
int argc,
char** argv)
126 ros::init(argc, argv,
"image_annotator");
135 calibration_msgs::CalibrationPattern> sync(image_sub, features_sub, 5);
CvImageConstPtr toCvShare(const sensor_msgs::ImageConstPtr &source, const std::string &encoding=std::string())
void processPair(const sensor_msgs::ImageConstPtr &image, const calibration_msgs::CalibrationPatternConstPtr &features)
void publish(const boost::shared_ptr< M > &message) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL void spin(Spinner &spinner)
ros::Publisher image_pub_
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
int main(int argc, char **argv)
sensor_msgs::ImagePtr toImageMsg() const