Skip to content

Commit

Permalink
[image_view2] Visualize label image to rgb
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Nov 26, 2015
1 parent 560d701 commit 9f4d57f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
16 changes: 15 additions & 1 deletion jsk_ros_patch/image_view2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@
cmake_minimum_required(VERSION 2.8.3)
project(image_view2)

find_package(catkin REQUIRED COMPONENTS roscpp dynamic_reconfigure cv_bridge std_msgs sensor_msgs geometry_msgs image_transport tf image_geometry message_filters message_generation std_srvs)
find_package(catkin REQUIRED COMPONENTS
cv_bridge
dynamic_reconfigure
geometry_msgs
image_geometry
image_transport
jsk_recognition_utils
message_generation
message_filters
roscpp
sensor_msgs
std_msgs
std_srvs
tf
)

generate_dynamic_reconfigure_options(
cfg/ImageView2.cfg
Expand Down
6 changes: 6 additions & 0 deletions jsk_ros_patch/image_view2/image_view2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@

#include "image_view2.h"
#include <exception>
#include <jsk_recognition_utils/cv_utils.h>


namespace image_view2{
ImageView2::ImageView2() : marker_topic_("image_marker"), filename_format_(""), count_(0), mode_(MODE_RECTANGLE), times_(100), window_initialized_(false),space_(10)
{
Expand Down Expand Up @@ -1176,6 +1179,9 @@ namespace image_view2{
double min, max;
cv::minMaxIdx(input_image, &min, &max);
cv::convertScaleAbs(input_image, original_image_, 255 / max);
} else if (msg->encoding == sensor_msgs::image_encodings::TYPE_32SC1) {
cv::Mat input_image = cv_bridge::toCvCopy(msg)->image;
jsk_recognition_utils::labelToRGB(input_image, original_image_);
} else {
try {
original_image_ = cv_bridge::toCvCopy(msg, sensor_msgs::image_encodings::BGR8)->image;
Expand Down
1 change: 1 addition & 0 deletions jsk_ros_patch/image_view2/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<build_depend>sensor_msgs</build_depend>
<build_depend>geometry_msgs</build_depend>
<build_depend>image_transport</build_depend>
<build_depend>jsk_recognition_utils</build_depend>
<build_depend>tf</build_depend>
<build_depend>image_geometry</build_depend>
<build_depend>message_filters</build_depend>
Expand Down

0 comments on commit 9f4d57f

Please sign in to comment.