I know the coordinates of rectange(x1,y1,x2,y2) I want to crop the rectangle portion
I have tried the same coordinates parameter as to draw rectangle for cropping.
black = np.zeros((1080, 720, 3), dtype = "uint8")
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
cv2.rectangle(black, (80,500), (150, 600), (0,255,0), 1, 8, 0)
crop = frame[80:500,150:600]
cv2.imshow("Black", black)
cv2.imshow("crop", crop)
cv2.imshow("Orginal", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
The output of the selection is not as rectangle drawn on the black.