Skip to content

Commit

Permalink
Clean up capture_file
Browse files Browse the repository at this point in the history
  • Loading branch information
brickbots committed Nov 6, 2024
1 parent 0e0ac26 commit 2bc1195
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions python/PiFinder/camera_pi.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,9 @@ def capture(self) -> Image.Image:
raw_image = Image.fromarray(raw_capture).resize((512, 512))
return raw_image

def capture_file(self, filename, filename_raw) -> None:
_request = self.camera.capture_request()
tmp_capture = _request.make_image("main")
raw_capture = _request.make_array("raw")
_request.release()
if self.camera_type == "imx296":
# Sensor orientation is different
raw_capture = raw_capture.copy().view(np.uint16)[:, 184:-184]
raw_capture = raw_capture.astype(np.float32)
raw_capture = (raw_capture / 1024 * 255).astype(np.uint8)
tmp_capture = tmp_capture.rotate(180)
raw_capture = np.rot90(raw_capture, 2)
else:
# For OG camera type, the array needs to be converted
# from RGB to L. Easiest way to do this is just to
# add the flux from all the channels
raw_capture = np.sum(raw_capture, axis=[0, 1])
print(raw_capture.shape)

def capture_file(self, filename) -> None:
tmp_capture = self.capture()
tmp_capture.save(filename)
tmp_image = Image.fromarray(raw_capture).resize((512, 512))
tmp_image.save(filename_raw)
return raw_capture

def set_camera_config(
self, exposure_time: float, gain: float
Expand Down

0 comments on commit 2bc1195

Please sign in to comment.