-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Opposite color while using the depth camera by my program. #9304
Comments
@barryii , I've noticed that in the snapshots the Blue and Red hues are reversed, which leads me to think that the root-cause is in depth_image = np.asanyarray(depth_color_frame.get_data())
cv2.imwrite(f'D:\\a\\color_image_{date_time}_{loop}.jpg',color_image) The CV's default format for color-space is BGR and not RGB ( as you've correctly configured in When you extract the data of colorized depth map it is in RGB format, but then you save it using |
Hi @ev-mp I reached the same conclusion at the exact same time as you :) Thanks again. I will post my full answer to @barryii anyway! Hi @barryii Your problem does seem to be similar to #3363 The RealSense Viewer applies a range of depth colorization settings by default, whilst applications programmed by RealSense users do not apply these defaults. Post-processing filters are also not applied by default in a new script. This means that a depth image generated by a Python script can appear noticably different from a RealSense Viewer image unless colorization and post-processing settings are deliberately programmed into that script to replicate the Viewer's settings. The link below provides a range of information resources for programming colorization resources in a Python application. In the list of color schemes linked to in that list of resources, Jet is '0', which you have correctly defined in your script with colorizer.set_option(rs.option.color_scheme, 0). You have also set the color to Dynamic like the Viewer with colorizer.set_option(rs.option.visual_preset, 0) The way that you have set up depth_image = np.asanyarray(depth_color_frame.get_data()) also looks correct to me. A reversal of the colors like the one in the above images can occur due to the OpenCV color space definition, because the OpenCV default for color is BGR. |
Hi, @ev-mp, @MartyG-RealSense. OMG thank you guys so much!!! depth_image = cv2.cvtColor(depth_image, cv2.COLOR_RGB2BGR) |
You are very welcome @barryii - thanks for sharing your solution with the RealSense community! |
Before opening a new issue, we wanted to provide you with some useful suggestions (Click "Preview" above for a better view):
All users are welcomed to report bugs, ask questions, suggest or request enhancements and generally feel free to open new issue, even if they haven't followed any of the suggestions above :)
Issue Description
First, I'm not sure is this sdk that required info meant.

And my problem is when I use my program to run D435i's depth camera, its color will be the opposite of Intel RealSense Viewer v2.40.0. The color scheme is Jet. I saw there's an issue that's highly similar with my problem (#3363 ), but the way they provided below I've known and tried and it's unhelpful for my problem. Or is there any other issue that's similar with my issue, please let me know!
Intel RealSense Viewer's picture:

my program's:

It's totally opposite. I need the top one's effect.
my program:
Are there any ideas or something else I could provide? Please tell me!
The text was updated successfully, but these errors were encountered: