_, new_contours, _ = cv2.findContours(eroded_img, cv2.RETR_EXTERNAL, cv2.
    CHAIN_APPROX_SIMPLE)
_, y_t, _, h_t = cv2.boundingRect(new_contours[0])
_, y_b, _, h_b = cv2.boundingRect(new_contours[1])
bottom_top_y = max(y_t, y_b)
top_bottom_y = min(y_t + h_t, y_b + h_b)
half = top_bottom_y + (bottom_top_y - top_bottom_y) / 2
roi = lab[y:y + half, x:x + w]
mask = binary[y:y + half, x:x + w]
mean = cv2.mean(roi, mask=mask)
L = int(mean[0])
a = int(mean[1])
b = int(mean[2])
print(L, a, b)
Местоположение минимального размера контура OpenCV в python