by Dr Mike
Posted on July 2018
This time I just wanted to clarify something a few readers have been asking: what the actual depth measurements that Orbbec Astra Pro gives? Some seem to think it is something like 6 meters only. Well, what would a scientist do other than go and run an empirical test?
Here is a simple code snippet for visualizing distance ranges in a nice way. You can use it as your personal CT scanner to slice the real world.
Basically, what I've done here is based on the Unity SDK's default DepthTextureRenderer which allows us to turn every depth pixel into a color pixel on the screen. I've modified it to show different color for all the pixels within a specified range in millimeters. Also I added simple calculations for finding the far and near pixels as well as the average distance of all pixels. One thing to note here is that there are a lot of empty depth pixels that we should not count in. I visualize those in a different color, so we can see the difference.
Let's call our creation DepthDistanceDebugger. Here's what it does in plain C#. First, let's do some settings in Unity Editor:
Then a few more things to complete the layout:
Finally, bind the UI elements to our script.
Then the interesting part. Testing time! We'd obviously need two test cases:
And against what are we testing? Probably the official numbers provided by Orbbec: 0.6-8 meters. Ok, so if you did your Editor settings correctly, you'd be seeing something like this. It's all yellow for measured pixels and or cyan for empty ones. I've turned the sensor toward a door to the hallway which has way more than 10 meters empty space until the back wall of the next room.
Then let's drag the first slider down to about 3.5 meters. Nicely everything in the background turns to the original grayscale color whereas everything near remains yellow.
Then let's try the nearest pixels. Let the minimum be at 0 and maximum at 860mm. Looks about right. The nearest pixel seems to be at 831mm where my diagonally aligned TV screen appears first in the image.
Then let's try something in the middle. If I go stand at the doorway you see not much more than my silhouette as I set my sliders to make the range to be 5-6 meters. At this point is is getting obvious that the depth pixel farthest from the sensor is constantly at 9851mm.
Now if I drag the minimum range to above 9851mm I get nothing but the original gray and empty pixels. The next room's back wall looks black now as it hit the maximum range of the depth scale.
Let's slice a bit back just below the farthest depth value, here 8767. Now the back wall appears yellow exactly as expected.
How about the close range then? Let's try to block the sensor completely by moving the hand nearer and nearer to the camera. You can just about see my thumbs up gesture in the middle of the image. Nearest pixel is at 472mm.
Now the interesting thing: As my hand gets closer to the sensor, just after 443mm it goes blank. You won't see anything much about my hand anymore at any closer distance.
And then the part where I tell you "do not try this at home". As I keep closing in to cover the sensor altogether, the DLLs go nuts. Some funny unhandled exception in the SDK, I suppose.
Now, if you keep testing like this you'll come to the same conclusion as I did:
We can conclude that the maximum is solid whereas the minimum is a bit more obscure. But at least we can get almost 10 meter range of the raw values of the depth pixels. Compared to the official range of 0.6-8 meters we do get depth pixel values at 0.44-9.85 meters. But I suppose the reliability is not good below 0.6 and above 8 meters to be officially recommended as the depth measurement range.
Now we know.
© 2014-2018 Improventions. All rights reserved.
Created by MGWalton
Powered by coconuts