how to assign the same labels to the segment between two consecutive markers?
1 回表示 (過去 30 日間)
古いコメントを表示
The aim of this is to assign the same label(bwlabel)to each segment(connected or not) located between two different markers in the image below :
can any one help me please!
help is much appreciated
thank you
0 件のコメント
回答 (2 件)
Walter Roberson
2014 年 1 月 27 日
It sounds like you want to divide the area up into rectangular ROIs (region of interest), and assign the same number to all non-zero points in the ROI. If you want to do it fully automatically you are going to need to give rules about which pair of markers to select, as most of the obvious possibilities in the above figure would result in overlapping ROIs.
Once you have determined the bottom left and top right coordinates of an ROI rectangle, you can use
LabelMatrix = uint8(BWMatrix); %supposing the BWMatrix is logical resulting from thresholding or the like
LabelMatrix(bottomrow:toprow, leftcolumn:rightcolumn) = LabelMatrix(bottomrow:toprow, leftcolumn:rightcolumn) * CurrentLabel;
0 件のコメント
Image Analyst
2014 年 1 月 27 日
I think we talked about this before. You just erase the binary image at the location of your markers, then you call bwlabel(). This will do it.
% Marker rows are in the "rows" array.
% Marker columns are in the "columns" array.
for k = 1 : length(rows)
row = rows(k); % "y" value.
column = columns(k); % "x" value.
binaryImage(row, column) = false;
end
[labeledImage, numberOfSegments] = bwlabel(binaryImage);
2 件のコメント
Image Analyst
2014 年 1 月 29 日
They look connected by a solid blue line to me, except for a few small blobs where there's only one marker on it. Magnify and point out a blue structure where there is no connection between the markers on it. If there is no connection, then they are different blobs.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!