import numpy as np
NumPy for manipulation in Color matrix.
import cv2 as cv
Computer Vision for reading and showing images and image manipulation.
from matplotlib import pyplot as plt
Matplotlib for data visualization. (Optional)
img = cv.imread(‘./img/sea.jpg’)
cv.imread() function is an OpenCV function in Python that makes it easy for the computer to read images. It takes one argument i.e the image source in the form of Absolute or Relative Path.
Next Step is to setMouseCallback() function. It takes two parameters:
The Window name on which the image is being shown
A Callback function that will process the image and will return output on some mouse events.
Read the whole post Mouse Events OpenCV python from the original Post.