def genside (img1, img2, height, width, name1, name2, txt1, txt2):
"""
create a side-by-side view
img1, img2: images
name1, name2: their names
txt1, txt2: some text
"""
if len(img1.shape)==2:
cimg1 = np.zeros((img1.shape[0], img1.shape[1], 3), dtype=np.uint8)
cimg1[...,0] = img1
cimg1[...,1] = img1
cimg1[...,2] = img1
else:
cimg1 = img1
if len(img2.shape)==2:
cimg2 = np.zeros((img2.shape[0], img2.shape[1], 3), dtype=np.uint8)
cimg2[...,0] = img2
cimg2[...,1] = img2
cimg2[...,2] = img2
else:
cimg2 = img2
if annotated:
cimg1=annotateImg(cimg1, (0,0,255), 2, (100, 70), 'Source: '+name1)
#cimg1=annotateImg(cimg1, (0,0,255), 2, (100, 130), txt1)
cimg2=annotateImg(cimg2, (0,0,255), 2, (100, 70), 'Target: '+name2)
#cimg2=annotateImg(cimg2, (0,0,255), 2, (100, 130), txt2)
cimg = mergeSide(cimg1, cimg2)
if annotated:
cimg=annotateImg(cimg, (0,255,0), 2, (100, 130), txt1)
return cimg
docompare.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录