mask2roi

Works like the function "createMask," but in the opposite direction. Takes a mask and produces points that can be used to draw a polygon.
5 Descargas
Actualizado 10 ago 2023

Ver licencia

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

Citar como

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

Compatibilidad con la versión de MATLAB
Se creó con R2023a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión
1.0.0