Open ahmetmanyasli opened 4 years ago
Thank you for your report. It is not the first time someone complains about this problem. I think you found the problem right away (the waitkey
is the source of high CPU). I don't know what happens under Linux that the CPU gets so high.
I think all demos need to be checked regarding that.
I was thinking to transport my app from windows to linux. and cvui was my gui candidate but with this performance issue I can not use :(
I can help with that 😉 The function cvui::init()
has a second param that is the value to be used in all internal waitKey
calls. You can do something like this:
cvui::init(WINDOW_NAME, 40);
It will ensure the CPU load remains low both on Windows and on Linux. You can test a few values to ensure your app has the best performance possible, e.g. cvui::init(WINDOW_NAME, 60);
, cvui::init(WINDOW_NAME, 100);
. This second param of cvui::init()
works both on C++ and Python.
Check this demo to see it in action.
When I run your canny example on MS windows10 opencv 4.3 it works smoothly cpu consumtion almost %0 but When I run same canny example code on ubuntu 20.04 opencv 4.3 cpu consumtion %30-%40. I guess the problem waitkey