Dovyski / cvui

A (very) simple UI lib built on top of OpenCV drawing primitives
https://dovyski.github.io/cvui/
MIT License
835 stars 213 forks source link

why both #106

Closed coldstart01 closed 3 years ago

coldstart01 commented 3 years ago

Hi, love cvui.

Why does it seems that I need both cvui image and imshow to display an image. I've tried them individually but then they don't show anything at all.

cvui::image(frame, 25, 25, im_with_keypoints); ... cvui::imshow(WINDOW1_NAME, frame);

Thank you.

WojOstr commented 3 years ago

Hi, im not the specialist out there, but as far as I know you can put multiple images on frame, but it won't show up until you call imshow(window, frame), because you have to pass the frame to window to show it

Dovyski commented 3 years ago

The explanation provided by @WojOstr nailed it. For further understanding, @coldstart01 , the function cvui::image() is one (of the many) drawing primitives cvui has. They all work putting pixels in a frame (a cv::Mat). When you are done drawing things (images, checkboxes, etc), you need to call OpenCV's function to show the frame in a window.

cv::imshow() is that function. Since cvui does a lot of heavy lifting under the hook, e.g. detect shortcut keys, it has its own version of imshow named cvui::imshow. In practice they do the same thing (show a frame in a window), but cvui's one some things extra.

Is it clear now?

coldstart01 commented 3 years ago

Ive built a few GUIs with cvui and its lightweight construction has allowed me to control ooencv programs in real time with transparent overlays. Its easy, made my programs more responsive. For example i made an overlay that implemented in real time control over many if the params. Thanks for helping further understanding.

--

On Mon, Apr 5, 2021, at 4:53 PM, Fernando Bevilacqua wrote:

The explanation provided by @WojOstr https://github.com/WojOstr nailed it. For further understanding, @coldstart01 https://github.com/coldstart01 , the function cvui::image() is one (of the many) drawing primitives cvui has. They all work putting pixels in a frame (a cv::Mat). When you are done drawing things (images, checkboxes, etc), you need to call OpenCV's function to show the frame in a window.

cv::imshow() is that function. Since cvui does a lot of heavy lifting under the hook, e.g. detect shortcut keys, it has its own version of imshow named cvui::imshow. In practice they do the same thing (show a frame in a window), but cvui's one some things extra.

Is it clear now?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Dovyski/cvui/issues/106#issuecomment-813643595, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMAYAAWDHYPCOTJROKZ6RVLTHIPNPANCNFSM4ZZZ5KZA.

Dovyski commented 3 years ago

I am very glad to hear that, @coldstart01, thank you!