UTokyo-FieldPhenomics-Lab/EasyIDP

Tolerate the indoor reconstruction outputs without GPS info

Opened this issue · 0 comments

Develop drafts: EasyIDP/dev.notes/007_xxx.ipynb


This ROI uses `` create by QGIS Local Coordiantes

image

>>> roi = idp.ROI(roi_path)
>>> roi.crs
<Engineering CRS: LOCAL_CS["Local Coordinates (m)",UNIT["Meter",1.0] ...>
Name: Local Coordinates (m)
Axis Info [cartesian]:
- [east]: Easting (Meter)
- [north]: Northing (Meter)
Area of Use:
- undefined
Datum: undefined
- Ellipsoid: undefined
- Prime Meridian: undefined

Unable to read TIF without CRS / with "UNKNOWN" CRS

>>> ms.dom.crs = roi.crs
AttributeError: can't set attribute
# success
>>> ms.dsm.header['crs'] = roi.crs
>>> roi.get_z_from_dsm(ms.dsm)
<easyidp.ROI> with 4 items
[0]	0
array([[-0.0168963 ,  0.31289278,  0.07733615],
       [ 0.45213964,  0.3172357 ,  0.07733615],
       [ 0.47385427, -0.02585541,  0.07733615],
       [-0.00821045, -0.04322711,  0.07733615],
       [-0.0168963 ,  0.31289278,  0.07733615]])
[1]	1
array([[ 0.63888544,  0.29552107,  0.08769655],
       [ 1.10357845,  0.30420692,  0.08769655],
       [ 1.1122643 , -0.00414078,  0.08769655],
       [ 0.64322836, -0.01716955,  0.08769655],
       [ 0.63888544,  0.29552107,  0.08769655]])
[2]	2
array([[1.26860962, 0.31289278, 0.08208127],
       [1.72895971, 0.3346074 , 0.08208127],
       [1.74198849, 0.03060262, 0.08208127],
       [1.28163839, 0.01323092, 0.08208127],
       [1.26860962, 0.31289278, 0.08208127]])
[3]	3
array([[1.96347768, 0.34329325, 0.09117236],
       [2.42382777, 0.33026448, 0.09117236],
       [2.410799  , 0.03928848, 0.09117236],
       [1.9504489 , 0.03928848, 0.09117236],
       [1.96347768, 0.34329325, 0.09117236]])

Uable to load metashape project with disordered photos, as #89 already reported

>>> ms = idp.Metashape(project_path, chunk_id=5)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
[/Users/hwang/OneDrive/Program/GitHub/EasyIDP/dev.notes/007_backward_no_gps.ipynb](https://file+.vscode-resource.vscode-cdn.net/Users/hwang/OneDrive/Program/GitHub/EasyIDP/dev.notes/007_backward_no_gps.ipynb) 单元格 5 in ()
----> [1](vscode-notebook-cell:/Users/hwang/OneDrive/Program/GitHub/EasyIDP/dev.notes/007_backward_no_gps.ipynb#W4sZmlsZQ%3D%3D?line=0) ms = idp.Metashape(project_path, chunk_id=5)

File [~/OneDrive/Program/GitHub/EasyIDP/easyidp/metashape.py:107](https://file+.vscode-resource.vscode-cdn.net/Users/hwang/OneDrive/Program/GitHub/EasyIDP/dev.notes/~/OneDrive/Program/GitHub/EasyIDP/easyidp/metashape.py:107), in Metashape.__init__(self, project_path, chunk_id)
    104 #: the container for all photos used in this project (images), ````
    105 self.photos = self.photos
--> 107 self.open_project(project_path, chunk_id)

File [~/OneDrive/Program/GitHub/EasyIDP/easyidp/metashape.py:174](https://file+.vscode-resource.vscode-cdn.net/Users/hwang/OneDrive/Program/GitHub/EasyIDP/dev.notes/~/OneDrive/Program/GitHub/EasyIDP/easyidp/metashape.py:174), in Metashape.open_project(self, project_path, chunk_id)
    172 if project_path is not None:
    173     self._open_whole_project(project_path)
--> 174     self.open_chunk(self.chunk_id)
    175 else:
    176     if chunk_id is not None:

File [~/OneDrive/Program/GitHub/EasyIDP/easyidp/metashape.py:246](https://file+.vscode-resource.vscode-cdn.net/Users/hwang/OneDrive/Program/GitHub/EasyIDP/dev.notes/~/OneDrive/Program/GitHub/EasyIDP/easyidp/metashape.py:246), in Metashape.open_chunk(self, chunk_id, project_path)
    243     chunk_id = str(chunk_id)
    245 if chunk_id in self._project_chunks_dict.keys():
--> 246     chunk_content_dict = read_chunk_zip(
    247         self.project_folder, 
    248         self.project_name, 
    249         chunk_id=chunk_id, skip_disabled=False)
    250     self._chunk_dict_to_object(chunk_content_dict)
    251 elif chunk_id in self._label2chunk_id.keys():

File [~/OneDrive/Program/GitHub/EasyIDP/easyidp/metashape.py:1163](https://file+.vscode-resource.vscode-cdn.net/Users/hwang/OneDrive/Program/GitHub/EasyIDP/dev.notes/~/OneDrive/Program/GitHub/EasyIDP/easyidp/metashape.py:1163), in read_chunk_zip(project_folder, project_name, chunk_id, skip_disabled, return_label_only)
   1160 chunk_dict["sensors"] = sensors
   1162 # change photo xml to idp object
-> 1163 photos = _photoxml2object(
   1164     xml_tree, sensors
   1165 )
   1166 chunk_dict["photos"] = photos
   1168 for frame_tag in xml_tree.findall("[./frames/frame](https://file+.vscode-resource.vscode-cdn.net/Users/hwang/OneDrive/Program/GitHub/EasyIDP/dev.notes/frames/frame)"):
   1169     # frame_zip_idx = frame_tag.attrib["id"]

File [~/OneDrive/Program/GitHub/EasyIDP/easyidp/metashape.py:1224](https://file+.vscode-resource.vscode-cdn.net/Users/hwang/OneDrive/Program/GitHub/EasyIDP/dev.notes/~/OneDrive/Program/GitHub/EasyIDP/easyidp/metashape.py:1224), in _photoxml2object(xml_tree, sensors)
   1222         camera = _decode_camera_tag(camera_tag)
   1223         camera.sensor = sensors[camera.sensor_id]
-> 1224         photos[camera.id] = camera
   1225 else:
   1226     # judge if has group with the same name
   1227     group_label_pool = [g.attrib['label'] for g in group_tags]

File [~/OneDrive/Program/GitHub/EasyIDP/easyidp/__init__.py:53](https://file+.vscode-resource.vscode-cdn.net/Users/hwang/OneDrive/Program/GitHub/EasyIDP/dev.notes/~/OneDrive/Program/GitHub/EasyIDP/easyidp/__init__.py:53), in Container.__setitem__(self, key, item)
     51             self.item_label[key] = key
     52     else:
---> 53         raise IndexError(f"Index [{key}] out of range (0, {len(self.item_label)})")
     55 elif isinstance(key, str):
     56     # advanced method to change items
     57     # Container["N1W1"] = B, here assuemt B.label already == "N1W1"
     58 
     59     # item already exists
     60     if key in self.item_label.keys():   

IndexError: Index [94] out of range (0, 0)