update frontend

master
michael 2022-10-12 17:37:31 -07:00
parent 66169cd629
commit dd5e74cb1a
5 changed files with 33 additions and 23 deletions

View File

@ -1,7 +0,0 @@
import ratio_pyrometry
@jit(nopython=True)
def normalization_func_customizable(i, I_Darkcurrent, ISO, f_stop, exposure_time):
return (i - I_Darkcurrent) * (f_stop ** 2) / (ISO * exposure_time)

View File

@ -3,7 +3,6 @@ from werkzeug.utils import secure_filename
import numpy as np
from ratio_pyrometry import ratio_pyrometry_pipeline
import base64
import random
import cv2 as cv
app = Flask(
@ -12,9 +11,6 @@ app = Flask(
static_url_path='/s/'
)
app.config['STATIC_FOLDER'] = './static'
app.config['STATIC_URL_PATH'] = '/s'
@app.route('/', methods=['GET'])
def index():
return render_template('index.jinja2')
@ -30,7 +26,9 @@ def ratio_pyro():
exposure_time=float(request.form['exposure_time']),
f_stop=float(request.form['f_stop']),
MAX_TEMP=float(request.form['max_temp']),
MIN_TEMP=float(request.form['min_temp'])
MIN_TEMP=float(request.form['min_temp']),
smoothing_radius=int(request.form['smoothing_radius']),
key_entries=int(request.form['legend_entries'])
)
img_orig_b64 = base64.b64encode(cv.imencode('.png', img_orig)[1]).decode(encoding='utf-8')

View File

@ -70,7 +70,9 @@ def ratio_pyrometry_pipeline(
ISO: float,
# pyrometry config
MAX_TEMP: float,
MIN_TEMP: float
MIN_TEMP: float,
smoothing_radius: int,
key_entries: int
):
# read image & crop

View File

@ -15,15 +15,15 @@
<br>
<label for="i_darkcurrent">I_Darkcurrent</label>
<input type="number" name="i_darkcurrent" value="150.5"/>
<input type="number" name="i_darkcurrent" value="150.5" step="0.1"/>
<br>
<label for="exposure_time">Exposure Time <i>t</i></label>
<input type="number" name="exposure_time" value="0.5"/>
<input type="number" name="exposure_time" value="0.5" step="0.1"/>
<br>
<label for="f_stop">F-stop <i>f</i></label>
<input type="number" name="f_stop" value="2.4"/>
<input type="number" name="f_stop" value="2.4" step=0.1/>
<br>
<h4>Temperature Settings</h4>
@ -36,6 +36,16 @@
<input type="number" name="max_temp" value="1200"/>
<br>
<h4>Output Settings</h4>
<label for="smoothing_radius">Smoothing Radius (px)</label>
<input type="number" name="smoothing_radius" value="2"/>
<br>
<label for="legend_entries">Legend Entries</label>
<input type="number" name="legend_entries" value="20"/>
<br>
<br>
<input type="submit" value="Generate Heatmap"/>
</form>

View File

@ -10,12 +10,10 @@
{# Original image #}
<td class="img-table-cell" id="orig-cell">
<img class="img-out" src="data:image/png;base64,{{ img_orig_b64 }}" alt="original image">
{# <img class="img-out" src="{{ img_orig_path }}" alt="original image"> #}
</td>
{# Result image #}
<td class="img-table-cell" id="res-cell">
<img class="img-out" src="data:image/png;base64,{{ img_res_b64 }}" alt="result image">
{# <img class="img-out" src="{{ img_res_path }}" alt="resulting heatmap"> #}
</td>
</tr>
{# Legend #}
@ -24,17 +22,16 @@
<td class="img-table-cell">
<table class="legend" id="legend">
<tr>
<th>Color</th>
<th>Temperature</th>
<th class="legend-heading">Color</th>
<th class="legend-heading">Temperature</th>
</tr>
{% for temp, color in legend.items() %}
<tr>
<td class="legend-cell"><div style="width:20px;height:20px;background-color:{{ color }};"></div></td>
<td class="legend-cell"><div style="width:30px;height:20px;background-color:{{ color }};"></div></td>
<td class="legend-cell">{{ temp }}°C</td>
</tr>
{% endfor %}
</table>
</td>
</tr>
</table>
@ -52,8 +49,18 @@
width: 32rem;
}
.legend {
border-spacing: 0px;
border-collapse: collapse;
}
.legend-heading {
padding: 4px;
}
.legend-cell {
padding: 4px 30px;
border-width: 0px;
padding: 0px 20px;
}
</style>