Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV Window Resize with Trackbar

Hi Guys,

I have set my windows to CV_WINDOW_NORMAL but whenever I add a track-bar to a window, it expends that window to the full width and I cannot re-size properly. It can be re sized vertically and slightly horizontally till the end of the slider. Is there anyway around it? Perhaps limiting the max length of the slider or having the slider automatically re-size to the window width?

An example:

    namedWindow("Threshold", CV_WINDOW_NORMAL);
    createTrackbar("Min", "Threshold", &threshMin, 255, on_trackbar);
    imshow("Threshold", imageThresh);

And this is what I get: See image:

If it helps, I'm using Visual Studio 2013 running on Windows 7. When the trackbar is removed from the window, it can be re-sized normally.

Thanks in advance!