Skip to content

Commit

Permalink
Add arbitrary dtype images
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro authored and k-okada committed Mar 19, 2017
1 parent f4f9a1b commit 755bfae
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/nodelet/adding_images_nodelet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ namespace adding_images {
// Work on the image.
try {
cv::Mat image1 =
cv_bridge::toCvShare(image_msg1, sensor_msgs::image_encodings::BGR8)->image;
cv_bridge::toCvShare(image_msg1, image_msg1->encoding)->image;
cv::Mat image2 =
cv_bridge::toCvShare(image_msg2, sensor_msgs::image_encodings::BGR8)->image;
cv_bridge::toCvShare(image_msg2, image_msg2->encoding)->image;

cv::Mat result_image;
cv::addWeighted(image1, alpha_, image2, beta_, gamma_, result_image);
Expand All @@ -183,9 +183,8 @@ namespace adding_images {
cv::imshow(window_name_, result_image);
int c = cv::waitKey(1);
}
// publish bgr8 image
img_pub_.publish(cv_bridge::CvImage(image_msg1->header,
sensor_msgs::image_encodings::BGR8,
image_msg1->encoding,
result_image).toImageMsg());

} catch (cv::Exception& e) {
Expand Down

0 comments on commit 755bfae

Please sign in to comment.