Loading openflexure_microscope/camera/pi.py +9 −4 Original line number Diff line number Diff line Loading @@ -565,15 +565,20 @@ class PiCameraStreamer(BaseCamera): # While the iterator is not closed try: while True: # reset stream for next frame # Reset the stream for the next frame self.stream.seek(0) self.stream.truncate() # to stream, read the new frame # Sleep for the approximate camera framerate time.sleep(1 / self.camera.framerate * 0.1) # yield the result to be read # Get the latest frame data from the stream frame = self.stream.getvalue() # ensure the size of package is right # This loop iterates faster than the PiCamera will collect # frames. On iterations between frames, the buffer will be # empty (because we truncated it earlier). In these cases # we just pass and loop again until a frame is actually present. # This also means that the size of FrameStream is always 1 frame, # since we truncate it here before a new frame can be appended. if len(frame) == 0: pass else: Loading Loading
openflexure_microscope/camera/pi.py +9 −4 Original line number Diff line number Diff line Loading @@ -565,15 +565,20 @@ class PiCameraStreamer(BaseCamera): # While the iterator is not closed try: while True: # reset stream for next frame # Reset the stream for the next frame self.stream.seek(0) self.stream.truncate() # to stream, read the new frame # Sleep for the approximate camera framerate time.sleep(1 / self.camera.framerate * 0.1) # yield the result to be read # Get the latest frame data from the stream frame = self.stream.getvalue() # ensure the size of package is right # This loop iterates faster than the PiCamera will collect # frames. On iterations between frames, the buffer will be # empty (because we truncated it earlier). In these cases # we just pass and loop again until a frame is actually present. # This also means that the size of FrameStream is always 1 frame, # since we truncate it here before a new frame can be appended. if len(frame) == 0: pass else: Loading