Example #1
0
 def __init__(self):
     """
     Initialises the camera and sets the isFirstFrame attribute to allow
     creation of the encoder on first frame only
     """
     PiCamera.__init__(self)
     self.isFirstFrame = True
Example #2
0
 def __init__(self):
     """
     Initialises the camera and sets the isFirstFrame attribute to allow
     creation of the encoder on first frame only
     """
     PiCamera.__init__(self)
     self.isFirstFrame = True
Example #3
0
class ThePiCamera(Camera):
    """
    Class for Raspberry Pi camera frame retrieval.
    """
    def __init__(self):
        """
        Constructor for ThePiCamera. This initializes parameters for Raspberry
        Pi camera capture.
        """
        self.camera = PiCamera()
        self.camera.resolution = (640, 480)
        self.camera.framerate = 32
        self.rawCapture = PiRGBArray(self.camera, size=(640, 480))
        time.sleep(0.1) # allow the camera to warm up

    def get_iterator(self):
        """
        Returns an iterator for obtaining a continuous stream of camera frames.
        """
        return self.camera.capture_continuous(self.rawCapture, format='bgr', use_video_port=True)

    def get_frame(self, raw_frame):
        """
        Retrieves the camera frame returned by the iterator, converted into a
        2D array.
        """
        array = raw_frame.array
        self.rawCapture.truncate(0)
        return array

    def destroy(self):
        """
        Cleans up memory used for Raspberry Pi camera capture.
        """
        self.camera.close()
Example #4
0
 def __init__(self):
     """
     Constructor for ThePiCamera. This initializes parameters for Raspberry
     Pi camera capture.
     """
     self.camera = PiCamera()
     self.camera.resolution = (640, 480)
     self.camera.framerate = 32
     self.rawCapture = PiRGBArray(self.camera, size=(640, 480))
     time.sleep(0.1) # allow the camera to warm up
Example #5
0
def get_image():
    camera = PiCamera()

    camera.capture("photo.jpg")
    camera.close()
    return send_file('photo.jpg', mimetype='image/gif')