Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting of pixel format (bgr8 and rgb8 are supported) #47

Closed
wants to merge 1 commit into from

Conversation

J-Rojas
Copy link

@J-Rojas J-Rojas commented Jul 18, 2019

Partial Fix for #46. Support bgr8 and rgb8 formats. The format can be selecting using the "output_pixel_encoding" parameter. The capture node will convert from BGR to RGB format before enqueuing the frame.

@awesomebytes
Copy link
Member

Looks good to me, what do you reckon @furushchev

@furushchev
Copy link
Collaborator

@awesomebytes I will test it tomorrow 👍

@furushchev
Copy link
Collaborator

@J-Rojas Thank you for sending the PR.
I understood what you want to do. However, it limits the format to only bgr8 and rgb8 regardless of many formats supported in OpenCV.
I basically suggest to convert color space in subscriber nodes since OpenCV natively treat image data as bgr8 by default and there is no difference in performance whether color space conversion is in this node or subscribers.

Converting to RGB8 color space in subscriber nodes can be done very easily by using cv_bridge package, where you only need to set encoding to "bgr8" when you get cv::Mat from image message via toCvCopy or toCvShare.
Please see the tutorial:
http://wiki.ros.org/cv_bridge/Tutorials/UsingCvBridgeToConvertBetweenROSImagesAndOpenCVImages#cv_bridge.2BAC8-Tutorials.2BAC8-UsingCvBridgeCppHydro.CA-51364fcf5e26ba1de20c6a29f5814a956784abf9_39

Hope it helps you with solving your issue.

@J-Rojas
Copy link
Author

J-Rojas commented Jul 23, 2019

Thanks for reviewing. This library is meant to assist people who are converting movie files to image streams. I decided it would be very simple to run this node and convert the images. I didn't want to create yet another node to handle conversions. Ideally the output format is configurable to add this convenience to users of the library so they do not need to do additional work for conversion.

@furushchev
Copy link
Collaborator

@J-Rojas OK, I created another PR to support other than "bgr8" and "rgb8" #50.
Please check if it is ok.

@J-Rojas
Copy link
Author

J-Rojas commented Sep 4, 2019

Closing, this is addressed with PR#50.

#50

@J-Rojas J-Rojas closed this Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants