필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
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