37 #include <boost/assign.hpp> 44 DiagnosticNodelet::onInit();
45 pub_ = advertise<sensor_msgs::CameraInfo>(*
pnh_,
"output", 1);
55 ros::V_string names = boost::assign::list_of(
"~input")(
"~input/camera_info");
66 const sensor_msgs::CameraInfo::ConstPtr& info_msg)
73 const geometry_msgs::PolygonStamped::ConstPtr& rect_msg)
78 geometry_msgs::Point32 P0 = rect_msg->polygon.points[0];
79 geometry_msgs::Point32 P1 = rect_msg->polygon.points[1];
80 double min_x = std::max(std::min(P0.x, P1.x), 0.0f);
81 double max_x = std::max(P0.x, P1.x);
82 double min_y = std::max(std::min(P0.y, P1.y), 0.0f);
83 double max_y = std::max(P0.y, P1.y);
86 roi.roi.x_offset = (
int)min_x;
87 roi.roi.y_offset = (
int)min_y;
88 roi.roi.height = height;
89 roi.roi.width = width;
#define NODELET_ERROR(...)
void publish(const boost::shared_ptr< M > &message) const
sensor_msgs::CameraInfo::ConstPtr latest_camera_info_
PLUGINLIB_EXPORT_CLASS(jsk_perception::RectToROI, nodelet::Nodelet)
virtual void unsubscribe()
virtual void infoCallback(const sensor_msgs::CameraInfo::ConstPtr &info_msg)
std::vector< std::string > V_string
ros::Subscriber sub_rect_
virtual void rectCallback(const geometry_msgs::PolygonStamped::ConstPtr &rect_msg)
ros::Subscriber sub_info_