import cv2
import numpy as np
image = cv2.imread('train/192.168.124.1881663399190588.jpg')
cv2.imshow("original", image)
mask = np.zeros(image.shape[:2], dtype="uint8")
cv2.rectangle(mask, (30, 90), (280, 440), 255, -1)
cv2.imshow("rectangular mask", mask)
masked = cv2.bitwise_and(image, image, mask=mask)
cv2.imshow("rectangular mask applied to image", masked)
cv2.waitKey(0)
mask = np.zeros(image.shape[:2], dtype="uint8")
cv2.circle(mask, (155, 200), 140, 255, -1)
masked = cv2.bitwise_and(image, image, mask=mask)
cv2.imshow("circular mask", mask)
cv2.imshow("circular mask applied to image", masked)
cv2.waitKey(0)