I'm trying to take a recording with picamera and have all the resultant frames in an rgb numpy array. To this end I've found the piRGBAnalysis class, but I'm a bit confused about how to use it.
This custom output class is intended to be used with the start_recording() method when it is called with format set to 'rgb' or 'bgr'. While recording is in progress, the write() method converts incoming frame data into a numpy array and calls the stub analyse() method with the resulting array (this deliberately raises NotImplementedError in this class; you must override it in your descendent class).
The part that has me confused is where exactly write() comes into the picture. Here is my code. All I want to see is confirmation that my overridden analyse method has been entered and that presumably it has the rgb array of one of the frames from the recording.
# Inherit from PiRGBAnalysis class main(picamera.array.PiRGBAnalysis): theGodArray =  def analyse(array): print('here') theGodArray = array with picamera.PiCamera() as camera: with picamera.array.PiRGBAnalysis(camera) as output: camera.resolution = (256, 256) camera.framerate = 30 camera.start_recording(str(uuid.uuid4())+'.rgb', format='rgb') main(output) # This line is I'm sure incorrect. time.sleep(5) camera.stop_recording()
Above I guess I assumed that since we have
with picamera.array.PiRGBAnalysis(camera) as output in a similar vein to this example on PiRGBArray and since we're using start_recording as required that main(output) will be called for each frame data leading to write() being called and finally my analyse function being called.
This is not the case. How do I make it so that "While recording is in progress, the write() method converts the frame data into a numpy array" ?