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 bayer images to be saved in a directory #498

Merged

Conversation

tejalbarnwal
Copy link
Contributor

@tejalbarnwal tejalbarnwal commented Mar 24, 2023

🎉 New feature

Closes gz-sensors issue 299

Sub-Tasks

  • Support simulation for BAYER_RGGB8 with OGRE
  • Extend the functionality to support all bayer types with OGRE
  • Extend the functionality to support with OGRE2

Summary and Related PRs

The functionality reads the user input and renders an RGB image, which is later converted into a single channel 8bit Bayer image using ConvertRGBToBayer() added to Utils.cc inside gz-rendering.

  • gz-sensors : Adds a switch case for RGGB bayer format inside CameraSensor.cc and passes the R8G8B8 format to render the image.
  • gz-redering : Adds ConvertRGBToBayer() to Utils.cc, modifies OgreRenderTarget.cc to call the conversion function, and handles image format conversion functions with if-else statements.
  • gz-gui : Adds switch cases to display Bayer images in Gazebo GUI inside. It treats them as single-channel 8-bit images.
  • gz-common : Modifies Image::SetFromData inside Image.cc to support saving of Bayer images. In order to save it It treats them as single-channel 8-bit images.

Test it

In order to test this, one can modify camera_sensor.sdf inside gz-sim here. Would have just to replace the part with the following snippet.

<image>
   <width>320</width>
   <height>240</height>
   <format>BAYER_RGGB8</format>
</image>
<clip>
   <near>0.1</near>
   <far>100</far>
</clip>
<save enabled="true">
    <path>path to the folder</path>
</save>

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@tejalbarnwal tejalbarnwal requested a review from marcoag as a code owner March 24, 2023 19:06
@github-actions github-actions bot added 🌱 garden Ignition Garden 🎵 harmonic Gazebo Harmonic labels Mar 24, 2023
@tejalbarnwal tejalbarnwal changed the title Pr gz common5 support bayer images Add support for bayer images to Ogre and Ogre2 Mar 24, 2023
@tejalbarnwal tejalbarnwal changed the title Add support for bayer images to Ogre and Ogre2 Add support for bayer images to be saved in a directory Mar 24, 2023
graphics/src/Image.cc Outdated Show resolved Hide resolved
graphics/src/Image.cc Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Apr 24, 2023

Codecov Report

Merging #498 (1c1cebd) into gz-common5 (95320c3) will decrease coverage by 0.05%.
The diff coverage is 0.00%.

❗ Current head 1c1cebd differs from pull request most recent head 44c5be6. Consider uploading reports for the commit 44c5be6 to get more accurate results

@@              Coverage Diff               @@
##           gz-common5     #498      +/-   ##
==============================================
- Coverage       83.71%   83.67%   -0.05%     
==============================================
  Files              90       90              
  Lines           10242    10247       +5     
==============================================
  Hits             8574     8574              
- Misses           1668     1673       +5     
Impacted Files Coverage Δ
graphics/src/Image.cc 88.82% <0.00%> (-1.33%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@iche033 iche033 dismissed ahcorde’s stale review April 24, 2023 20:20

comment addressed

@iche033 iche033 merged commit 9f1b671 into gazebosim:gz-common5 Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden 🎵 harmonic Gazebo Harmonic
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Bayer images not supported
3 participants