Only generate frame if LED is on
This commit is contained in:
parent
fdf33ce4a8
commit
bb5cce3d4e
1 changed files with 4 additions and 4 deletions
|
|
@ -347,12 +347,12 @@ class SimulatedCamera(BaseCamera):
|
||||||
|
|
||||||
def generate_frame(self) -> Image.Image:
|
def generate_frame(self) -> Image.Image:
|
||||||
"""Generate a frame with blobs based on the stage coordinates."""
|
"""Generate a frame with blobs based on the stage coordinates."""
|
||||||
pos = self._stage.instantaneous_position
|
|
||||||
frame = self.generate_image((pos["y"], pos["x"], pos["z"]))
|
|
||||||
# Simulate LED turning off by setting all channels to 0
|
# Simulate LED turning off by setting all channels to 0
|
||||||
if not self.led_on:
|
if not self.led_on:
|
||||||
return Image.new(frame.mode, frame.size, 0)
|
return Image.new(mode="RGB", size=(self.shape[1], self.shape[0]), color=0)
|
||||||
return frame
|
# Otherwise, generate a frame from current position
|
||||||
|
pos = self._stage.instantaneous_position
|
||||||
|
return self.generate_image((pos["y"], pos["x"], pos["z"]))
|
||||||
|
|
||||||
def __enter__(self) -> Self:
|
def __enter__(self) -> Self:
|
||||||
"""Start the capture thread when the Thing context manager is opened."""
|
"""Start the capture thread when the Thing context manager is opened."""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue