-
Notifications
You must be signed in to change notification settings - Fork 42
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 function to convert single channel image data to RGB image #205
Conversation
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Codecov Report
@@ Coverage Diff @@
## ign-common3 #205 +/- ##
===============================================
+ Coverage 75.08% 75.20% +0.12%
===============================================
Files 72 73 +1
Lines 10273 10307 +34
===============================================
+ Hits 7713 7751 +38
+ Misses 2560 2556 -4
Continue to review full report at Codecov.
|
T v = static_cast<T>(buffer[i]); | ||
if (v > max && !std::isinf(v)) | ||
max = v; | ||
if (v < min && !std::isinf(v)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Windows is not happy about these isinf
calls with uint8_t
:
Compiler error
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_math.h(409): error C2668: 'fpclassify': ambiguous call to overloaded function
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_math.h(300): note: could be 'int fpclassify(long double) noexcept'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_math.h(295): note: or 'int fpclassify(double) noexcept'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_math.h(290): note: or 'int fpclassify(float) noexcept'
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt\corecrt_math.h(409): note: while trying to match the argument list '(_Ty)'
with
[
_Ty=uint8_t
]
C:\Jenkins\workspace\ignition_common-ci-pr_any-windows7-amd64\ws\ign-common\graphics\include\ignition/common/Image.hh(226): note: see reference to function template instantiation 'bool isinf<T>(_Ty) noexcept' being compiled
with
[
T=uint8_t,
_Ty=uint8_t
]
C:\Jenkins\workspace\ignition_common-ci-pr_any-windows7-amd64\ws\ign-common\graphics\src\Image_TEST.cc(351): note: see reference to function template instantiation 'void ignition::common::Image::ConvertToRGBImage<uint8_t>(const void *,unsigned int,unsigned int,ignition::common::Image &,T,T,bool)' being compiled
with
[
T=uint8_t
]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\xstring(1739): note: see reference to class template instantiation 'std::basic_string_view<char,std::char_traits<char>>' being compiled
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An approach to remove new/delete
as well as the raw pointers: #206
Signed-off-by: Michael Carroll <michael@openrobotics.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🎉 New feature
Summary
Used by gazebosim/gz-gui#212 and gazebosim/gz-launch#112
Added a generic helper function for converting single channel image data, e.g. thermal and depth images, to an RGB image. This is intended to be used for visualization. Optional arguments can be specified to tweak the visualization.
Test it
The corresponding PRs in ign gui updates the Image Display to use this new function: gazebosim/gz-gui#212
You can test this together with that PR by running the
sensors_demo.sdf
world to see the visualization in Image DisplayChecklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge