想用for循环遍历图中的两个轮廓,但是只能显示一半

问题遇到的现象和发生背景

img

问题相关代码,请勿粘贴截图
import cv2
import numpy as np

imagepath = 'E:/149_v4.png'
# imagepath = ''
img = cv2.imread(imagepath, 1)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# 二值化
ret, thresh = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY)
# 图片轮廓
image, contours, hierarchy = cv2.findContours(thresh, 2, 1)

print(len(contours))
for i in range(len(contours)):
    if len(contours[i]) < 10:        # 删除图中可能存在的独立小凸包
        contours.remove(contours[i])

for j in contours:
    cnt = j

    # 寻找凸包并绘制凸包(轮廓)
    hull = cv2.convexHull(cnt)
    # hull = np.asarray(hull)

    length = len(hull)-1
    # print(length)
    dis_list = []
    for k in range(length):
        dis = np.linalg.norm(hull[k] - hull[k + 1])
        if dis < 100:
            dis_list.append(hull[k])
            length -= 1
        # new_hull = np.delete(hull, k + 1, axis=0)
        # print(dis)

        # dis_list.append(dis)
    dis_list = np.asarray(dis_list)

    temp = np.zeros(img.shape, np.uint8)        # 创建一个黑色的背景图
    cv2.polylines(temp, [dis_list], True, (255, 255, 2), 2)
    # cv2.polylines(temp, [s_dis_list], True, (255, 5, 255), 2)
    # cv2.polylines(img, [hull], True, (0, 255, 0), 2)
    # 显示图片
    cv2.imshow('line', temp)
    cv2.waitKey()
运行结果及报错内容

img

我的解答思路和尝试过的方法
我想要达到的结果

如何能让两个轮廓在一起显示

lst=[]
for j in contours:
    # 显示图片
    lst.append(temp)
both = np.hstack(lst)
cv2.imshow('line', both)
cv2.waitKey()
您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632