OpenCvSharp (C# OpenCV) uses CvTrackbar slider to realize binarization threshold debugging (with source code)

Click the card below to follow the public account of " OpenCV and AI Deep Learning "!

Visual/image heavy dry goods, delivered as soon as possible!

foreword

Both the Python and C++ versions of OpenCV encapsulate the functions of sliders and mouse events. This article will introduce the use of sliders (CvTrackbar) in OpenCvSharp to dynamically adjust the binarization threshold, check the binarization effect, and facilitate debugging and selection of appropriate thresholds .

Slider class in OpenCvSharp - CvTrackbar

CvTrackbar slider class, go to the definition to see the following properties:

 Note: The creation of the slider depends on the window, so you must first define a Window class object, and then create the slider. The code is as follows:

string windowName = "Test-TrackBar";
src = Cv2.ImRead("./test.jpg");
Cv2.ImShow("src", src);
TrackbarCallback callback = new TrackbarCallback(OnChange);
Window window = new Window(windowName, src);
CvTrackba

Guess you like

Origin blog.csdn.net/stq054188/article/details/123668308