I think it should be a very simple problem, but I cannot find a solution or an effective keyword for search.
I just have this image.
Python Version 3.6
Crop images and insert into a 'CropedImages' folder
import cv2
import os
arr = os.listdir('./OriginalImages')
for itr in arr:
img = cv2.imread(itr)
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
_,thresh = cv2.threshold(gray, 120, 255, cv2.THRESH_BINARY)
_, contours, _ = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
cnt = contours[0]
x,y,w,h = cv2.boundingRect(cnt)
crop = img[y:y+h,x:x+w]
cv2.imwrite('CropedImages/'+itr,crop)
Change the number 120 to other in 9th line and try for your images, It will work