I tried to create it by writing the command:
myRect = cv2.Rect(p1, p2)
but it does not find it. It writes:
Cannot find reference 'Rect' in 'imported module cv2'.
thanks for helping!
to make it clearer: I don't want to draw a rectangle on an image. I want to create a Rect object to apply methods on, such as area().