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

Add support for NV12 encoding in cv_bridge #544

Open
wants to merge 2 commits into
base: rolling
Choose a base branch
from

Conversation

zycczy
Copy link

@zycczy zycczy commented Feb 10, 2025

Description

This PR adds support for the NV12 encoding in the cv_bridge package. Change depends on common_interfaces PR: ros2/common_interfaces#264

The following changes have been made:

  • Added NV12 encoding to the list of supported encodings.
  • Implemented conversion codes for NV12 to GRAY, RGB, BGR, RGBA, and BGRA.
  • Updated getCvType and getEncoding functions to handle NV12 encoding.
  • Modified matFromImage to correctly handle height scaling for NV12 encoding.

Changes

  1. Encoding Support:

    • Added NV12 to the Encoding enum.
    • Updated getCvType and getEncoding functions to recognize NV12.
  2. Conversion Codes:

    • Added conversion codes for NV12 to GRAY, RGB, BGR, RGBA, and BGRA in getConversionCodes.
  3. Height Scaling:

    • Modified matFromImage to account for height scaling when the encoding is NV12.

- Update getCvType to return CV_8UC1 for NV12 encoding.
- Extend Encoding enum to include NV12.
- Enhance getEncoding to recognize NV12.
- Add conversion codes for NV12 to GRAY, RGB, BGR, RGBA, and BGRA.
- Modify conversion logic to handle NV12 as a color format.
- Adjust matFromImage to account for height scaling in NV12 images.

Signed-off-by: Zhaoyuan Cheng <[email protected]>
- Corrected the error message to include height scaling in the size calculation.
- Adjusted the formatting for better readability.

Signed-off-by: Zhaoyuan Cheng <[email protected]>
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.

1 participant