matlab imfill,Python相当于Matlab的灰度函数imfill?
Matlab infl()依次使用函数IM=imreconstruct(marker,mask)
有关算法的详细信息,请参见
Soille,P.,《形态图像分析:原理和应用》,Springer Verlag,1999年,第208-209页。第6.3.7节“填充孔”部分import numpy as np
from skimage.morphology import reconstruction
import matplotlib.pyplot as plt
from skimage.io import imread, imsave
# Use the matlab reference Soille, P., Morphological Image Analysis: Principles and Applications, Springer-Verlag, 1999, pp. 208-209.
# 6.3.7 Fillhole
# The holes of a binary image correspond to the set of its regional minima which
# are not connected to the image border. This definition holds for grey scale
# images. Hence, filling the holes of a grey scale image comes down to remove
# all minima which are not connected to the image border, or, equivalently,
# impose the set of minima which are connected to the image border. The
# marker image 1m used in the morphological reconstruction by erosion is set
# to the maximum image value except along its border where the values of the
# original image are kept:
img = imread("tyre.jpg")
seed = np.ones_like(img)*255
img[ : ,0] = 0
img[ : ,-1] = 0
img[ 0 ,:] = 0
img[ -1 ,:] = 0
seed[ : ,0] = 0
seed[ : ,-1] = 0
seed[ 0 ,:] = 0
seed[ -1 ,:] = 0
fill = reconstruction(seed, img, method='erosion')
f, (ax0, ax1) = plt.subplots(1, 2,
subplot_kw={'xticks': [], 'yticks': []},
figsize=(12, 8))
ax0.imshow(img)
ax1.imshow(fill)
plt.show()
matlab imfill,Python相当于Matlab的灰度函数imfill?相关推荐
- [Python+MATLAB] 在Python中使用MATLAB (持续更新中)
文章目录 在Python中安装MATLAB引擎 官方介绍 个人介绍 结果演示 常见用法 一些tips: 使用Python能使用MATLAB的函数吗? 答案是可以的! The MATLAB Engine ...
- matlab与python区别_python和matlab的区别
详细内容 Python是一种面向对象的解释型计算机程序设计语言.Python是纯粹的自由软件, 源代码和解释器CPython遵循 GPL(GNU General Public License)协议 . ...
- (MATLAB/C/Python)快速中值滤波
(MATLAB/C/Python)快速中值滤波 一.中值滤波 二.快速中值滤波 介绍 原理 优化 三.代码 MATLAB C Python 四.测试 其他 by HPC_ZY 最近一个项目中需要用到中 ...
- Python如何调用matlab函数?
仅需一步就能搭建好两者的通道! 在matlab的命令行下键入: cd (fullfile(matlabroot,'extern','engines','python')) system('python ...
- matlab中的expotest,提高Fortran矩阵指数性能(Expokit比Matlab、Python慢)
我正在进行一个模拟,其中的瓶颈是执行大量复杂的双精度矩阵指数运算,我发现Fortran(Expokit)对于小矩阵很好,但对于较大的矩阵,它的性能比Matlab或Python差.在 我在下面包含了一个 ...
- matlab与python通信_python和matlab之间数据传输方法
转自链接:https://www.jianshu.com/p/8da7398fa889 1..mat文件 matlab和python间的数据传输一般是基于matlab的文件格式.mat,python中 ...
- matlab与python 语言区别总结(1)_matlab与python 语言区别总结(1)
现在学术界越来越多人使用Python 语言取代Matlab 作为研究的主要程序编写工具.python语言看似有点类似matlab语言,对于习惯Matlab 的使用者来说,转换到Python语言应该并不 ...
- 在Python中读取MATLAB的数据文件
简 介: 本文测试了几种通过python直接读取MATLAB的**.MAT格式的数据文件,有些方法经过测试发现无法完成.而通过mat4py可以比较方便的读取MATLAB中的数据文件.利用手边已有的用于 ...
- MFCC特征参数提取(一)(基于MATLAB和Python实现)
1.MFCC概述 在语音识别(Speech Recognition)和话者识别(Speaker Recognition)方面,最常用到的语音特征就是梅尔倒谱系数(Mel-scale Frequency ...
最新文章
- leetcode897
- java实现生产者消费者问题(转)
- python求出五位数的回文数_python之递归
- mysql空间是什么格式_MySQL数据类型 - 空间数据类型 (6)
- [转]最牛MSN签名
- Illustrator 教程,如何在 Illustrator 中使用钢笔工具创建作品?
- win10的js文件-bat脚本-开启移动热点
- 新兴IT企业特斯拉(五)——中国救命
- 手机CAD如何快速看图下载?
- 计算机系统盘怎么扩充,c盘扩大,教您怎么把c盘扩大
- SG Input 软件安全分析之逆向分析
- Win10将用户名修改为英文
- 最近在搞TAM TIM
- 柳传志:联想敢于涉足投资的三个原因
- Hadoop技术优缺点详解
- 【大数据】快速了解大数据计算服务
- 浅析MySQL恶意服务器读取文件原理
- https://developer.aliyun.com/group/cloud?aly_as=stGCd_wh?_k=g6zacxsource=5176.11533457userCode=9fo
- 海思CEA-861时序配置
- 基于单片机的车内滞留儿童预警系统设计