Getting the depth image from a Real Sense camera


#1

Hi @cansik

I am trying to use your Java wrapper to get a depth image from a Real Sense D435, but I get a NullPointerException when the context is created in line 63 of RealSenseCamera.pde. Any ideas?

this.context = Context.create();


Writing Processing in Kotlin
#2

That is a bit offtopic now, but yes, the error is known and fixed in the original library. I’ve uploaded a new prebuilt library to the realsense-processing project which should fix this nullpointer.


#3

@cansik

Thanks for updating the prebuilt lib. Sorry for going offtopic again (I’m new here, please do advise me where else to ask a question like this), but I’m still having issues with it. It now gives me the following error messages, while still highlighting the line where the context is created (line 63):

A library used by this sketch is not installed properly.
No library found for org.librealsense.Native
No library found for org.librealsense.Native
No library found for org.librealsense.Native
A library relies on native code that’s not available.
Or only works properly when the sketch is run as a 32-bit application.


#4

Hi! Maybe an admin could move this question to a new thread? Proposed title: “Getting the depth image from a Real Sense camera”.


#5

I’ve since fixed the issue using the original wrapper by edwinRNDR and this script.

I found that the produced depth image was incorrect, because it wasn’t displaying depth from “deepest to nearest” but rather in multiple steps (you can see it in the background here).

I solved it by swapping line 49:

img.pixels[j] = 0xFF000000 | sArray[j];

to

img.pixels[j] = (sArray[j] / (float)6144) * (float)255;


#6

I’ve now split this off into a new topic as requested. The original Kotlin topic has a link-back below the new top post.