kopia lustrzana https://github.com/OpenDroneMap/WebODM
Merge pull request #1203 from pierotofy/auto
Thermal formulas, more color bands, misc tweakspull/1204/head
commit
0e9b3d5527
|
@ -11,6 +11,14 @@ algos = {
|
||||||
'expr': '(N - R) / (N + R)',
|
'expr': '(N - R) / (N + R)',
|
||||||
'help': _('Normalized Difference Vegetation Index shows the amount of green vegetation.')
|
'help': _('Normalized Difference Vegetation Index shows the amount of green vegetation.')
|
||||||
},
|
},
|
||||||
|
'NDRE': {
|
||||||
|
'expr': '(N - Re) / (N + Re)',
|
||||||
|
'help': _('Normalized Difference Red Edge Index shows the amount of green vegetation of permanent or later stage crops.')
|
||||||
|
},
|
||||||
|
'NDWI': {
|
||||||
|
'expr': '(G - N) / (G + N)',
|
||||||
|
'help': _('Normalized Difference Water Index shows the amount of water content in water bodies.')
|
||||||
|
},
|
||||||
'NDVI (Blue)': {
|
'NDVI (Blue)': {
|
||||||
'expr': '(N - B) / (N + B)',
|
'expr': '(N - B) / (N + B)',
|
||||||
'help': _('Normalized Difference Vegetation Index shows the amount of green vegetation.')
|
'help': _('Normalized Difference Vegetation Index shows the amount of green vegetation.')
|
||||||
|
@ -22,7 +30,7 @@ algos = {
|
||||||
'vNDVI':{
|
'vNDVI':{
|
||||||
'expr': '0.5268*((R ** -0.1294) * (G ** 0.3389) * (B ** -0.3118))',
|
'expr': '0.5268*((R ** -0.1294) * (G ** 0.3389) * (B ** -0.3118))',
|
||||||
'help': _('Visible NDVI is an un-normalized index for RGB sensors using constants derived from citrus, grape, and sugarcane crop data.')
|
'help': _('Visible NDVI is an un-normalized index for RGB sensors using constants derived from citrus, grape, and sugarcane crop data.')
|
||||||
},
|
},
|
||||||
'VARI': {
|
'VARI': {
|
||||||
'expr': '(G - R) / (G + R - B)',
|
'expr': '(G - R) / (G + R - B)',
|
||||||
'help': _('Visual Atmospheric Resistance Index shows the areas of vegetation.'),
|
'help': _('Visual Atmospheric Resistance Index shows the areas of vegetation.'),
|
||||||
|
@ -87,6 +95,14 @@ algos = {
|
||||||
'help': _('Enhanced Vegetation Index is useful in areas where NDVI might saturate, by using blue wavelengths to correct soil signals.'),
|
'help': _('Enhanced Vegetation Index is useful in areas where NDVI might saturate, by using blue wavelengths to correct soil signals.'),
|
||||||
'range': (-1, 1)
|
'range': (-1, 1)
|
||||||
},
|
},
|
||||||
|
'Thermal C': {
|
||||||
|
'expr': 'Lwir',
|
||||||
|
'help': _('Thermal temperature in Celsius degrees.')
|
||||||
|
},
|
||||||
|
'Thermal K': {
|
||||||
|
'expr': 'Lwir / 100 - 273.15',
|
||||||
|
'help': _('Thermal temperature in Centikelvin degrees.')
|
||||||
|
},
|
||||||
|
|
||||||
# more?
|
# more?
|
||||||
|
|
||||||
|
@ -115,6 +131,9 @@ camera_filters = [
|
||||||
'RGBNRe',
|
'RGBNRe',
|
||||||
'RGBReN',
|
'RGBReN',
|
||||||
|
|
||||||
|
'BGRNReLwir',
|
||||||
|
'BGRReNLwir',
|
||||||
|
|
||||||
# more?
|
# more?
|
||||||
# TODO: certain cameras have only two bands? eg. MAPIR NDVI BLUE+NIR
|
# TODO: certain cameras have only two bands? eg. MAPIR NDVI BLUE+NIR
|
||||||
]
|
]
|
||||||
|
@ -145,7 +164,23 @@ def lookup_formula(algo, band_order = 'RGB'):
|
||||||
|
|
||||||
@lru_cache(maxsize=2)
|
@lru_cache(maxsize=2)
|
||||||
def get_algorithm_list(max_bands=3):
|
def get_algorithm_list(max_bands=3):
|
||||||
return [{'id': k, 'filters': get_camera_filters_for(algos[k], max_bands), **algos[k]} for k in algos if not k.startswith("_")]
|
res = []
|
||||||
|
for k in algos:
|
||||||
|
if k.startswith("_"):
|
||||||
|
continue
|
||||||
|
|
||||||
|
cam_filters = get_camera_filters_for(algos[k], max_bands)
|
||||||
|
|
||||||
|
if len(cam_filters) == 0:
|
||||||
|
continue
|
||||||
|
|
||||||
|
res.append({
|
||||||
|
'id': k,
|
||||||
|
'filters': cam_filters,
|
||||||
|
**algos[k]
|
||||||
|
})
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
def get_camera_filters_for(algo, max_bands=3):
|
def get_camera_filters_for(algo, max_bands=3):
|
||||||
result = []
|
result = []
|
||||||
|
|
|
@ -199,6 +199,7 @@ class Metadata(TaskNestedView):
|
||||||
cmap_labels = {
|
cmap_labels = {
|
||||||
"viridis": "Viridis",
|
"viridis": "Viridis",
|
||||||
"jet": "Jet",
|
"jet": "Jet",
|
||||||
|
"jet_r": "Jet (Reverse)",
|
||||||
"terrain": "Terrain",
|
"terrain": "Terrain",
|
||||||
"gist_earth": "Earth",
|
"gist_earth": "Earth",
|
||||||
"rdylgn": "RdYlGn",
|
"rdylgn": "RdYlGn",
|
||||||
|
@ -209,6 +210,10 @@ class Metadata(TaskNestedView):
|
||||||
"better_discrete_ndvi": "Custom NDVI Index",
|
"better_discrete_ndvi": "Custom NDVI Index",
|
||||||
"rplumbo": "Rplumbo (Better NDVI)",
|
"rplumbo": "Rplumbo (Better NDVI)",
|
||||||
"pastel1": "Pastel",
|
"pastel1": "Pastel",
|
||||||
|
"plasma": "Plasma",
|
||||||
|
"inferno": "Inferno",
|
||||||
|
"magma": "Magma",
|
||||||
|
"cividis": "Cividis"
|
||||||
}
|
}
|
||||||
|
|
||||||
colormaps = []
|
colormaps = []
|
||||||
|
@ -217,7 +222,8 @@ class Metadata(TaskNestedView):
|
||||||
colormaps = ['viridis', 'jet', 'terrain', 'gist_earth', 'pastel1']
|
colormaps = ['viridis', 'jet', 'terrain', 'gist_earth', 'pastel1']
|
||||||
elif formula and bands:
|
elif formula and bands:
|
||||||
colormaps = ['rdylgn', 'spectral', 'rdylgn_r', 'spectral_r', 'rplumbo', 'discrete_ndvi',
|
colormaps = ['rdylgn', 'spectral', 'rdylgn_r', 'spectral_r', 'rplumbo', 'discrete_ndvi',
|
||||||
'better_discrete_ndvi']
|
'better_discrete_ndvi',
|
||||||
|
'viridis', 'plasma', 'inferno', 'magma', 'cividis', 'jet', 'jet_r']
|
||||||
algorithms = *get_algorithm_list(band_count),
|
algorithms = *get_algorithm_list(band_count),
|
||||||
|
|
||||||
info['color_maps'] = []
|
info['color_maps'] = []
|
||||||
|
|
|
@ -531,7 +531,7 @@ class TestApiTask(BootTransactionTestCase):
|
||||||
|
|
||||||
# Colormap is for algorithms
|
# Colormap is for algorithms
|
||||||
self.assertEqual(len([x for x in metadata['color_maps'] if x['key'] == 'rdylgn']), 1)
|
self.assertEqual(len([x for x in metadata['color_maps'] if x['key'] == 'rdylgn']), 1)
|
||||||
self.assertEqual(len([x for x in metadata['color_maps'] if x['key'] == 'jet']), 0)
|
self.assertEqual(len([x for x in metadata['color_maps'] if x['key'] == 'pastel1']), 0)
|
||||||
|
|
||||||
# Formula parameters are copied to tile URL
|
# Formula parameters are copied to tile URL
|
||||||
self.assertTrue(metadata['tiles'][0].endswith('?formula=NDVI&bands=RGN'))
|
self.assertTrue(metadata['tiles'][0].endswith('?formula=NDVI&bands=RGN'))
|
||||||
|
@ -668,7 +668,6 @@ class TestApiTask(BootTransactionTestCase):
|
||||||
for k in algos:
|
for k in algos:
|
||||||
a = algos[k]
|
a = algos[k]
|
||||||
filters = get_camera_filters_for(a)
|
filters = get_camera_filters_for(a)
|
||||||
self.assertTrue(len(filters) > 0, "%s has filters" % k)
|
|
||||||
|
|
||||||
for f in filters:
|
for f in filters:
|
||||||
params.append(("orthophoto", "formula={}&bands={}&color_map=rdylgn".format(k, f), status.HTTP_200_OK))
|
params.append(("orthophoto", "formula={}&bands={}&color_map=rdylgn".format(k, f), status.HTTP_200_OK))
|
||||||
|
|
2
start.sh
2
start.sh
|
@ -148,7 +148,7 @@ else
|
||||||
congrats
|
congrats
|
||||||
|
|
||||||
nginx -c $(pwd)/nginx/$conf
|
nginx -c $(pwd)/nginx/$conf
|
||||||
gunicorn webodm.wsgi --bind unix:/tmp/gunicorn.sock --timeout 300000 --max-requests 250 --workers $((2*$(grep -c '^processor' /proc/cpuinfo)+1)) --preload
|
gunicorn webodm.wsgi --bind unix:/tmp/gunicorn.sock --timeout 300000 --max-requests 500 --workers $((1*$(grep -c '^processor' /proc/cpuinfo)+1)) --preload
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If this is executed, it means the previous command failed, don't display the congratulations message
|
# If this is executed, it means the previous command failed, don't display the congratulations message
|
||||||
|
|
Ładowanie…
Reference in New Issue