How To Crop Rectangular Shapes In An Image Using Python
Can anyone give me advice on how to crop the two rectangular boxes and save it? I already tried this code, but it does not crop very well import cv2; import numpy as np; # Run th
Solution 1:
if you have the coordinates of the rectangles you can try:
cropped = img [y1:y2, x1:x2]
cv2.imwrite('cropped.png', cropped)
The first line crops the image base on the given coordinates assuming (y1
Post a Comment for "How To Crop Rectangular Shapes In An Image Using Python"