mask2poly(mask)
P = MASK2POLY(BW) reverses the POLY2MASK function in Image Processing Toolbox. It takes a binary image BW and returns an array of struct, P. Each element of P defines either a polygon or a hole within a polygon.
This function requires another FEX function: contourcs (http://www.mathworks.com/matlabcentral/fileexchange/28447)
Example:
mask = imread('circuit.tif')>100;
P = mask2poly(mask);
figure;
imagesc(mask);
axis on; box off; grid on;
hold on;
for n = 1:numel(P)
if P(n).IsFilled
color = 'w';
else
color = 'y';
end
plot(P(n).X,P(n).Y,color);
end
hold off;
Citar como
Kesh Ikuma (2024). mask2poly(mask) (https://www.mathworks.com/matlabcentral/fileexchange/45980-mask2poly-mask), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
- Image Processing and Computer Vision > Image Processing Toolbox > Image Segmentation and Analysis > Region and Image Properties >
- Image Processing and Computer Vision > Image Processing Toolbox > Image Filtering and Enhancement > ROI-Based Processing >
- Simulink > Block and Blockset Authoring > Author Block Masks >
Etiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.4.0.0 | * Rewritten the code handling the mask edges that terminate at the mask boundary. A bug in previous version resulted in an infinite loop.
|
||
1.3.0.0 | Bug fixes:
|
||
1.2.2.0 | bug fix |
||
1.2.0.0 | fixed missing IsFilled field if mask contains no ROI |
||
1.1.0.0 | Added example to the description |
||
1.0.0.0 |