Ejemplo n.º 1
0
 def make_display(self, frame, middle, lowest, highest, diff):  #, mag):
     # First, lets plot the center on it.
     cv2.line(frame, (self.center - 4, self.check_row),
              (self.center + 4, self.check_row), self.crosshair_color)
     cv2.line(frame, (self.center, self.check_row - 4),
              (self.center, self.check_row + 4), self.crosshair_color)
     # Now lets show where we found the middle
     cv2.line(frame, (middle, self.check_row - 8),
              (middle, self.check_row + 8), self.line_middle_color)
     # Next the width
     cv2.line(frame, (lowest, self.check_row - 4),
              (lowest, self.check_row + 4), self.line_middle_color)
     cv2.line(frame, (highest, self.check_row - 4),
              (highest, self.check_row + 4), self.line_middle_color)
     # finally the graph
     graph_frame = np.zeros(
         (camera_stream.size[1], camera_stream.size[0], 3), np.uint8)
     self.make_cv2_simple_graph(graph_frame, diff)
     # cv2.putText(graph_frame, f"Err: {self.last_error}", org=(0, 120), fontFace=self.text_font, fontScale=1, color=self.text_color)
     # cv2.putText(graph_frame, f"Val: {self.last_value}", org=(0, 160), fontFace=self.text_font, fontScale=1, color=self.text_color)
     # cv2.putText(graph_frame, f"Mag: {mag}", org=(0, 200), fontFace=self.text_font, fontScale=1, color=self.text_color)
     # concatenate these
     display_frame = np.concatenate((frame, graph_frame), axis=1)
     encoded_bytes = camera_stream.get_encoded_bytes_for_frame(
         display_frame)
     put_output_image(encoded_bytes)
Ejemplo n.º 2
0
def frame_generator():
    """This is our main video feed"""
    camera = camera_stream.setup_camera()

    # allow the camera to warm up
    time.sleep(0.1)
    for frame in camera_stream.start_stream(camera):
        encoded_bytes = camera_stream.get_encoded_bytes_for_frame(frame)
        yield (b'--frame\r\n'
               b'Content-Type: image/jpeg\r\n\r\n' + encoded_bytes + b'\r\n')
Ejemplo n.º 3
0
def controlled_image_server_behavior():
    camera = camera_stream.setup_camera()
    time.sleep(0.1)

    for frame in camera_stream.start_stream(camera):
        encoded_bytes = camera_stream.get_encoded_bytes_for_frame(frame)
        put_output_image(encoded_bytes)

        instruction = get_control_instruction()
        if instruction and instruction['command'] == "exit":
                print("Stopping")
                return
Ejemplo n.º 4
0
 def make_display(self, frame):
     """Create display output, and put it on the queue"""
     encoded_bytes = camera_stream.get_encoded_bytes_for_frame(frame)
     put_output_image(encoded_bytes)
Ejemplo n.º 5
0
 def make_display(self, frame, processed):
     """Create display output, and put it on the queue"""
     # Make a dualscreen view - two images of the same scale joined together
     display_frame = np.concatenate((frame, processed), axis=1)
     encoded_bytes = camera_stream.get_encoded_bytes_for_frame(display_frame)
     put_output_image(encoded_bytes)
Ejemplo n.º 6
0
 def make_display(self, display_frame):
     encoded_bytes = camera_stream.get_encoded_bytes_for_frame(
         display_frame)
     put_output_image(encoded_bytes)