フィルターのクリア

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

2 ビュー (過去 30 日間)
mika
mika 2014 年 1 月 3 日
回答済み: Image Analyst 2014 年 1 月 3 日
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

採用された回答

Image Analyst
Image Analyst 2014 年 1 月 3 日
Remove the pixels at the marker locations from your binary image, then call bwlabel or bwconncomp.

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by