Python
growthmindset
这个作者很懒,什么都没留下…
展开
-
Python图片上画矩形 点 连线 文字标注并保存
画矩形import cv2 as cvimg=cv.imread(imgpath) #导入图片#img;边框左上角的像素坐标;右下角的像素坐标;像素坐标值都是正整数,边框颜色是绿色;边框的线宽度为2.cv.rectangle(img,(x1,y1),(x2,y2),(0,250,0),2) cv.imwrite(new_imgpath, img) #将画好的图片保存在指定路径画实心圆import cv2 as cvimg=cv.imread(imgpath)原创 2021-01-11 18:54:33 · 1595 阅读 · 1 评论 -
Python获取并存储文本文档中指定字符串后的所有数字
def Solution(path): with open(path,"r",encoding="utf-8") as f: #用notepad打开文本文档修改编码格式为utf-8 (原因:容易报gbk相关错误,是跟编码格式相关) data=f.read() #print(data) import re reg=re.compile(r"(?<=指定字符串)\d+") match=reg.findall(data)原创 2020-11-02 16:16:08 · 2266 阅读 · 0 评论