Does setTrackbarMax work correctly?

I’m new to openCV, and I tested my code using the cv::setTrackbarMax() function with opencv 4.5.4.
Using the Visual C++ (MSVC) debugger, I found that after executing the setTrackbarMax() function, the trackbar in the window was broken and I could not grab the trackbar to change its value.

The same phenomenon can be seen in the tutorial code “samples/cpp/falsecolor.cpp”
https://docs.opencv.org/4.5.3/d2/dcf/samples_2cpp_2falsecolor_8cpp-example.html

The following line in window_w32.cpp seems to cause the error.

In the above, should “range.end” be assigned to trackbar.maxval instead of “range.start”?

Thanks in advance.

2 Likes

it very much looks like you have a valid issue here ;}

Thank you for your quick reply! I submitted a new issue based on your suggestion.

however, i wonder - how did you get there, even ?
(stacktrace or similar ?)

setTrackbarMax() does not call this code, afaik.

In my case, cv::setTrackbarMax() is defined in window.cpp and it calls trackbar->setRange().

Does it answer the question?

1 Like

apologies, i got it wrong before, setTrackbarMax() != cvSetTrackbarMax()
(looked at the wrong code)

1 Like