Skip to content

Commit

Permalink
Fix non-bayer rpi_gs case.
Browse files Browse the repository at this point in the history
  • Loading branch information
ebezzam committed Sep 29, 2023
1 parent 9618a27 commit ddafc09
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion configs/remote_capture_rpi_gs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rpi:

capture:
sensor: rpi_gs
exp: 0.5
exp: 0.2
bayer: True
legacy: False # must be False for rpi_gs
rgb: False
Expand Down
3 changes: 3 additions & 0 deletions lensless/hardware/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def display(

def check_username_hostname(username, hostname, timeout=10):

assert username is not None, "Username must be specified"
assert hostname is not None, "Hostname must be specified"

client = paramiko.client.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

Expand Down
28 changes: 20 additions & 8 deletions scripts/measure/remote_capture.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
"""
python scripts/measure/remote_capture.py
For Bayer data with RPI HQ sensor:
```
python scripts/measure/remote_capture.py \
rpi.username=USERNAME rpi.hostname=IP_ADDRESS
```
For Bayer data with RPI Global shutter sensor:
```
python scripts/measure/remote_capture.py -cn remote_capture_rpi_gs \
rpi.username=USERNAME rpi.hostname=IP_ADDRESS
```
For RGB data with RPI HQ RPI Global shutter sensor:
```
python scripts/measure/remote_capture.py -cn remote_capture_rpi_gs \
rpi.username=USERNAME rpi.hostname=IP_ADDRESS \
capture.bayer=False capture.down=2
```
Check out the `configs/demo.yaml` file for parameters, specifically:
Expand Down Expand Up @@ -54,12 +71,6 @@ def liveview(config):
else:
save = False

# proceed with capture
# if bayer:
# assert not rgb
# assert not gray
assert hostname is not None

# take picture
remote_fn = "remote_capture"
print("\nTaking picture...")
Expand All @@ -85,7 +96,7 @@ def liveview(config):
result = ssh.stdout.readlines()
error = ssh.stderr.readlines()

if error != []:
if error != [] and legacy: # new camera software seems to return error even if it works
print("ERROR: %s" % error)
return
if result == []:
Expand All @@ -108,6 +119,7 @@ def liveview(config):
"RPi distribution" in result_dict.keys()
and "bullseye" in result_dict["RPi distribution"]
and not legacy
and bayer
):
# copy over DNG file
remotefile = f"~/{remote_fn}.dng"
Expand Down

0 comments on commit ddafc09

Please sign in to comment.