Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Find the maximum and minimum dimension of a closed loop

  1. Aug 4, 2010 #1
    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.

  2. jcsd
  3. Aug 4, 2010 #2
    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 (Text):

        for i=1:nPoints
            for j=i+1:nPoints
                temp = norm(x(i,:)-x(j,:));
                if (temp > distance)
                    distance = temp;
                    idx = [i j];
    Result of some quick thinking. Perhaps there is a better way.

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook