1
Python and Java API / Detected Marker has None Position
« on: June 04, 2020, 09:52:54 PM »
This chunk of code:
Results in this console output:
Can someone explain to me how a marker can be detected but its position is unknown. Is it because there isn't enough data of that marker for Metashape to determine where it is in the 3D space?
Code: [Select]
marker_positions = []
for marker in chunk.markers:
print("{} position: {}".format(marker, marker.position))
marker_positions.append(marker.position)
vectors = []
for position in marker_positions:
vectors.append(array([position.x, position.y, position.z]))
Results in this console output:
Code: [Select]
<Marker 'target 11'> position: Vector([2.850384004018244, 1.0210633499586494, -6.354710883046436])
<Marker 'target 12'> position: Vector([0.1409655312925602, -1.873231255504267, -4.556384146429653])
<Marker 'target 13'> position: Vector([-3.1367483930697495, 0.2522316043279687, -6.05366511916446])
<Marker 'target 14'> position: Vector([-0.4853655511060345, 3.1416026085665454, -7.8536455698625565])
<Marker 'target 16'> position: None
<Marker 'target 17'> position: None
<Marker 'target 18'> position: None
<Marker 'target 19'> position: None
<Marker 'target 20'> position: Vector([0.34745671678010315, 1.4629262299823313, -5.828908686770713])
<Marker 'target 21'> position: Vector([1.0872473152349622, 0.8241725426644423, -5.389903594150859])
<Marker 'target 22'> position: Vector([0.3666418664748137, 0.6686374725083808, -4.418571191247626])
<Marker 'target 23'> position: Vector([-0.2897068854704151, 0.650584019576526, -5.326348232334733])
<Marker 'target 24'> position: Vector([-1.4136581747723513, 0.9682022687019506, -5.566239838233837])
<Marker 'target 25'> position: Vector([-0.7353815825573798, 1.9562010612076728, -5.309009445145799])
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/ubuntu/cron/ms_pipeline/sweepS3.py", line 84, in <module>
main()
File "/home/ubuntu/cron/ms_pipeline/sweepS3.py", line 77, in main
runmetashape.main(project_name=runnable_project.name, project_suffix=runnable_project.suffix)
File "/home/ubuntu/cron/ms_pipeline/ms_workflow/runmetashape.py", line 392, in main
orientchunk.orient_markers_to_xy_plane(chunk)
File "/home/ubuntu/cron/ms_pipeline/ms_workflow/bounding_box/orientchunk.py", line 26, in orient_markers_to_xy_plane
vectors.append(array([position.x, position.y, position.z]))
AttributeError: 'NoneType' object has no attribute 'x'
Can someone explain to me how a marker can be detected but its position is unknown. Is it because there isn't enough data of that marker for Metashape to determine where it is in the 3D space?