OpenCV  4.1.0
Open Source Computer Vision
Adding a Trackbar to our applications!

Goals

In this tutorial you will learn how to:

Code

Let's modify the program made in the tutorial Adding (blending) two images using OpenCV. We will let the user enter the \(\alpha\) value by using the Trackbar.

[block] [block] [block]

Explanation

We only analyze the code that is related to Trackbar:

[block] [block] [block] [block] [block] [block] [block] [block] [block]

Note the following (C++ code):

Finally, we have to define the callback function on_trackbar for C++ and Python code, using an anonymous inner class listener in Java

[block] [block] [block]

Note that (C++ code):

Result