kopia lustrzana https://github.com/OpenDroneMap/ODM
Use get_origin
rodzic
a8a53244dc
commit
c10daf3f6f
|
@ -2,10 +2,9 @@ import os
|
||||||
import json
|
import json
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import math
|
import math
|
||||||
import cv2
|
|
||||||
from repoze.lru import lru_cache
|
from repoze.lru import lru_cache
|
||||||
from opendm import log
|
from opendm import log
|
||||||
|
from opendm.shots import get_origin
|
||||||
|
|
||||||
def rounded_gsd(reconstruction_json, default_value=None, ndigits=0, ignore_gsd=False):
|
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]
|
shot = reconstruction['shots'][shotImage]
|
||||||
if use_all_shots or shot['gps_dop'] < 999999:
|
if use_all_shots or shot['gps_dop'] < 999999:
|
||||||
camera = reconstruction['cameras'][shot['camera']]
|
camera = reconstruction['cameras'][shot['camera']]
|
||||||
shot_origin = calculate_shot_origin(shot['rotation'], shot['translation'])
|
shot_origin = get_origin(shot)
|
||||||
shot_height = shot_origin[2]
|
shot_height = shot_origin[2]
|
||||||
focal_ratio = camera.get('focal', camera.get('focal_x'))
|
focal_ratio = camera.get('focal', camera.get('focal_x'))
|
||||||
if not focal_ratio:
|
if not focal_ratio:
|
||||||
|
@ -142,11 +141,6 @@ def opensfm_reconstruction_average_gsd(reconstruction_json, use_all_shots=False)
|
||||||
|
|
||||||
return None
|
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):
|
def calculate_gsd(sensor_width, flight_height, focal_length, image_width):
|
||||||
"""
|
"""
|
||||||
|
|
Ładowanie…
Reference in New Issue