-
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
How to get Color Frame? #5571
Comments
What is the format of the colour data in the config - RGB8 or BGR8 or YUYV? |
The problem you are facing is not related to the librealsense but rather OpenCV. You should read about how image data is stored, specially in OpenCV like different types of Mat like 8UC3 or 16UC1 etc. And lastly the code you have pasted, at least rename the variables correctly. The variable name suggests something and the underlying data type is something different altogether. Anyways here is the code you are looking for, assuming you have started the stream with RGB8:
|
try (Config config = new Config()) {
|
Stream it with RGB8 it will not require OpenCV conversion else the image will have inverted B and R channel. Look at the code pasted above. |
Thanks Kafan, we are getting the following error with the above code "Mat data type is not compatible: 18" |
Made changes to the original code. Should work now. |
Thanks a lot, kafan. It is working now. Does the same code work for InfraRed Frame? or any changes to be made?. |
I have never worked with infrared stream but if it is Y8 then it means grayscale data that will be 8UC1, thus with minor changes it should work. Just change the following line to below
|
Thanks Kafan, it is working for infrared. We have an issue with the depth image. Please find attached the depth image. Could you please help us with it. The following is the code for generating the depth image DepthFrame depthFrame = frame.as(Extension.DEPTH_FRAME); |
Somehow I never get the depth map converted to Mat directly using OpenCV. I had to use NDK and call the C++ code to convert it, which is faster, but if speed is not an issue, below code will work but takes few ms more, at least it is pure java. Also do search previous issues first. This was already answered in previous thread #5446 DepthFrame depthFrame = frame.as(Extension.DEPTH_FRAME); |
Thanks kafan. Can you please give us any sample to get depth image using c++. |
Mat(Size(w, h), CV_8UC3, (void *) f.get_data(), Mat::AUTO_STEP); |
Thanks Kafan. We are able to get the depth, color and infrared image from frames. Please find attached images. " |
That is expected behaviour. In the Intel-RealSense-D400-Series-Datasheet pdf, you can go to section 4.5 about "Invalid Depth Band", to find out the reason. In short, the depth is calculated with respect to the left stereo camera but due to lateral shift of the right camera w.r.t to left camera, there is a blind spot that happens on the extreme left edge of the left camera, where right camera can not gather the image data. Thus stereo matching can not happen. |
Also I think you are using the d435 camera. The color Camera has a different field of view. 65hfov instead of 90hfov of the depth camera. |
Has the comment provided by @kafan1986 helped to find an answer to your question regarding depth data at the left edge of the frame? Please let us know if you need any further clarifications regarding this specific topic. Thank you for the informative answers! |
@RealSenseCustomerSupport All the issues were solved with the help of @kafan1986. Really with the help of @kafan1986 we were able to complete our programming so fast. Thanks @kafan1986 for your support. We will reach out @kafan1986 if we need any help furthur. |
May I ask a non-related question? This code looks like Java for Android. In order to run IntelRealsense on Android is there still a rooted device necessary or is this obsolete meanwhile? Asking this because I didn’t had success with an ordinary device up to now. TIA |
@neilyoung The android SDK will work on non-rooted device. I think they introduced non-rooted support sometime early last year, probably around 2.19 version. So current 2.31 works fine with some known issues with stability etc. Also, I think android SDK is currently having problem with android 10 and intel team is working with android team for the same. Compatibility looks OK for android 7, 8 and 9 |
@kafan1986 Very nice. Thanks for clarification. |
The above is the code written to get the RGB image(Color Image), we are unable to get the single image, but in the single image we are getting the same face image twice. Please find attached image for reference. Could you please help us to fix this issue?
The text was updated successfully, but these errors were encountered: