Image Processing on Raspberry, reduce frame rate for better performance

asked 2016-11-12 14:11:22 -0600

Hi,

I want to reduce the number of frames that the Raspberry have to decode, to increase my performance. Now it reads 33 frames/second. I can change it to 15 frames/sec with "cap.set(cv2.CAP_PROP_FPS, 15)", but I cant reduce it below 15, if I write 10 or 5 it still gives me 15 frames / second, what the processor can hardly handle. I want to read only 4-5 frames in a second. I cant get the current frame number from the stream either. Here is a little code without any image processing:

import cv2

import numpy as np

import os

###################################################################################################

def main():

    cap = cv2.VideoCapture(0)

    cap.set(cv2.CAP_PROP_FRAME_WIDTH, 720)
    cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 400)

    while cv2.waitKey(1) != 27 and cap.isOpened():                      # until the Esc key is pressed or webcam connection is lost

        _, img = cap.read()                                             # read next frame

        cv2.imshow("camera", img)

    # end while

    cv2.destroyAllWindows()

    cap.release()

    return

###################################################################################################
if __name__ == "__main__":
    main()
edit retag flag offensive close merge delete