高级滤波:

 from skimage import data,color,data_dir
import matplotlib.pyplot as plt
from skimage.morphology import disk
import skimage.filters.rank as sfr
img =color.rgb2gray(data.camera())
auto =sfr.autolevel(img, disk(5)) #半径为5的圆形滤波器
plt.figure('filters',figsize=(8,8))
plt.subplot(121)
plt.imshow(img,plt.cm.gray)
plt.subplot(122)
plt.imshow(auto,plt.cm.gray)
data_dir

高级滤波.....

 from skimage import data,color
import matplotlib.pyplot as plt
from skimage.morphology import disk
import skimage.filters.rank as sfr
img =color.rgb2gray(data.camera())
auto =sfr.bottomhat(img, disk(5)) #半径为5的圆形滤波器
auto1 =sfr.tophat(img, disk(5)) #半径为5的圆形滤波器
plt.figure('filters',figsize=(12,12))
plt.subplot(131)
plt.imshow(img,plt.cm.gray)
plt.subplot(132)
plt.imshow(auto,plt.cm.gray)
plt.subplot(133)
plt.imshow(auto1,plt.cm.gray)

提取轮廓....

 import numpy as np
import matplotlib.pyplot as plt
from skimage import measure,draw,data,filters
#生成二值测试图像
img=data.page()
thresh = filters.threshold_isodata(img)
img1 = (img <= thresh)*1.0 #根据阈值进行分割
#检测所有图形的轮廓
img2 = img1[:,:]
contours = measure.find_contours(img1, 0.5)
#绘制轮廓
fig, (ax0,ax1,ax2) = plt.subplots(1,3,figsize=(15,15))
ax0.imshow(img,plt.cm.gray)
ax1.imshow(img1,plt.cm.gray)
ax2.imshow(img2,plt.cm.gray) #enumerate索引序列
for n, contour in enumerate(contours):
ax2.plot(contour[:, 1], contour[:, 0], linewidth=1)
plt.show()

提取轮廓..............

 import matplotlib.pyplot as plt
from skimage import measure,data,color
img=color.rgb2gray(data.horse())
contours = measure.find_contours(img, 0.5)
fig, axes = plt.subplots(1,2,figsize=(8,8))
ax0, ax1= axes.ravel()
ax0.imshow(img,plt.cm.gray)
rows,cols=img.shape
ax1.axis([0,rows,cols,0])
for n, contour in enumerate(contours):
ax1.plot(contour[:, 1], contour[:, 0], linewidth=1)
ax1.axis('image')
plt.show()

凸包............

import matplotlib.pyplot as plt
from skimage import data,color,morphology
img=color.rgb2gray(data.horse())
img=(img<0.5)*1
chull = morphology.convex_hull_image(img)
fig, axes = plt.subplots(1,2,figsize=(8,8))
ax0, ax1= axes.ravel()
ax0.imshow(img,plt.cm.gray)
ax1.imshow(chull,plt.cm.gray)

多个凸包.....................................................................................

 import matplotlib.pyplot as plt
from skimage import data,color,morphology,feature
img=color.rgb2gray(data.coins())
edgs=feature.canny(img, sigma=3, low_threshold=10, high_threshold=50)
chull = morphology.convex_hull_object(edgs) #绘制轮廓
fig, axes = plt.subplots(1,2,figsize=(8,8))
ax0, ax1= axes.ravel()
ax0.imshow(edgs,plt.cm.gray)
ax0.set_title('many objects')
ax1.imshow(chull,plt.cm.gray)
ax1.set_title('convex_hull image')
plt.show()

看不懂也写不下去了...

python的数字图像处理学习(3)的更多相关文章

  1. python的数字图像处理学习(2)

    图像的重定义大小,图像的缩扩,图像的旋转: from skimage import transform,data import matplotlib.pyplot as plt img = data. ...

  2. python的数字图像处理学习(1)

    导入原有的测试图片,测试图片路径,和一些方法,显示出测试图像,测试图像路径. from skimage import io,data,data_dir img_rgb=data.chelsea() i ...

  3. 【笔记】基于Python的数字图像处理

    [博客导航] [Python相关] 前言 基于Python的数字图像处理,离不开相关处理的第三方库函数.搜索网络资源,列出如下资源链接. Python图像处理库到底用哪家 python计算机视觉编程— ...

  4. 数字图像处理学习笔记之一 DIP绪论与MATLAB基础

    写在前面的话 数字图像处理系列的学习笔记是作者结合上海大学计算机学院<数字图像处理>课程的学习所做的笔记,使用参考书籍为<冈萨雷斯数字图像处理(第二版)(MATLAB版)>,同 ...

  5. MATLAB数字图像处理学习笔记

    我们都知道一幅图片就相当于一个二维数组,可以用一个矩阵来表示,而MATLAB可以说就是为矩阵运算而生的,所以学习图像处理,学习MATLAB势在必行! 一. MATLAB基础知识 1. 读取图像 %im ...

  6. 初始----python数字图像处理--:环境安装与配置

    一提到数字图像处理编程,可能大多数人就会想到matlab,但matlab也有自身的缺点: 1.不开源,价格贵 2.软件容量大.一般3G以上,高版本甚至达5G以上. 3.只能做研究,不易转化成软件. 因 ...

  7. 数字图像处理(一)之灰度转换和卷积python实现

    使用Python实现数字图像处理中如下功能: 彩色图像转成灰度图像 实现图像的相关&卷积操作 实现图像的高斯核卷积 使用的库和python版本如下: imageio:2.9.0 用于读取磁盘中 ...

  8. python数字图像处理(17):边缘与轮廓

    在前面的python数字图像处理(10):图像简单滤波 中,我们已经讲解了很多算子用来检测边缘,其中用得最多的canny算子边缘检测. 本篇我们讲解一些其它方法来检测轮廓. 1.查找轮廓(find_c ...

  9. python数字图像处理(1):环境安装与配置

    一提到数字图像处理编程,可能大多数人就会想到matlab,但matlab也有自身的缺点: 1.不开源,价格贵 2.软件容量大.一般3G以上,高版本甚至达5G以上. 3.只能做研究,不易转化成软件. 因 ...

随机推荐

  1. Python3 reversed 函数

    Python3 reversed 函数  Python3 内置函数 描述 reversed 函数返回一个反转的迭代器. 语法 以下是 reversed 的语法: reversed(seq) 参数 se ...

  2. 100. Same Tree (Tree;DFS)

    Given two binary trees, write a function to check if they are equal or not. Two binary trees are con ...

  3. Shell教程 之test命令

    Shell中的 test 命令用于检查某个条件是否成立,它可以进行数值.字符和文件三个方面的测试. 1.数字测试 参数 说明 -eq 等于则为真 -ne 不等于则为真 -gt 大于则为真 -ge 大于 ...

  4. oracle数据库查询出多条数据,合并,之后列转行

    select B.enterprise_code, B.enterprise_name, sum(B.h0_overnum) AS over00, sum(B.h1_overnum) AS over0 ...

  5. QT注意事项(持续更新...)

    同样要注意new和delete的问题: is not a member of QApplication:这个错误可能是找不到信号或槽函数: 想用到信号槽,必须至少继承QObject类,并在类第一行写上 ...

  6. day 08 函数

    函数初始: 什么是函数? 函数:是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段 一个函数封装一个功能. 1,减少重复代码. 2,增加代码的可读性. 函数的结构 def my_len(): ...

  7. HTML5拖拽事件笔记

    在HTML5的规范中,我们可以通过为元素增加`draggable="true"`来设置此元素是否可以进行拖拽操作,其中图片.链接默认是开启的. 1. 拖拽元素:设置了`dragga ...

  8. Android的事件分发机制

    public boolean dispatchTouchEvent(MotionEvent event) 通过方法名我们不难猜测,它就是事件分发的重要方法.那么很明显,如果一个MotionEvent传 ...

  9. ScrollView嵌套LinearLayout布局不能撑满全屏的问题

    当ScrollView里的元素想填满ScrollView时,使用"fill_parent"或者"match_parent"是不管用的,必需为ScrollView ...

  10. 简述 OAuth 2.0 的运作流程(转)

    原文地址:http://www.barretlee.com/blog/2016/01/10/oauth2-introduce/ 本文将以用户使用 github 登录网站留言为例,简述 OAuth 2. ...