Mouse as a Paint-Brush
- Learn to handle mouse events in OpenCV
- You will learn these functions : cv.setMouseCallback()
Simple Demo
Here, we create a simple application which draws a circle on an image wherever we double-click on it.
First we create a mouse callback function which is executed when a mouse event take place. Mouse event can be anything related to mouse like left-button down, left-button up, left-button double-click etc. It gives us the coordinates (x,y) for every mouse event. With this event and location, we can do whatever we like. To list all available events available, run the following code in Python terminal:
import cv2 as cv
events = [i for i in dir(cv) if ]
( )