forked from SICKAG/sick_visionary_python_base
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnitConversion.py
More file actions
24 lines (19 loc) · 801 Bytes
/
UnitConversion.py
File metadata and controls
24 lines (19 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import logging
import numpy as np
def convertDistanceToMM(data, xmlParser):
"""
data: The distance data that should be converted to millimeters
xmlParser: XML parser which has parsed the corresponding xml segment
"""
# Raw output of the devices (before applying exponent)
#
# Visionary S (default mode): Tenth mm
# Visionary S (65 meter mode): mm
# Visionary T: mm
# Visionary T Mini: quarter mm (not corrected via decimal exponent)
conversionFactor = 10**xmlParser.decimalExponentDistance
if xmlParser.tofmini:
conversionFactor /= 4.0
logging.info("Converting depth map to millimeters (multiplying with factor {}).".format(
conversionFactor))
return np.multiply(data, conversionFactor)