kopia lustrzana https://github.com/OpenDroneMap/ODM
Pick green band by default, improve mavic 3M support
rodzic
f6be28db2a
commit
a56b52d0df
|
@ -181,11 +181,13 @@ def get_primary_band_name(multi_camera, user_band_name):
|
||||||
if len(multi_camera) < 1:
|
if len(multi_camera) < 1:
|
||||||
raise Exception("Invalid multi_camera list")
|
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":
|
if user_band_name == "auto":
|
||||||
for band in multi_camera:
|
for aliases in [['rgb', 'redgreenblue'], ['green', 'g'], ['blue', 'b']]:
|
||||||
if band['name'].lower() in ['rgb', 'redgreenblue', 'blue', 'b']:
|
for band in multi_camera:
|
||||||
return band['name']
|
if band['name'].lower() in aliases:
|
||||||
|
return band['name']
|
||||||
|
|
||||||
return multi_camera[0]['name']
|
return multi_camera[0]['name']
|
||||||
|
|
||||||
for band in multi_camera:
|
for band in multi_camera:
|
||||||
|
|
|
@ -925,3 +925,6 @@ class ODM_Photo:
|
||||||
return self.width * self.height / 1e6
|
return self.width * self.height / 1e6
|
||||||
else:
|
else:
|
||||||
return 0.0
|
return 0.0
|
||||||
|
|
||||||
|
def is_make_model(self, make, model):
|
||||||
|
return self.camera_make.lower() == make.lower() and self.camera_model.lower() == model.lower()
|
||||||
|
|
|
@ -27,7 +27,7 @@ class ODM_Reconstruction(object):
|
||||||
self.gcp = None
|
self.gcp = None
|
||||||
self.multi_camera = self.detect_multi_camera()
|
self.multi_camera = self.detect_multi_camera()
|
||||||
self.filter_photos()
|
self.filter_photos()
|
||||||
|
|
||||||
def detect_multi_camera(self):
|
def detect_multi_camera(self):
|
||||||
"""
|
"""
|
||||||
Looks at the reconstruction photos and determines if this
|
Looks at the reconstruction photos and determines if this
|
||||||
|
@ -90,10 +90,8 @@ class ODM_Reconstruction(object):
|
||||||
# Sort
|
# Sort
|
||||||
mc.sort(key=lambda x: normalized_band_order.get(x['name'].upper(), '9' + band_indexes[x['name']]))
|
mc.sort(key=lambda x: normalized_band_order.get(x['name'].upper(), '9' + band_indexes[x['name']]))
|
||||||
|
|
||||||
c = 1
|
for c, d in enumerate(mc):
|
||||||
for d in mc:
|
log.ODM_INFO(f"Band {c + 1}: {d['name']}")
|
||||||
log.ODM_INFO(f"Band {c}: {d['name']}")
|
|
||||||
c += 1
|
|
||||||
|
|
||||||
return mc
|
return mc
|
||||||
|
|
||||||
|
@ -116,6 +114,12 @@ class ODM_Reconstruction(object):
|
||||||
if 'rgb' in bands or 'redgreenblue' in bands:
|
if 'rgb' in bands or 'redgreenblue' in bands:
|
||||||
if 'red' in bands and 'green' in bands and 'blue' 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'])
|
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:
|
else:
|
||||||
for b in ['red', 'green', 'blue']:
|
for b in ['red', 'green', 'blue']:
|
||||||
if b in bands:
|
if b in bands:
|
||||||
|
|
Ładowanie…
Reference in New Issue