Tiny optimization

This commit is contained in:
nsubiron 2017-12-01 16:50:03 +01:00
parent 44361cf11e
commit f181c5e406
1 changed files with 2 additions and 2 deletions

View File

@ -87,8 +87,8 @@ def depth_to_array(image):
array = to_bgra_array(image)
array = array.astype(numpy.float32)
# Apply (R + G * 256 + B * 256 * 256) / (256 * 256 * 256 - 1).
normalized_depth = numpy.dot(array[:, :, :3], [256.0 * 256.0, 256.0, 1.0])
normalized_depth /= (256.0 * 256.0 * 256.0 - 1.0)
normalized_depth = numpy.dot(array[:, :, :3], [65536.0, 256.0, 1.0])
normalized_depth /= 16777215.0 # (256.0 * 256.0 * 256.0 - 1.0)
return normalized_depth