mask2roi

版本 1.0.0 (2.9 KB) 作者: Alexander Moody
Works like the function "createMask," but in the opposite direction. Takes a mask and produces points that can be used to draw a polygon.
4.0 次下载
更新时间 2023/8/10

查看许可证

mask2roi converts binary images/masks into roi positions. Only one input
is required for default algorithm, the mask. This mask can have any
number of regions which will be contained in separate cells of the
output. Additional outputs are perimeters (masks of edges) for each
region. The points are lined up to be used in drawpolygon as shown below:
EXAMPLE:
roiPositions = mask2roi(mask)
for i = 1:length(roiPositions)
drawpolygon("Position", roiPositions{i}, "Parent", imageAxes)
end
INPUTS:
mask - logical - binary image
NumROIs - numeric/int - specify the number of ROIs you want returned
Connectivity - numeric - must be 4 or 8
FillHoles - logical - in case you don't want holes filled in mask
ScaleNumVertices - numeric/int - higher numbers remove more points
RoundOutput - logical - rounds vertex coordinates
OUTPUTS:
roiPositions - cell of double arrays - arrays are n-by-2 where n is the
number of regions in the mask, x and y correspond to col 1 and 2
perimeters - optional - cell of 2D double arrays - Each with an edge mask
of the individual regions

引用格式

Alexander Moody (2024). mask2roi (https://www.mathworks.com/matlabcentral/fileexchange/133577-mask2roi), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2023a
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0