Pick green band by default, improve mavic 3M support

pull/1701/head
Piero Toffanin 2023-09-29 13:54:01 -04:00
rodzic f6be28db2a
commit a56b52d0df
3 zmienionych plików z 18 dodań i 9 usunięć

Wyświetl plik

@ -181,11 +181,13 @@ def get_primary_band_name(multi_camera, user_band_name):
if len(multi_camera) < 1:
raise Exception("Invalid multi_camera list")
# Pick RGB, or Blue if available, otherwise first band
# Pick RGB, or Green, or Blue, in this order, if available, otherwise first band
if user_band_name == "auto":
for band in multi_camera:
if band['name'].lower() in ['rgb', 'redgreenblue', 'blue', 'b']:
return band['name']
for aliases in [['rgb', 'redgreenblue'], ['green', 'g'], ['blue', 'b']]:
for band in multi_camera:
if band['name'].lower() in aliases:
return band['name']
return multi_camera[0]['name']
for band in multi_camera:

Wyświetl plik

@ -925,3 +925,6 @@ class ODM_Photo:
return self.width * self.height / 1e6
else:
return 0.0
def is_make_model(self, make, model):
return self.camera_make.lower() == make.lower() and self.camera_model.lower() == model.lower()

Wyświetl plik

@ -27,7 +27,7 @@ class ODM_Reconstruction(object):
self.gcp = None
self.multi_camera = self.detect_multi_camera()
self.filter_photos()
def detect_multi_camera(self):
"""
Looks at the reconstruction photos and determines if this
@ -90,10 +90,8 @@ class ODM_Reconstruction(object):
# Sort
mc.sort(key=lambda x: normalized_band_order.get(x['name'].upper(), '9' + band_indexes[x['name']]))
c = 1
for d in mc:
log.ODM_INFO(f"Band {c}: {d['name']}")
c += 1
for c, d in enumerate(mc):
log.ODM_INFO(f"Band {c + 1}: {d['name']}")
return mc
@ -116,6 +114,12 @@ class ODM_Reconstruction(object):
if 'rgb' in bands or 'redgreenblue' in bands:
if 'red' in bands and 'green' in bands and 'blue' in bands:
bands_to_remove.append(bands['rgb'] if 'rgb' in bands else bands['redgreenblue'])
# Mavic 3M's RGB camera lens are too different than the multispectral ones
# so we drop the RGB channel instead
elif self.photos[0].is_make_model("DJI", "M3M") and 'red' in bands and 'green' in bands:
bands_to_remove.append(bands['rgb'] if 'rgb' in bands else bands['redgreenblue'])
else:
for b in ['red', 'green', 'blue']:
if b in bands: