Skip to content

Commit

Permalink
Add checks that are in on-device script.
Browse files Browse the repository at this point in the history
  • Loading branch information
ebezzam committed May 15, 2024
1 parent 0359a33 commit 709dbed
Showing 1 changed file with 3 additions and 30 deletions.
33 changes: 3 additions & 30 deletions scripts/measure/remote_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import cv2
from pprint import pprint
import matplotlib.pyplot as plt
import rawpy
from lensless.hardware.utils import check_username_hostname
from lensless.hardware.sensor import SensorOptions, sensor_dict, SensorParam
from lensless.utils.image import rgb2gray, print_image_info
Expand Down Expand Up @@ -127,9 +126,12 @@ def liveview(config):
and "bullseye" in result_dict["RPi distribution"]
and not legacy
):
assert not rgb or not gray, "RGB and gray not supported for RPi HQ sensor"

if bayer:

assert config.capture.down is None

# copy over DNG file
remotefile = f"~/{remote_fn}.dng"
localfile = os.path.join(save, f"{fn}.dng")
Expand All @@ -138,35 +140,6 @@ def liveview(config):

img = load_image(localfile, verbose=True, bayer=bayer, nbits_out=nbits_out)

# raw = rawpy.imread(localfile)

# # https://letmaik.github.io/rawpy/api/rawpy.Params.html#rawpy.Params
# # https://www.libraw.org/docs/API-datastruct-eng.html
# if nbits_out > 8:
# # only 8 or 16 bit supported by postprocess
# if nbits_out != 16:
# print("casting to 16 bit...")
# output_bps = 16
# else:
# if nbits_out != 8:
# print("casting to 8 bit...")
# output_bps = 8
# img = raw.postprocess(
# adjust_maximum_thr=0, # default 0.75
# no_auto_scale=False,
# # no_auto_scale=True,
# gamma=(1, 1),
# output_bps=output_bps,
# bright=1, # default 1
# exp_shift=1,
# no_auto_bright=True,
# # use_camera_wb=True,
# # use_auto_wb=False,
# # -- gives better balance for PSF measurement
# use_camera_wb=False,
# use_auto_wb=True, # default is False? f both use_camera_wb and use_auto_wb are True, then use_auto_wb has priority.
# )

# print image properties
print_image_info(img)

Expand Down

0 comments on commit 709dbed

Please sign in to comment.