how to find 3 points in binary image?
1 view (last 30 days)
Show older comments
wongsathorn pinwihok
on 2 Feb 2020
Commented: wongsathorn pinwihok
on 12 Mar 2020
I want to find P1,P3 points and mark it with circle symbol.
0 Comments
Accepted Answer
Image Analyst
on 2 Feb 2020
I'd find the narrowest part first, then scan down line-by-line to get the first widest part. Not the widest part because there seems to be some noise near the bottom
% First smooth the mask
mask = conv2(double(mask), ones(7)/49, 'same') > 0.5;
[rows, columns] = size(mask)
leftBoundary = zeros(rows, 1);
rightBoundary = zeros(rows, 1);
for row = 1 : rows
thisRow = mask(row, :);
col = find(thisRow, 2, 'first')
if ~isempty(col)
leftBoundary = col(1);
rightBoundary = col(2);
end
end
Now see where the left boundary is greatest (most to the right), and the right boundary is least (most to the left) in the top 3/4 or the rows. This will find the narrow part of the leg above the ankle. See if you can do it. Then scan from there down until the boundary reverses direction. When it first reverses direction, that will be the first widest part, which is the ankle. Then you will have the two ankle points and the average of the x and y coordinates will be the mid point.
xMid = (xLeft + xRight) / 2;
yMid = (yLeft + yRight) / 2;
Please give it a try as I don't have time to do the complete project for you.
10 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!