Skip to content
Open
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
2 changes: 1 addition & 1 deletion color_calibration/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
numpy==1.20.2
numpy==1.22.0
tensorflow==2.4.1
7 changes: 5 additions & 2 deletions hti/server/api/stacking_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def post(self):
Frame.interpolate_angles(frames)

image_stacker = get_image_stacker()
image_stacker.light_frames = frames[:10]
image_stacker.light_frames = frames[:10] # TODO use all frames, provide a range option
image_stacker.stack_image()

# Update hash in app state so FE can react by reloading the preview
Expand All @@ -69,7 +69,10 @@ class StackedImagePreviewApi(Resource):
def get(self, stacked_image_hash):
image_stacker = get_image_stacker()
if image_stacker.get_stacked_image_hash() == stacked_image_hash:
image_data_png = image_stacker.get_stacked_image(format='png')
image_data_png = image_stacker.get_stacked_image(
format='png',
scale_factor=2
)
return send_file(image_data_png, mimetype='image/png')

# TODO hash is outdated - maybe update it with whatever is new?
Expand Down
7 changes: 5 additions & 2 deletions hti/server/stacking/image_stacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ def __init__(self):
def get_stacked_image_hash(self) -> str:
"""
Get a hash of all the parameters that went into stacked_image
so we can be smart about re-stacking only if settings change.
so we can be smart about re-stacking and fetching the updated
result only if any settings changed.
"""
# TODO crazy stupid hashing
return str(len(self.light_frames))

@staticmethod
def normalize_image(image):

"""
Fit dynamic range found in the given image into [0;1].
"""
normalized_image = np.zeros(image.shape, dtype=image.dtype)

for channel in range(image.shape[2]):
Expand Down