月光魔草

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

随笔分类 -  opencv

图像处理
摘要:from pylab import * mpl.rcParams['font.sans-serif'] = ['SimHei'] # 添加这条可以让图形显示中文 x_axis_data = [1, 2, 3, 4, 5] y_axis_data = [1, 2, 3, 4, 5] # plot中参数 阅读全文
posted @ 2020-09-19 16:06 月光魔草 阅读(935) 评论(0) 推荐(0)

摘要:代码很简短,如下: import cv2 import os rootdir = 'pic/' list = os.listdir(rootdir) for i in range(0,len(list)): img=cv2.imread("pic/"+list[i]) w,h,g=img.shape 阅读全文
posted @ 2020-08-18 11:32 月光魔草 阅读(1452) 评论(0) 推荐(0)

摘要:以下是坐标系内画圆: import cv2 as cv import matplotlib.pyplot as plt circlel=plt.Circle((0.4,0.4),0.2,color='r') fig,ax=plt.subplots() ax.add_artist(circlel) f 阅读全文
posted @ 2020-06-13 19:01 月光魔草 阅读(153) 评论(0) 推荐(0)

摘要:首先引入包,matplotlib,据说可以绘制各种几何图,甚至3D立体图 以下是直方图绘制方法 import matplotlib.pyplot as pltimport numpy as np x=np.random.randint(0,100,100)#生成【0-100】之间的100个数据plt 阅读全文
posted @ 2020-06-11 10:46 月光魔草 阅读(175) 评论(0) 推荐(0)

摘要:平移: 遍历像素即可,也可以用函数[ : , m:n ] w,h,m= img.shape dst = np.zeros((w,h,m), np.uint8) for i in range(w-50): for j in range( h-60): dst[i+50, j+60] = img[i, 阅读全文
posted @ 2020-06-10 22:12 月光魔草 阅读(364) 评论(0) 推荐(0)

摘要:图像三原色分离,叫做RGB通道(愈发的感觉像是PS中的图像处理,不过我们是用代码实现的),效果图如下: 染色前: 染色后: 代码如下: def RBG(src): b,g,r=cv2.split(src) cv2.imshow("b",b) cv2.imshow("g",g) cv2.imshow( 阅读全文
posted @ 2020-06-10 15:17 月光魔草 阅读(227) 评论(0) 推荐(0)

摘要:# -*-coding:utf-8 -*- import cv2 as cv #打开图片 img=cv.imread("08.png") #cv.imshow("la",img) #变灰 gray=cv.cvtColor(img, cv.COLOR_RGB2GRAY) #cv.imshow("gra 阅读全文
posted @ 2020-06-10 14:22 月光魔草 阅读(2867) 评论(0) 推荐(0)