kopia lustrzana https://github.com/OpenDroneMap/ODM
Quantix multispectral fixes
rodzic
8cbe1f8c3f
commit
a5764af46b
|
@ -563,6 +563,8 @@ def local_normalize(im):
|
||||||
|
|
||||||
|
|
||||||
def align_image(image, warp_matrix, dimension):
|
def align_image(image, warp_matrix, dimension):
|
||||||
|
image = resize_match(image, dimension)
|
||||||
|
|
||||||
if warp_matrix.shape == (3, 3):
|
if warp_matrix.shape == (3, 3):
|
||||||
return cv2.warpPerspective(image, warp_matrix, dimension)
|
return cv2.warpPerspective(image, warp_matrix, dimension)
|
||||||
else:
|
else:
|
||||||
|
@ -594,3 +596,16 @@ def to_8bit(image, force_normalize=False):
|
||||||
return image
|
return image
|
||||||
|
|
||||||
|
|
||||||
|
def resize_match(image, dimension):
|
||||||
|
h, w = image.shape[0], image.shape[1]
|
||||||
|
mw, mh = dimension
|
||||||
|
|
||||||
|
if w != mw or h != mh:
|
||||||
|
fx = mw/w
|
||||||
|
fy = mh/h
|
||||||
|
image = cv2.resize(image, None,
|
||||||
|
fx=fx,
|
||||||
|
fy=fx,
|
||||||
|
interpolation=(cv2.INTER_AREA if (fx < 1.0 and fy < 1.0) else cv2.INTER_LANCZOS4))
|
||||||
|
|
||||||
|
return image
|
|
@ -104,9 +104,9 @@ class ODMOpenSfMStage(types.ODM_Stage):
|
||||||
image = func(shot_id, image)
|
image = func(shot_id, image)
|
||||||
return image
|
return image
|
||||||
|
|
||||||
def resize_secondary_images(shot_id, image):
|
def resize_thermal_images(shot_id, image):
|
||||||
photo = reconstruction.get_photo(shot_id)
|
photo = reconstruction.get_photo(shot_id)
|
||||||
if photo.band_name != primary_band_name:
|
if photo.is_thermal():
|
||||||
return thermal.resize_to_match(image, largest_photo)
|
return thermal.resize_to_match(image, largest_photo)
|
||||||
else:
|
else:
|
||||||
return image
|
return image
|
||||||
|
@ -138,8 +138,8 @@ class ODMOpenSfMStage(types.ODM_Stage):
|
||||||
return image
|
return image
|
||||||
|
|
||||||
if reconstruction.multi_camera:
|
if reconstruction.multi_camera:
|
||||||
largest_photo = find_largest_photo([p for p in photos if p.band_name == primary_band_name])
|
largest_photo = find_largest_photo([p for p in photos])
|
||||||
undistort_pipeline.append(resize_secondary_images)
|
undistort_pipeline.append(resize_thermal_images)
|
||||||
|
|
||||||
if args.radiometric_calibration != "none":
|
if args.radiometric_calibration != "none":
|
||||||
undistort_pipeline.append(radiometric_calibrate)
|
undistort_pipeline.append(radiometric_calibrate)
|
||||||
|
|
Ładowanie…
Reference in New Issue