python PIL图像处理-框选
生活随笔
收集整理的這篇文章主要介紹了
python PIL图像处理-框选
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
框選圖中位置
代碼
from PIL import Image,ImageDraw,ImageFont,ImageFilter import random#------------------------------------- #filepath,[837,103][942,208]#圖片處理,框選 def pic_rectangle(filepath,bound):image = Image.open(filepath)draw = ImageDraw.Draw(image)# 坐標x1, y1 =bound[0]x2, y2 =bound[1]# outline 外線,fill填充draw.rectangle((x1, y1, x2, y2), outline="red", width=5)image.save('filepath', 'jpeg')#image.show()if __name__=="__main__":#調用filepath="./image/name.jpg"bound=[[744, 276],[1014, 366]]pic_rectangle(filepath,bound)?
轉載于:https://www.cnblogs.com/lisa2016/p/10697271.html
總結
以上是生活随笔為你收集整理的python PIL图像处理-框选的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 小程序2-基本架构讲解(一)WXSS样式
- 下一篇: 如何在PPT中完成简单的二维码背景抠图操