Find the maximum and minimum dimension of a closed loop

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
elgen
Messages
63
Reaction score
5
Dear all,

Is there a method to find the maximum and minimum dimension of an irregular closed loop? This is a problem when we want to define the full-width - half maximum of a image. The level contour of this image at its half maximum can be an irregular closed loop.

Any reference or comment is welcome. Thank you.

elgen
 
Physics news on Phys.org
Ah ... the maximum dimension is needed. Need to calculate the distance between every two points on the contour and the largest distance is the maximum dimension.
Here is the pseudo code, which x is Nx2 vector

Code:
    for i=1:nPoints
        for j=i+1:nPoints
            temp = norm(x(i,:)-x(j,:));
            if (temp > distance)
                distance = temp;
                idx = [i j];
            end
        end
    end

Result of some quick thinking. Perhaps there is a better way.

elgen