try to get the width of the contour’s bbox:
r = cv2.boundingRect(max_contour) w = r[2] # r = [x,y,w,h]