def genoverlay(img1, title, name1, name2, stattxt, img2=None):
"""
create an overlayed view
img1, img2: images
title: kind of title to print
name1, name2: their names
txt: text to print below the title
"""
if img2 is None:
outimg = 255*(1-img1)
else:
s=np.maximum(img1.shape,img2.shape)
outimg=np.zeros((s[0], s[1], 3), dtype=np.uint8)
#outimg[:img1.shape[0], :img1.shape[1],0] = (255*(1-img1))
#outimg[:img2.shape[0], :img2.shape[1],1] = (255*(1-img2))
#outimg[:img2.shape[0], :img2.shape[1],2] = (255*(1-img2))
outimg[:img1.shape[0], :img1.shape[1],0] = img1
outimg[:img2.shape[0], :img2.shape[1],1] = img2
outimg[:img2.shape[0], :img2.shape[1],2] = img2
outimg = 255*(1-outimg)
if annotated:
outimg = annotateImg(outimg, (0, 0, 255), 2, (100, 50), title)
txt = "cyan: %s %s"%(sourceid,name1)
outimg = annotateImg(outimg, (0, 255, 255), 2, (100, 80), txt)
txt = "red: %s %s"%(targetid,name2)
outimg = annotateImg(outimg, (255, 0, 0), 2, (100, 110), txt)
#outimg=annotateImg(outimg, 'blue', mm2px(4), mm2px(4), txt)
outimg = annotateImg(outimg, (0, 0, 255), 1.3, (100, 140), stattxt)
return outimg
docompare.py 文件源码
python
阅读 35
收藏 0
点赞 0
评论 0
评论列表
文章目录