How can I track the interface of image?
7 views (last 30 days)
Show older comments
Parham Babakhani Dehkordi
on 23 May 2016
Commented: Parham Babakhani Dehkordi
on 24 May 2016
Hi everyone. I have 75 binary frames. each frame has a size of Height=301 and width=1483. I attached you the first frame for your record. What I want is that I want to know the average height from the bottom of image to the interface where white pixel exist.let's say that I pick up 5 arbitrary points, as shown in the attached file and take an average of the height from these five points. This procedure must be repeated for all 75 frames. The idea is that we should track all white pixel in the domain from bottom to top of column. If there is white point then we store it, so that we can identify the interface of each image. any help would be appreciated.
0 Comments
Accepted Answer
Image Analyst
on 23 May 2016
It depends. Do you want to go to the bottom of the little particles? Or just the big one. If you're interested in just the big one, use bwareafilt(binaryImage, 1) to extract just the biggest blob. If you want to get a smooth envelope that sort of goes between the large and small blobs, use activecontour (demo attached). If you want to just go to the bottom of any blob, then just process columns one at a time
[rows, columns] = size(binaryImage);
bottomRows = zeros(1, columns);
for col = 1 : columns
thisColumn = binaryImage(:, col);
botCol = find(thisColumn, 1, 'last');
if ~isempty(botCol)
% There is at least one white pixel in this column.
bottomRows(col) = botCol;
end
end
% Now find mean
theSum = sum(bottomRows);
numCols = sum(bottomRows ~= 0);
meanBottomRow = theSum / numCols;
5 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!