draw.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Vehicle_ReID 作者: starimpact 项目源码 文件源码
def drawText_BKG(cimg, txt, posxy, fz, bkglen):
    ttFont0 = ImageFont.truetype(fontfile, fz)
    im = Image.fromarray(cimg, 'RGB')
    drawable = ImageDraw.Draw(im)
    drawable.polygon(((posxy[0], posxy[1]), \
                      (posxy[0]+bkglen, posxy[1]), \
                      (posxy[0]+bkglen, posxy[1]+fz), \
                      (posxy[0], posxy[1]+fz)), fill=(255, 255, 255))
    drawable.text ((posxy[0], posxy[1]), txt, fill=(0, 0, 255), font=ttFont0)
    npimg = np.asarray(im)

    return npimg
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号