Mouse events and slider controls are very useful in Computer Vision and OpenCV. Using these controls, users can interact directly with the interface and change the properties of their input images or variables.
In this section, we are going to introduce you to the concepts of adding slider and mouse events for basic interactions. To understand this correctly, we will create a small project, where we paint green circles in the image using the mouse events and blur the image with the slider:
// Create a variable to save the position value in track int blurAmount=15; // Trackbar call back function static void onChange(int pos, void* userInput); //Mouse callback static void onMouse( int event, int x, int y, int, void* userInput ); int main( int argc, const char** argv ) { // Read images Mat lena= imread("../lena.jpg"); // Create windows namedWindow("Lena"); // create a trackbark createTrackbar("Lena", "Lena", &blurAmount...