Effacer les filtres
Effacer les filtres

how to assign a different label the each regions localised between two markers

2 vues (au cours des 30 derniers jours)
After detecting(marking with markers)classes based on labels below : X=[1 0 1 ; 0 1 0 ; 1 0 1 ;];
Y=[1 0 1 ; 0 1 0 ; 1 0 0 ;];
O=[0 1 0 ; 1 0 1 ; 0 1 0 ;];
-=[0 0 0 ; 1 1 1 ; 0 0 0 ;];
L=[1 0 0 ; 1 0 0 ; 1 1 1 ;];
in order to separate regions using the code below :
t = imread('I.png'); A = squelette(t); B = 2*A - 1 ;
patterns = {[1 0 1; 0 1 0; 1 0 1]; ... % X
[1 0 1; 0 1 0; 1 0 0]; ... % Y
[0 1 0; 1 0 1; 0 1 0]; ... % O
[0 0 0; 1 1 1; 0 0 0]; ... % -
[1 0 0; 1 0 0; 1 1 1] ;} ; % L
labels = {'X', 'Y', 'O', '-', 'L'} ;
matches = cell( size(labels )) ;
for pId = 1 : numel( patterns )
nel = numel( patterns{pId} ) ;
ker = 2*patterns{pId} - 1 ;
[r, c] = find( conv2(B, rot90(rot90(ker)), 'full') == nel ) ;
matches{pId} = [r, c] ;
figure(pId) ; clf ; hold on ;
spy(A) ;
plot( c, r, 'r+', 'MarkerSize', 2 ) ;
title( sprintf( 'Matches for "%s" pattern', labels{pId} )) ;
end
With the function "squelette" Skeletonization using voronoi by Yohai in the link below http://www.mathworks.com/matlabcentral/fileexchange/27543-skeletonization-using-voronoi result in picture:
how to assign a different label the each regions localised between two markers ??
Any idea?
help is much appreciated

Réponse acceptée

Image Analyst
Image Analyst le 3 Jan 2014
Remove the pixels at the marker locations from your binary image, then call bwlabel or bwconncomp.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by