Skip to content

Commit

Permalink
skip strange sensors and make sensor from calibration data only
Browse files Browse the repository at this point in the history
  • Loading branch information
uhlik committed Mar 3, 2020
1 parent 847454e commit 69a0fab
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion io_import_photoscan_cameras.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ def __init__(self, xml):
# self.calibration['k2'] = float(cal.find("k2").text)
# self.calibration['k3'] = float(cal.find("k3").text)

if('pixel_width' not in self.props):
self.props['pixel_width'] = self.calibration['resolution']['width']
self.props['pixel_height'] = self.calibration['resolution']['height']
self.props['focal_length'] = self.calibration['f']

sw = 0
sh = 0
ver = 0
Expand Down Expand Up @@ -334,13 +339,19 @@ def __init__(self, xml, id):

sens = self.xml.findall(".//sensor")
for s in sens:
sd = PSCSensor(s)
try:
sd = PSCSensor(s)
except:
sd = None
self.sensors.append(sd)

self.cameras = []
cams = self.xml.findall(".//camera")
for c in cams:
sensor = self.sensors[int(c.attrib["sensor_id"])]
if(sensor is None):
# TODO: unparsed sensor, skip that, deal with that later somehow.. at least notify user
continue
cam = PSCCamera(c, sensor)
self.cameras.append(cam)

Expand Down

0 comments on commit 69a0fab

Please sign in to comment.