librealsense icon indicating copy to clipboard operation
librealsense copied to clipboard

Depth data/alignment sometimes corrupted on camera startup with OpenMP off (.NET)

Open jb455 opened this issue 8 years ago • 6 comments

Required Info
Camera Model D400
Firmware Version 05.08.15.00
Operating System & Version Win 10 1709
Platform PC, .NET, x64
SDK Version 2.10.0 compiled without OpenMP

Hi, I compiled the DLL without OpenMP to fix the high CPU usage problem. However, when using this version of the DLL (the precompiled version doesn't show this behaviour) I get some strange behaviour when starting up the streams. Firstly, this is what I should see when the camera is streaming: image The image is coloured by the (aligned) depth. If the depth of a pixel is within a pre-defined range it's normal colour, if it's outside of that range but still has depth data it's tinted red, and if there's no depth data (z = 0) it's coloured dark grey.

Sometimes when starting the streams (the code to start the camera is always the same; I'm using 1920x1080 colour and 848x480 depth) I get the following: image Depth data is all zero. Usually stopping the camera, waiting a few seconds, then starting it again will fix this.

image Alignment is out. Usually if it starts doing this, I need to restart the app completely to get it normal again.

One of the above two scenarios happens probably about 50% of the time I start the camera. The following two are much rarer than that. image A small line of depth data in the centre of the image. image Alignment completely out and lots of poor depth areas.

I initially thought this may be due to how I'm closing the camera as it seems to happen more often when closing the camera (not the app) and starting it again within a few seconds, but it occasionally happens the first time the app is opened too. I shut the camera down by calling pipeline.Stop() and pipeline.Dispose(). Is there anything else I should be doing? Does disposing the pipeline also dispose of all child objects or do I need to dispose of everything individually? Or is this just one of the issues that having OpenMP enabled solves? As I said, using the standard DLL fixes this issue but CPU usage goes to around 80-90% vs around 20% with openMP off so I'd rather have it turned off if possible to support lower-powered devices.

Thanks, James

jb455 avatar Feb 14 '18 10:02 jb455

Does the same thing happen if you compile with OpenMP and not use the precompiled dll?

zivsha avatar Feb 14 '18 12:02 zivsha

Not as regularly, but yes.

jb455 avatar Feb 14 '18 13:02 jb455

Hi @jb455 Is this problem reproducible on another PC with pre-built examples? I am cautious not to call it a hardware issue, but this seems completely abnormal and might be indicative of some severe problem with the device / platform.

dorodnic avatar Feb 25 '18 16:02 dorodnic

[Realsense Customer Engineering Team Comment] @jb455 Is the problem can be reproduced by other machine?

Hi sorry, I've been using precompiled binaries without any problems. I don't really have time to try reproducing this now, but if no-one else has seen these issues then it must be something to do with my machine and/or code. In any case, it's not a problem for me now so I'll close this issue.

jb455 avatar Apr 16 '18 08:04 jb455

OpenMP 100% CPU usage can be solved by settings environment variable OMP_WAIT_POLICY=PASSIVE

ogoshen avatar May 23 '18 09:05 ogoshen