from skimage.measure import find_contours,regionprops#导入包 import cv2 import matplotlib.pyplot as plt num=45 syn='3_3' img1 = cv2.imread('C:/Users/lenovo/Desktop/show/abba/testresult/'+str(num)+'_x.tif',2)#读取图像 imggt = cv2.imread('C:/Users/lenovo/Desktop/show/abba/testresult/'+str(num)+'_gtx.tif',2)#读取标签 coungt=find_contours(imggt,level=0.5)#计算标签轮廓 countgt=coungt[0] plt.imshow(img1,cmap='gray') plt.plot(countgt[:,1],countgt[:,0],'r')#画点 fig = plt.gcf()#fig的一些基础设置 fig.set_size_inches(2.88,2.88) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.subplots_adjust(top = 1, bottom = 0, right = 1, left = 0, hspace = 0, wspace = 0) plt.margins(0,0) plt.savefig('C:/Users/lenovo/Desktop/show/'+str(num)+'_x.jpg', format='jpg', transparent=True, dpi=100, pad_inches = 0)#保存结果 plt.show()
图像label与图像融合
最新推荐文章于 2023-11-24 15:58:07 发布