Вот один из способов использования Python / OpenCV и Numpy.
Ввод:
![enter image description here](https://i.stack.imgur.com/uZf0i.jpg)
import cv2
import numpy as np
# read image
img = cv2.imread("efile.jpg")
points = np.array( [[ [693,67], [23,85], [62,924], [698,918] ]] )
# get bounding rectangle of points
x,y,w,h = cv2.boundingRect(points)
print(x,y,w,h)
# draw white filled polygon from points on black background as mask
mask = np.zeros_like(img)
cv2.fillPoly(mask, points, (255,255,255))
# fill background of image with black according to mask
masked = img.copy()
masked[mask==0] = 0
# crop to bounding rectangle
cropped = masked[y:y+h, x:x+w]
# write results
cv2.imwrite("efile_mask.jpg", mask)
cv2.imwrite("efile_masked.jpg", masked)
cv2.imwrite("efile_cropped.jpg", cropped)
# display it
cv2.imshow("efile_mask", mask)
cv2.imshow("efile_masked", masked)
cv2.imshow("efile_cropped", cropped)
cv2.waitKey(0)
Маска из указанных точек:
![enter image description here](https://i.stack.imgur.com/gPuuH.jpg)
Изображение с черным фоном:
![enter image description here](https://i.stack.imgur.com/yU7KM.jpg)
Обрезанный результат:
![enter image description here](https://i.stack.imgur.com/e8ama.jpg)