图像处理Skimage库的中label和regionprops函数解释
Scikit-image将图片作为numpy数组进行处理,在医学图像处理中会忽略图像的spacing信息。
导入:from skimage.measure import label,regionprops
1、Skimage中的label参数解释:
作用:实现连通区域标记
output=label(input, neighbors = None, background = None, return_num = False, connectivity = None)
input:是一个二值图像
connectivity:连通域设置,connectivity=1为四连通;connectivity=2为八连通;不设置,connectivity=input.ndim,output为与input连通域一样的标记图像
background:选择背景像素,指定像素作为背景,全部相同像素标记为0,不设置,默认背景像素值为0
return_num:bool值,若True,返回值是一个元组(labels ,num );False则只返回labels
output:与input形状一样,但是数值是从0开始的标记号(0,1,2,....),所以这是一个已经标记的图片
2、Skimage中的regionprops参数解释:
作用:测量标记图像区域的属性
属性包括:连通域的面积,外接矩形的面积,连通域的质心等等
总共访问的属性:
area : int
区域的像素数
bbox : tuple
Bounding box (min_row, min_col, max_row, max_col).
Pixels belonging to the bounding box are in the half-open interval
[min_row; max_row) and [min_col; max_col).
bbox_area : int
Number of pixels of bounding box.
centroid : array
质心坐标 tuple (row, col).
convex_area : int
凸包图像的像素数
convex_image : (H, J) ndarray
Binary convex hull image which has the same size as bounding box.
coords : (N, 2) ndarray
Coordinate list (row, col) of the region.
eccentricity : float
Eccentricity of the ellipse that has the same second-moments as the
region. The eccentricity is the ratio of the focal distance
(distance between focal points) over the major axis length.
The value is in the interval [0, 1).
When it is 0, the ellipse becomes a circle.
equivalent_diameter : float
The diameter of a circle with the same area as the region.
euler_number : int
Euler characteristic of region. Computed as number of objects (= 1)
subtracted by number of holes (8-connectivity).
extent : float
Ratio of pixels in the region to pixels in the total bounding box.
Computed as area / (rows * cols)
filled_area : int
Number of pixels of filled region.
filled_image : (H, J) ndarray
Binary region image with filled holes which has the same size as
bounding box.
image : (H, J) ndarray
Sliced binary region image which has the same size as bounding box.
inertia_tensor : (2, 2) ndarray
Inertia tensor of the region for the rotation around its mass.
inertia_tensor_eigvals : tuple
The two eigen values of the inertia tensor in decreasing order.
intensity_image : ndarray
Image inside region bounding box.
label : int
The label in the labeled input image.
local_centroid : array
Centroid coordinate tuple (row, col), relative to region bounding
box.
major_axis_length : float
The length of the major axis of the ellipse that has the same
normalized second central moments as the region.
max_intensity : float
Value with the greatest intensity in the region.
mean_intensity : float
Value with the mean intensity in the region.
min_intensity : float
Value with the least intensity in the region.
minor_axis_length : float
The length of the minor axis of the ellipse that has the same
normalized second central moments as the region.
moments : (3, 3) ndarray
Spatial moments up to 3rd order
output=regionprops(input, intensity_image=None, cache=True, coordinates=None)
注:这里的input即output=label(input, neighbors = None, background = None, return_num = False, connectivity = None)
input:标记好的输入图像
其他参数默认值就好,可不设置
3、根据regionprops得出的信息,处理满足条件的连通域:
label_image=label(splice_predict)
props=regionprops(label_image)
area=[]
centroid=[]
print("total region number",np.max(label_image))
for i in range(np.max(label_image)): #连通区域个数area.append(props[i].area)centroid.append(props[i].centroid)
index=[i+1 for i, element in enumerate(area) if element>100000]
for j in index:label_image[label_image==j]=0label_image=np.array(label_image,dtype='uint8')
图像处理Skimage库的中label和regionprops函数解释相关推荐
- python的skimage库 图像中值滤波;均值滤波;极大值滤波
使用 view_as_blocks (来源于skimage.util)函数.当我们想要对非重叠图像块执行局部操作时,块视图(view_as_blocks的返回值)非常有用. 我们将 图像 astron ...
- mysql 用户自定义函数库_MySQL中使用用户自定义的函数
函数定义基本公式如下 create function function_name(function_param param_type) returns return_type begin functi ...
- python标准库math中计算平方根的函数_16 Python 标准库之 math 模块 - Python 进阶应用教程...
1. 前言 math 模块中包含了各种浮点运算函数,包括: 函数 功能 floor 向下取整 ceil 向上取整 pow 指数运算 fabs 绝对值 sqrt 开平方 modf 拆分小数和整数 fsu ...
- 计算机视觉库OpenCV中shape和resize函数的区别
OpenCV官网说明:(shape为图片(高度,宽度,通道数)) Image properties include number of rows, columns and channels, type ...
- Python标准库shutil中rmtree()使用回调函数
这段代码目的是删除包含只读文件的文件夹,主要演示回调函数的用法. >>> import os >>> import stat >>> import ...
- JAVAWEB开发之JSTL标签库的使用、 自定义EL函数、自定义标签(带属性的、带标签体的)
JSTL JSTL简介: JSTL的全称:JSP Standard Tag Library,JSP标准标签库 JSTL的作用: 提供给Java Web开发人员一个标准通用的标签函数库 和EL ...
- python中label函数_图像分析函数:skimage.measure中的label、regionprops
算法解释详细,有算法执行过程动态GIF图的:https://blog.csdn.net/icvpr/article/details/10259577 算法文字解释的简介易懂的:https://www. ...
- 【数字图像处理】前期准备工作,库的安装(skimage库的安装!)
从3:30搞到5:30,我终于把skimage搞好了呜呜呜呜. 安装matplotlib.numpy等库,打开pycharm,点击setting-->python Interpreter,点击左 ...
- python基础教程:Python图像处理库PIL中图像格式转换的实现
这篇文章主要介绍了Python图像处理库PIL中图像格式转换的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧 在数字图像处理 ...
最新文章
- 官方iPhone SDK和开源工具链
- 从oracle9i/92数据库中导出数据至 oracle 8.1.7 数据库中
- signature=89b7a6bcfac55abae5ac369dafee29f4,Capecitabine
- 如何自学python到做项目-如何使用python进行第一个机器学习项目(详细教程篇)...
- 程序员需要知道的8个Linux命令
- 统计iOS项目的总代码行数的方法
- 2021新鲜出炉软件测试的真实面试题(一篇足以)
- 为什么数据可视化很重要
- python下读sougou中文语料文件
- 阿里云ecs 服务器配置 nginx https
- STM32F4 DMA2D_R2M
- java Guide 面试指南
- Python 显示实时时间方法
- MIDAS截面特性计算器说明
- vr转换软件android版,普通视频转换成VR
- 2022年10款好用免费数据恢复软件分享
- TensorFlow ERROR:Resource temporarily unavailable
- 春天里,阳光下,无限的哀思和想念
- ueditor编辑器二次开发与优化
- HTML5+CSS3前端入门教程---从0开始通过一个商城实例手把手教你学习PC端和移动端页面开发第3章初识CSS