摘要: 图像金字塔 高斯金字塔 高斯金字塔:向下采样方法(缩小) 高斯金字塔:向上采样方法(放大) img=cv2.imread("AM.png") cv_show(img,'img') print (img.shape) 效果: up=cv2.pyrUp(img) cv_show(up,'up') pri 阅读全文
posted @ 2020-02-10 17:18 搞点薯条 阅读(445) 评论(0) 推荐(0) 编辑
摘要: Canny边缘检测 使用高斯滤波器,以平滑图像,滤除噪声 计算图像中每个像素点的梯度强度和方向 应用非极大值(Non-Maximum Suppression)抑制,以消除边缘检测带来的杂散响应 应用双阈值(Double-Threshold)检测来确定真实的和潜在的边缘 双阈值检测 通过抑制孤立的弱边 阅读全文
posted @ 2020-02-10 16:41 搞点薯条 阅读(636) 评论(0) 推荐(1) 编辑
摘要: 图像梯度-Sobel算子 img = cv2.imread('pie.png',cv2.IMREAD_GRAYSCALE) cv2.imshow("img",img) cv2.waitKey() cv2.destroyAllWindows() 效果: dst = cv2.Sobel(src, dde 阅读全文
posted @ 2020-02-10 15:39 搞点薯条 阅读(568) 评论(0) 推荐(0) 编辑
摘要: 形态学-腐蚀操作 img = cv2.imread('dige.png') cv2.imshow('img', img) cv2.waitKey(0) cv2.destroyAllWindows() 效果: kernel = np.ones((3,3),np.uint8) erosion = cv2 阅读全文
posted @ 2020-02-09 22:52 搞点薯条 阅读(409) 评论(0) 推荐(0) 编辑
摘要: 图像阈值 ret, dst = cv2.threshold(src, thresh, maxval, type) 两个返回值分别是阈值处理后的像素点矩阵列表、输出图 src: 输入图,只能输入单通道图像,通常来说为灰度图 dst: 输出图 thresh: 阈值 maxval: 当像素值超过了阈值(或 阅读全文
posted @ 2020-02-09 21:54 搞点薯条 阅读(444) 评论(1) 推荐(0) 编辑
摘要: 图像基本操作 环境配置地址 Anaconda:https://www.anaconda.com/download/ Python_whl:https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv IDE:按照自己的喜好,选择一个能debug就好 安装ope 阅读全文
posted @ 2020-02-09 20:09 搞点薯条 阅读(829) 评论(2) 推荐(2) 编辑
摘要: __call__ 在Python中,函数其实是一个对象: >>> f = abs >>> f.__name__ 'abs' >>> f(-123) 123 由于 f 可以被调用,所以,f 被称为可调用对象。 所有的函数都是可调用对象。 一个类实例也可以变成一个可调用对象,只需要实现一个特殊方法__c 阅读全文
posted @ 2020-02-08 22:58 搞点薯条 阅读(141) 评论(0) 推荐(0) 编辑
摘要: __slots__ 由于Python是动态语言,任何实例在运行期都可以动态地添加属性。 如果要限制添加的属性,例如,Student类只允许添加 name、gender和score 这3个属性,就可以利用Python的一个特殊的__slots__来实现。 顾名思义,__slots__是指一个类允许的属 阅读全文
posted @ 2020-02-08 22:47 搞点薯条 阅读(159) 评论(0) 推荐(0) 编辑
摘要: @property 考察 Student 类: class Student(object): def __init__(self, name, score): self.name = name self.score = score 当我们想要修改一个 Student 的 scroe 属性时,可以这么 阅读全文
posted @ 2020-02-08 22:36 搞点薯条 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 类型转换 Rational类实现了有理数运算,但是,如果要把结果转为 int 或 float 怎么办? 考察整数和浮点数的转换: >>> int(12.34) 12 >>> float(12) 12.0 如果要把 Rational 转为 int,应该使用: r = Rational(12, 5) n 阅读全文
posted @ 2020-02-08 22:23 搞点薯条 阅读(179) 评论(0) 推荐(0) 编辑