链接: https://pan.baidu.com/s/1ngkcwCDvNjM07nc0JgS1aA 密码: c27d
查看数据标注情况:
# -*- encoding: utf-8 -*-
"""
@date: 2021/3/30 10:43 上午
@author: xuehuiping
"""
from PIL import Image, ImageDraw
label_file_name = ‘/Users/xuehuiping/data/ctw1500/train/text_label_curve/0005.txt‘
img_file_name = ‘/Users/xuehuiping/data/ctw1500/train/text_image/0005.jpg‘
im = Image.open(img_file_name)
draw = ImageDraw.Draw(im) # 实例化一个对象
lines = open(label_file_name).readlines()
for line in lines:
# print(line)
cells = line.strip().split(‘,‘)
tmp = cells[4:]
xy = []
for i in range(len(tmp)):
if i % 2 == 0:
xy.append(int(tmp[i]) + int(cells[0]))
else:
xy.append(int(tmp[i]) + int(cells[1]))
# print(xy)
draw.polygon(
xy, fill=(0, 255, 0))
im.show()
示例1:
示例2:
示例2原始图片:
示例3:
原文:https://www.cnblogs.com/xuehuiping/p/14610819.html