Skip to content

Conversation

machinekoder
Copy link
Contributor

This patch allows forcing MJPG steam support of the camera.

Copy link
Collaborator

@furushchev furushchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution.
If I understand correctly, when enable_mjpg is set to true and a camera device supports mjpg, image encoded as mjpg is published directly without decoding to bgr8 (as usual image), right?
If yes, I'm wondering we should use sensor_msgs/CompressedImage message instead of sensor_msgs/Image.
Another question is some image manipulation like cv::flip is supported on mjpg image?

@machinekoder
Copy link
Contributor Author

As far as I understand, this only forces the USB camera to use MJPEG encoding to transport the image from the camera to the PC, which adds additional CPU load to the PC for decoding and of course decreases the stream quality. Depending on the camera this may improve the frame rate of the capture stream. The captured image encoding in OpenCV is not affected by this change.

@machinekoder
Copy link
Contributor Author

@furushchev @awesomebytes Rebased on master. On a new camera I have here, enabling MJPG stream is necessary to unlock all resolutions.

Copy link
Member

@awesomebytes awesomebytes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, what do you think @furushchev

@awesomebytes
Copy link
Member

That said, @machinekoder would you mind adding to the documentation in the README this new option?

@machinekoder
Copy link
Contributor Author

@awesomebytes done

@furushchev
Copy link
Collaborator

furushchev commented May 7, 2025

Sorry for the delayed comment. It looks good to me.

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