What's happening underneath?
Let's start with the main function in this program. We create a white image on which we are going to click using the mouse. We then create a named window and bind the MouseCallback function to this window. The MouseCallback function is basically the function that will be called when a mouse event is detected. There are many kinds of mouse events, such as clicking, double-clicking, dragging, and so on. In our case, we just want to detect a mouse click. In the detect_quadrant function, we check the first input argument event to see what action was performed. OpenCV provides a set of predefined events, and we can call them using specific keywords. If you want to see a list of all the mouse events, you can go to the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access