Getting the depth image from a Real Sense camera

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();

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.

1 Like


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.

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


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];


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

1 Like

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.


You should tell me the at least the OS you are using, otherwise it‘s not possible to help you. And it seems you are using windows, which was not supported by the proof of concept.

But there is now a library with prebuilt libs for all OS in the repo.

Sorry, yes, I am using Windows. I have actually implemented a workaround in the form of a C++ executable that I launch from my Processing sketch. It’s ugly but from there I can make the changes to the RealSense devices that I need for my program.

Grüezi in d Schwiz