135*50 的验证码图片 如何分4个等分,参数如何写?

135*50 的验证码图片 如何分4个等分,参数如何写?

img

img

could not broadcast input array from shape (50,30) into shape (30,30)


import cv2
img = cv2.imread(r"C:\Users\HJ\Desktop\images\for5.png")
height, width = img.shape[:2]
img_sets = []
for i in range(4):
    # 竖着就用width, 横着等分就用height
    start = int(i * width / 4)
    end = int((i+1) * width / 4)
    img_set = img[:, start:end, :]
    img_sets.append(img_set)

可以试试图像水平投影。