Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/vstarstack/library/calibration/flat.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def prepare_flat_sky(images : vstarstack.library.common.IImageSource,
if not flat.get_channel_option(channel, "signal"):
continue
layer = cv2.GaussianBlur(layer, (15, 15), 0)
flat.add_channel(layer, channel, **opts)
layer = layer / np.amax(layer)
flat.replace_channel(layer, channel, **opts)
for channel in list(flat.get_channels()):
if not flat.get_channel_option(channel, "weight"):
continue
Expand Down Expand Up @@ -201,5 +202,6 @@ def approximate_flat_image(flat : vstarstack.library.data.DataFrame) -> vstarsta
ky = ky * k**2
layer_approximated = generate_flat(layer.shape[1], layer.shape[0], x0, y0, val0, kx, ky)
layer_approximated = detect_spots(layer, layer_approximated)
layer_approximated = layer_approximated / np.amax(layer_approximated)
flat.replace_channel(layer_approximated, channel, **opts)
return flat
1 change: 1 addition & 0 deletions tests/test_flat_approximation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test_flat():
dfg = vstarstack.library.loaders.classic.readjpeg(os.path.join(dir_path, 'flat/flat.jpg'))
df = next(dfg)
flat,_ = df.get_channel('L')
flat = flat / np.amax(flat)
approx = vstarstack.library.calibration.flat.approximate_flat_image(df.copy())
flat_approx,_ = approx.get_channel('L')
assert flat_approx.shape == flat.shape
Expand Down