Ask Your Question

Revision history [back]

OpenCV simple showimage command takes 70ms on RPI4

Dear OpenCV-Fellows, I am using openCV on a RPI4 - 4GB and I'm doing realtime person detection with it so frame rate is quite crucial. My whole alogrithm takes 70ms and then, on top, the showimage takes again 70ms, which basically halfs the framerate.

Can you think of a way to speed up the imageshow? Currently, I am using a 1920x1080png with a size of around 1MB. I update only a few numbers on the image during each cycle.

def showimage(img):
    to_show = img.copy()
    cv2.namedWindow("window", cv2.WND_PROP_FULLSCREEN)
    cv2.setWindowProperty("window",cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN)
    cv2.putText(to_show, str(allowed), (180, 660), cv2.FONT_HERSHEY_SIMPLEX, 10, (255, 255, 255), 15)
    cv2.putText(to_show, str(people_inside), (180, 1020), cv2.FONT_HERSHEY_SIMPLEX, 10, (255, 255, 255), 15)
    cv2.imshow("window", to_show)
    cv2.waitKey(1)