Closed Teufeuleu closed 1 year ago
That is (technically) expected behavior. I recommend you use @distmeter 0
so that you receive millimeters with your @type long
Depth long
output is an integer and has no fractional values. Therefore its possible values when @distmeter 1
are only 0,1,2,3,4,5,6,7,8. With @distmeter 0
output is in millimeters and therefore can be the integer range 0-8000.
Or...you could keep @distmeter 1
and output floats. Then use Max's jitter operators to multiply that by a number (like 1000) which changes 1.5 meter depth to 1500.0 mm depth. And then force the Jitter matrix into a long
. It really depends on what processing you need to do after dp.kinect2 outputs the depth matrix. You have flexible choice :-)
I knew I missed some attribute. Thanks!
No worries. I've added this scenario to the new documentation (work in progress) https://docs.hidale.com/max/attributes/distmeter/
Description
I use [dp.kinect2 @depthmap 1 @type long] in order to perform bitwise operations on the depth matrix. The main goal is to record a video I can use as in the three.js kinect webgl example, which implies encoding depth as RGB values (as shown in this modified freenect file).
However, the long matrix output seems to only be the truncated values of the float32/64 output. As a proof, a [jit.3m] gives, say 0 as min, 1.9 as mean and 7.9 as max for a float32/64 output, while the long output gives 0, 1.4 and 7 respectively. I would expect the long output to keep the same resolution as a float32/64 output, and not being a truncated version of it with the equivalent of a 3bit resolution.
Setup
Steps to reproduce
Result
The long matrix output seems to only be the truncated values of the float32/64 output.
Expected Result
I would expect the long output to keep the same resolution as a float32/64 output, and not being a truncated version of it with the equivalent of a 3bit resolution..
Workarounds
A workaround might be to somehow translate the float64 output as a long, but I'm not sure how to do it without loss of information. All my attempts have failed so far.
Max console output with @verbose 1:
Nothing special (last 3 lines are only when opening the device, then it runs smoothly)