Home Image-Pro Plus General Discussions

How to quickly measure distances between two objects

I have been trying to measure the distances between a single object and several objects around. Is this possible to do automatically? Or is the only solution to this problem to manually draw lines between two objects? 

Best Answer

  • Answer ✓
    bratliff,

    Automatic measurements of distance between objects is not available in Image-Pro Plus. You can measure distances either manually or creating a macro to calculate distance between object outlines. 

    The current version, Image-Pro Premier 9.2, provides such measurements, so you can measure distance between object outlines or between centers automatically (Relative measurements). There is also Voronoi diagram tool in Image-Pro Premier that calculates distance distribution between objects.

    Regards,

    Yuri

Answers

  • bratliff --

    If we call your single object A and your other objects B, C, D, and E, are you trying to find

        ** Distance AB
        ** Distance AC
        ** Distance AD
        ** Distance AE

    or is there something else that you are interested in getting?

    -- Matt
  • Matt,

    Yes, this is the general idea. Have you developed a way to do this? 


    Ben
  • Yuri,

    What would be the best way to go about creating this macro? 

    Ben
  • Ben,

    You can use IpBlbData to get coordinates of object centers (AutoPro help has an example on IpBlbData page) and then calculate distance between these points.
    Or use IpBlbGet(GETPOINTS,...) (sample on IpBlbGet page) to get outline points and do the calculations.

    Yuri

  • Yuri,

    Thank you!

    Ben
  • bratliff --

    If this is the first step in a multiple step macro, then you want all of the "smarts" to be within PREMIER and that would take a little bit of coding to make happen.

    If you are just working to get this data out of PREMIER, then some of the "smarts" can be outside of PREMIER. 

    I have taken a MEDIA CY IMAGE named RICE.TIF and done a AUTO BRIGHT THRESHOLD + NORMAL AREA FILTER and created RICE1.TIF and RICE2.TIF.  In RICE1.TIF, the only MEASUREMENT FEATURE is the LARGEST OBJECT in the image.  In RICE2.TIF, all objects found by the COUNT are maintained.

    I did a COPY and PASTE of the DATA TABLES from RICE1 and RICE2 to two sheets in EXCEL and then I created a third sheet in EXCEL that calculated the distance from the single item in RICE1 to all of the items in RICE2.

    I have attached:

    ** RICE.TIF, RICE1.TIF, and RICE2.TIF
    ** RICE1.XLS, RICE2.XLS, RICE1 to RICE2.XLS
    ** SCREEN CAPTURE (JPG FILE) showing this concept

    If you have a fair number of these to do, then:

    ** The communication between RICE1.TIF and RICE1.XLS can be automated.
    ** The communication between RICE2.TIF and RICE2.XLS can be automated.
    ** The communication between RICE1.XLS and RICE2.XLS is already automated with RICE1 to RICE2.XLS

    The "smarts" to do these operations and develop these measurements can be embedded within PREMIER and then the DISTANCES can be sent to a DISTANCES.XLS or used for further work within PREMIER.

    I hope this information is helpful.

    -- Matt






  • It looks like the FORUM did not accept and post my RICE1.TIF and RICE2.TIF images.

    The RICE.TIF that I used for this is normally found at

    "C:\Users\Public\Documents\Image-Pro Premier 9.1 64-bit (Shared)\Demo Images\Count and Size\Rice.tif"

    I hope this information is helpful.

    -- Matt

  • Matt,

    Thank you!!

    Ben
  • Ben --

    Glad to help.

    -- Matt
Sign In or Register to comment.