Dovyski / cvui

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

EnhancedWindow draws image outside of window #95

Open mwindowshz opened 4 years ago

mwindowshz commented 4 years ago

EnhancedWindow draws image outside of window

When trying to draw an image in EnhancedWindow using

EnhancedWindow settings(0, 100, video.cols, video.rows, "video");
settings.begin(frame);
        if (!settings.isMinimized()) 
                {
            cvui::image(video); // video is mat with image
        }
        settings.end();

Image is displayed with some offset to the left and bottom and not in the "window" area:

image

hope there is a solution Thanks M.

Dovyski commented 4 years ago

Thanks for your bug report! It's probably the border of the hidden window being rendered. I'll check it.

mwindowshz commented 4 years ago

Hi I found a solution for this: EnahncedWindow.h line 74 I removed this line //cvui::beginRow(frame, mX + std::lround(10*mFontScale/cvui::DEFAULT_FONT_SCALE), mY + std::lround(30*mFontScale/cvui::DEFAULT_FONT_SCALE), mWidth - scaledTitleHeight, mHeight - scaledTitleHeight); whithout this the image is in place

image

Hope this is a good solution.

Dovyski commented 4 years ago

Great, thank you. As soon as your PR is merged, the problem should be gone. If anyone is facing the issue, check the code snippet above.