fix color key & pix intensity scaling

master
michael 2022-10-19 17:02:04 -07:00
parent fe72029a11
commit 0d39e20d00
1 changed files with 2 additions and 5 deletions

View File

@ -36,7 +36,7 @@ def rg_ratio_normalize(
# pix_i = temp_C - MIN_TEMP # pix_i = temp_C - MIN_TEMP
temp_new = temp_C - MIN_TEMP temp_new = temp_C - MIN_TEMP
pix_i = temp_new / MAX_TEMP * 255 pix_i = temp_new / (MAX_TEMP - MIN_TEMP) * 255
imgnew[i][j] = [pix_i, pix_i, pix_i] imgnew[i][j] = [pix_i, pix_i, pix_i]
@ -101,16 +101,13 @@ def ratio_pyrometry_pipeline(
# --- Generate temperature key --- # --- Generate temperature key ---
# adjust max & min temps to be the same as the image
# Generate key # Generate key
# step = (tmax - tmin) / (key_entries-1)
step = (MAX_TEMP - MIN_TEMP) / (key_entries-1) step = (MAX_TEMP - MIN_TEMP) / (key_entries-1)
temps = [] temps = []
key_img_arr = [[]] key_img_arr = [[]]
for i in range(key_entries): for i in range(key_entries):
# res_temp = tmin + (i * step)
res_temp = MIN_TEMP + (i * step) res_temp = MIN_TEMP + (i * step)
res_color = res_temp / MAX_TEMP * 255 res_color = (res_temp - MIN_TEMP) / (MAX_TEMP - MIN_TEMP) * 255
temps.append(math.floor(res_temp)) temps.append(math.floor(res_temp))
key_img_arr[0].append([res_color, res_color, res_color]) key_img_arr[0].append([res_color, res_color, res_color])