How to get region information
3 次查看(过去 30 天)
显示 更早的评论
I am thinking to find the length but not sure how to do that.
An example image is shown below:
From Original image I have tried to get some results but I am stuck.
I am looking to find the red marked thread height from the following figure. Any help will be appreciated.
0 个评论
回答(1 个)
Image Analyst
2017-10-8
Run along the columns finding the hairs and subtracting from the skeleton
% Preallocate arrays for heights above and below the core skeleton.
hairHeightsAbove = zeros(1, columns);
hairHeightsBelow = zeros(1, columns);
% Loop over all columns, finding distances above and below for each column.
for col = 1 : columns
% Find row of hair sticking above the core skeleton.
hairTopRow = find(hairs(:, col), 1, 'first');
% Find row of hair sticking below the core skeleton.
hairBottomRow = find(hairs(:, col), 1, 'last');
% Find row of the core skeleton.
skeletonRow = find(coreSkeleton(:, col), 1, 'first');
% Compute distances of hair ends to the core skeleton.
hairHeightsAbove(col) = abs(hairTopRow - skeletonRow);
hairHeightsBelow(col) = abs(hairBottomRow - skeletonRow);
end
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!