add configurability

master
michael 2022-10-06 17:42:39 -07:00
parent 67663907ea
commit c689247975
11 changed files with 35 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
01-0001-cropped.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
01-0002-cropped.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 KiB

BIN
01-0002.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
01-0003-cropped.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 KiB

BIN
01-0003.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 KiB

View File

@ -13,3 +13,9 @@
**Grayscale pyrometry result:** **Grayscale pyrometry result:**
![](01-0001-transformed-grayscale.png) ![](01-0001-transformed-grayscale.png)
**Ratio pyrometry result (with 2x2 convolutional smoothing):**
According to general researcher consensus, ratio pyrometry is supposed to be more accurate.
![](01-0001-transformed-ratio.png)

View File

@ -4,15 +4,20 @@ import numpy as np
from numba import jit from numba import jit
# camera settings # camera settings
file = '01-0003.png'
I_Darkcurrent = 150.5 I_Darkcurrent = 150.5
exposure_time = 0.5 exposure_time = 0.5
f_stop = 2.4 f_stop = 2.4
ISO = 64 # basically brightness ISO = 64 # basically brightness
# I_Darkcurrent = 50.1 # runtime config
# exposure_time = 0.1 MAX_GR_RATIO = 2000
# f_stop = 1 MIN_GR_RATIO = None
# ISO = 70 # basically brightness
x1 = 420
x2 = 1200
y1 = 400
y2 = -1
@jit(nopython=True) @jit(nopython=True)
def rg_ratio_normalize(imgarr): def rg_ratio_normalize(imgarr):
@ -27,7 +32,7 @@ def rg_ratio_normalize(imgarr):
ratio = pyrometry_calibration_formula(g_norm, r_norm) ratio = pyrometry_calibration_formula(g_norm, r_norm)
# remove edge cases # remove edge cases
if ratio > 1900: if MAX_GR_RATIO != None and ratio > MAX_GR_RATIO or MIN_GR_RATIO != None and ratio < MIN_GR_RATIO:
ratio = 0 ratio = 0
imgnew[i][j] = [ratio, ratio, ratio] imgnew[i][j] = [ratio, ratio, ratio]
@ -48,8 +53,11 @@ def pyrometry_calibration_formula(i_ng, i_nr):
) + 3753.5 ) + 3753.5
# read image & crop # read image & crop
img = cv.imread('01-0001.png') file_name = file.split(".")[0]
img = img[400:, 420:1200] file_ext = file.split(".")[1]
img = cv.imread(file)
img = img[y1:y2, x1:x2]
cv.imwrite(f'{file_name}-cropped.{file_ext}', img)
# img = cv.imread('ember_test.png') # img = cv.imread('ember_test.png')
@ -61,6 +69,19 @@ kernel = np.array([
[1/2, 1/2], [1/2, 1/2],
]) ])
# kernel = np.array([
# [1/3, 1/3, 1/3],
# [1/3, 1/3, 1/3],
# [1/3, 1/3, 1/3],
# ])
# kernel = np.array([
# [1/4, 1/4, 1/4, 1/4],
# [1/4, 1/4, 1/4, 1/4],
# [1/4, 1/4, 1/4, 1/4],
# [1/4, 1/4, 1/4, 1/4],
# ])
# Scaling adjustment factor # Scaling adjustment factor
kernel *= 3/5 kernel *= 3/5
@ -69,4 +90,4 @@ img = cv.filter2D(src=img, ddepth=-1, kernel=kernel)
# apply jet color map # apply jet color map
img = cv.applyColorMap(img, cv.COLORMAP_JET) img = cv.applyColorMap(img, cv.COLORMAP_JET)
cv.imwrite('01-0001-transformed-ratio.png', img) cv.imwrite(f'{file_name}-cropped-transformed-ratio.{file_ext}', img)