get_bit_depth_max refactor

pull/1082/head
Piero Toffanin 2020-03-09 15:57:44 -04:00
rodzic e209901c83
commit c5a92339f1
3 zmienionych plików z 12 dodań i 12 usunięć

Wyświetl plik

@ -44,14 +44,9 @@ def dn_to_radiance(photo, image):
image -= dark_level
# Normalize DN to 0 - 1.0
bps = photo.bits_per_sample
if bps:
bit_depth_max = float(2 ** bps)
else:
# Infer from array dtype
info = np.iinfo(image.dtype)
bit_depth_max = info.max - info.min
image /= bit_depth_max
bit_depth_max = photo.get_bit_depth_max()
if bit_depth_max:
image /= bit_depth_max
if V is not None:
# vignette correction

Wyświetl plik

@ -344,8 +344,7 @@ class ODM_Photo:
# and XMP:SunSensorSensitivity might
# require additional logic. If these two tags are present,
# then sun_sensor is not in physical units?
return self.sun_sensor / 65535 # uint16 normalized (TODO: is this correct? Documentation from manufacturers is missing)
return self.sun_sensor / 65535.0 # normalize uint16 (is this correct?)
elif self.spectral_irradiance is not None:
scale = 1.0 # Assumed
if self.irradiance_scale_to_si is not None:
@ -356,4 +355,10 @@ class ODM_Photo:
def get_dls_pose(self):
if self.dls_yaw is not None:
return [self.dls_yaw, self.dls_pitch, self.dls_roll]
return [0.0, 0.0, 0.0]
return [0.0, 0.0, 0.0]
def get_bit_depth_max(self):
if self.bits_per_sample:
return float(2 ** self.bits_per_sample)
return None

Wyświetl plik

@ -62,7 +62,7 @@ class ODMOpenSfMStage(types.ODM_Stage):
octx.convert_and_undistort(self.rerun())
else:
# TODO: does this work for multi-band RGB images?
# TODO: does this work for RGB images?
def radiometric_calibrate(shot_id, image):
photo = reconstruction.get_photo(shot_id)