x, y = [], []
for contour_line in contours:
    for contour in contour_line:
        x.append(contour[0][0])
y.append(contour[0][1])
x1, x2, y1, y2 = min(x), max(x), min(y), max(y)
cropped = img[y1:y2, x1:x2]
Opencv Python Crop Image Using Numpy Array