Skip to content

Commit

Permalink
image_view_node: support bayer images (#1046)
Browse files Browse the repository at this point in the history
so far bayer images always failed with an error:
```
[ERROR] [..] [image_view_node]: Unable to convert 'bayer_rggb8' image for display: 'cv_bridge.cvtColorForDisplay() does not have an output encoding                that is color or mono, and has is bit in depth'
```

the `stereo_view_node` on the other hand already supports bayer images,
however it always forcibly converts them to monochrome, even if they are
colour images.

for now, this adds the same logic for the single-image viewer and thus
only partially resolves #1045.
  • Loading branch information
rursprung authored Dec 10, 2024
1 parent bb4ab63 commit 6ff605c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions image_view/src/image_view_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ void ImageViewNode::imageCb(const sensor_msgs::msg::Image::ConstSharedPtr & msg)

std::string encoding = msg->encoding.empty() ? "bgr8" : msg->encoding;

// May want to view raw bayer data
if (encoding.find("bayer") != std::string::npos) {
encoding = "mono8";
}

queued_image_.set(
cv_bridge::cvtColorForDisplay(
cv_bridge::toCvShare(msg), encoding, options));
Expand Down

0 comments on commit 6ff605c

Please sign in to comment.