pull/1361/head
Piero Toffanin 2021-10-14 22:09:11 -04:00
rodzic a8a53244dc
commit c10daf3f6f
1 zmienionych plików z 2 dodań i 8 usunięć

Wyświetl plik

@ -2,10 +2,9 @@ import os
import json
import numpy as np
import math
import cv2
from repoze.lru import lru_cache
from opendm import log
from opendm.shots import get_origin
def rounded_gsd(reconstruction_json, default_value=None, ndigits=0, ignore_gsd=False):
"""
@ -123,7 +122,7 @@ def opensfm_reconstruction_average_gsd(reconstruction_json, use_all_shots=False)
shot = reconstruction['shots'][shotImage]
if use_all_shots or shot['gps_dop'] < 999999:
camera = reconstruction['cameras'][shot['camera']]
shot_origin = calculate_shot_origin(shot['rotation'], shot['translation'])
shot_origin = get_origin(shot)
shot_height = shot_origin[2]
focal_ratio = camera.get('focal', camera.get('focal_x'))
if not focal_ratio:
@ -142,11 +141,6 @@ def opensfm_reconstruction_average_gsd(reconstruction_json, use_all_shots=False)
return None
def calculate_shot_origin(rotation, translation):
rotation = np.array(rotation)
translation = np.array(translation)
rotation_matrix = cv2.Rodrigues(rotation)[0]
return -rotation_matrix.T.dot(translation)
def calculate_gsd(sensor_width, flight_height, focal_length, image_width):
"""