Skip to content

Does setTrackbarMax work correctly?  #21002

@YuToyoshima

Description

@YuToyoshima
System information (version)
  • OpenCV => 4.5.4
  • Operating System / Platform => Windows 64 Bit
  • Compiler => Visual Studio 2019
Detailed description

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.

trackbar.maxval = range.start;

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

Thanks in advance.

Steps to reproduce

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

(In my environment,

setTrackbarPos("colormap", winName, -1);

did not work correctly and I commented out the line. )

Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions