numpy
baoxin1100
阿里巴巴算法工程师,图像算法,检测,分类,重识别
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
url转numpy array,url转PIL Image,url转图片
url链接转numpy array,PIL Image,保存成图片原创 2023-01-10 16:55:25 · 765 阅读 · 0 评论 -
matplotlib plt.figure 转 numpy array
思路:利用plt.savefig向BytesIO缓存中保存文件,再用PIL读取缓存中的文件转为numpyfrom PIL import Imagefrom io import BytesIOimg = np.ones((256,256,3), dtype=np.uint8)plt.figure()plt.imshow(img, cmap='gray')buffer = BytesIO()plt.savefig(buffer, format='png')new_img = np.asarra原创 2021-01-21 10:23:26 · 1888 阅读 · 0 评论 -
python 求两个向量的顺时针夹角
以上述图片举例,要求 OB⃗\vec{OB}OB 相对 OA⃗\vec{OA}OA 的顺时针夹角。注意:这里使用图像坐标系1 定义求顺时针角度的函数import numpy as npdef clockwise_angle(v1, v2): x1,y1 = v1 x2,y2 = v2 dot = x1*x2+y1*y2 det = x1*y2-y1*x2 theta = np.arctan2(det, dot) theta = theta if theta>0 else 2*np..原创 2020-12-09 10:11:14 · 1425 阅读 · 1 评论
分享