Python Forum
OpenCV simple showimage command takes 70ms on RPI4
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OpenCV simple showimage command takes 70ms on RPI4
#1
Dear Python and 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 algorithm 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 (the current people count) on the image during each cycle using putText.
I've already thought about skipping every 2nd or maybe 4 out of 5 frames, which will cause a showimage delay of 1 second but might still be acceptable.

Are there eventually more efficient ways to show images than openCV?
Thank you!
Please see my code below:

    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)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with isinstance command (very simple code) Laplace12 2 2,015 Jul-30-2020, 05:26 AM
Last Post: Laplace12
  Help with "simple" laser + printscreen command. joohanz 3 2,816 Dec-28-2017, 07:56 PM
Last Post: j.crater

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020