标签:http des info highlight image format 分享 inf .text
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author : zhibo.wang # E-mail : d_1206@qq.com # Time : 2018/8/21 17:24 # Des : # import imutils # import numpy as np import cv2 from PIL import Image, ImageDraw, ImageFont from skimage.measure import regionprops # from shapely.geometry import Point, Polygon img = cv2.imread(‘1.png‘, 0) ret, labels = cv2.connectedComponents(img) props = regionprops(labels) im = Image.open("1.png") draw = ImageDraw.Draw(im) for i in props: # print(i.coords) # print(props.index(i), i.centroid) draw.text((i.centroid[-1], i.centroid[0]), "{0}".format(props.index(i)), fill=(255,25,0))#,font=ttfont) im.show()
标签:http des info highlight image format 分享 inf .text
原文地址:https://www.cnblogs.com/dockers/p/9565150.html