Skip to content

Commit

Permalink
Added rgb_image_header to BoundingBoxes msg.
Browse files Browse the repository at this point in the history
  • Loading branch information
firephinx committed Feb 5, 2018
1 parent 97421de commit d175e18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions darknet_ros/include/darknet_ros/YoloObjectDetector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

// ROS
#include <ros/ros.h>
#include <std_msgs/Header.h>
#include <std_msgs/Int8.h>
#include <actionlib/server/simple_action_server.h>
#include <sensor_msgs/image_encodings.h>
Expand Down Expand Up @@ -195,6 +196,7 @@ class YoloObjectDetector
int fullScreen_;
char *demoPrefix_;

std_msgs::Header rgb_image_header_;
cv::Mat camImageCopy_;
boost::shared_mutex mutexImageCallback_;

Expand Down
2 changes: 2 additions & 0 deletions darknet_ros/src/YoloObjectDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ void YoloObjectDetector::cameraCallback(const sensor_msgs::ImageConstPtr& msg)

try {
cam_image = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::BGR8);
rgb_image_header_ = msg->header;
} catch (cv_bridge::Exception& e) {
ROS_ERROR("cv_bridge exception: %s", e.what());
return;
Expand Down Expand Up @@ -603,6 +604,7 @@ void *YoloObjectDetector::publishInThread()
}
boundingBoxesResults_.header.stamp = ros::Time::now();
boundingBoxesResults_.header.frame_id = "detection";
boundingBoxesResults_.rgb_image_header = rgb_image_header_;
boundingBoxesPublisher_.publish(boundingBoxesResults_);
} else {
std_msgs::Int8 msg;
Expand Down
1 change: 1 addition & 0 deletions darknet_ros_msgs/msg/BoundingBoxes.msg
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Header header
Header rgb_image_header
BoundingBox[] boundingBoxes

0 comments on commit d175e18

Please sign in to comment.