stuarta0 / blender-photogrammetry

Blender addon for structure from motion tools to allow dense point cloud reconstruction from Blender's camera tracker
260 stars 25 forks source link

ImageModeler rzi import issue. #16

Open Colbertson opened 3 years ago

Colbertson commented 3 years ago

Using version 1.1-linux. Occasionally some files can't be imported, while others work perfectly fine.

Python: Traceback (most recent call last):
  File "/home/colby/.config/blender/2.92/scripts/addons/blender_photogrammetry/__init__.py", line 76, in execute
    data = inputs[p.input].func(extract_props, scene=scene)
  File "/home/colby/.config/blender/2.92/scripts/addons/blender_photogrammetry/imagemodeler/extract.py", line 82, in extract
    f = (float(cinf['fbw']) / 2) / tan(radians(float(intrinsics['fovx']) / 2))
KeyError: 'fbw'

location: <unknown location>:-1

Attached is one of the problematic files. passat rzi.zip

stuarta0 commented 3 years ago

Hi @Colbertson. The ImageModeler format is the least supported as I don't actually have a copy myself. I've been reverse engineering the format from a colleagues data. This is what their camera element contains:

<!-- theirs -->
<CINF i="1" n="Camera"        sw="608"  sh="392"  fbs="c" fbw="37.2245" fovs="v" fovx="56.0062" ds="c" rd="0.05" rstatus="v" hd="0" distoType="disto3i"/>
<!-- yours -->
<CINF i="1" n="Camera Device" sw="2048" sh="1536" fbs="c"               fovs="v" fovx="49.1343"                  rstatus="v" hd="0" distoType="disto3i"/>

Note the fbw attribute that I'm using as the sensor width combined with fovx to calculate the focal length. Your RZI file appears to be missing that attribute. If you can give some insight into the differences within ImageModeler between a file that works and this one I might be able to solve it. e.g. does IM show a different type of camera?

AndriyOrlov commented 1 year ago

Traceback (most recent call last): File "C:\Users\Andre\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\blender_photogrammetry__init__.py", line 76, in execute data = inputs[p.input].func(extract_props, scene=scene) File "C:\Users\Andre\AppData \Roaming\Blender Foundation\Blender\2.83\scripts\addons\blender_photogrammetry\imagemodeler\extract.py", line 45, in extract co = locator.find('P').attrib AttributeError: 'NoneType' object has no attribute 'attrib'

location: :-1

New folder (2).zip