-
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
Convert depth frame to Bitmap and save .png (Android) #5446
Comments
@vshalkov You are facing the issue because you are trying to convert a 16UC1 mat to bitmap directly. In this case you need to convert it to 8UC1 mat first then to convert to bitmap using your code. But this will give you a gray image (black and white). To achieve what you have asked, either then you can use applyColorMap yourself to get the visualization that you desire (there are multiple colourmap in opencv) https://www.learnopencv.com/applycolormap-for-pseudocoloring-in-opencv-c-python/ Or a easier approach is to use a post processing filter rs2::colorizer on your depth data which achieves the same thing with "Jet" scheme colour visualization and converts the 16UC1 depth data to 8UC3 RGB data, then you can use the same code that you use for colorFrame to save the image. |
@kafan1986 I do not know how to initialize a variable (mRGB) correctly that the conversion was successful:
OR:
or something else? Convert code:
Now I can’t check the code that I wrote, but I would be grateful if you had thrown off the working code or link |
I have not tested the code below and there may be typos. Let me know if this works.
|
@kafan1986 Hello!
the program freezes when this code starts to run:
|
then stick with your existing code, for this part.
|
@kafan1986 Thank you, yes it's work! |
Issue Description
Hello, I need your help.
I use RealSense SDK for Android OS https://github.com/IntelRealSense/librealsense/tree/master/wrappers/android
init
I can convert color frame to Mat and Mat convert to Bitmap and Bitmap save to .png
Frame (this code is work):
But if i want to get this image from frame, it's not work:
I use this code for get depth Mat in FrameReleaser() :
And when i want to convert Mat to Bitmap, android app freezes and don't work:
Code convert:
Please help me.
How i can to save depth frame to .png?
The text was updated successfully, but these errors were encountered: