Home Image-Pro General Discussions

How to track the shape profile of a changing object ?

Hi
I wanted to track the shape of a changing sphere (2D) that is getting distorted over time. As for example, in the following figure, the small sphere is enlarging and at time t=4, it takes the shape of the outer most circle.So I want to get this shape profile at different time frames. Could you please help me in doing this.
Thanks in advance.

Best Answers

  • 2017-12-08-095710

    Rizwan --

    The TECH SUPPORT FOLKS at MEDIA CY and I have tweaked a routine that does what I believe you are looking for.

    The BOUNDARY POINTS ROUTINE below was run on the

        Rizwan A_Mask_Crop.tif

    That image is attached to this comment and generated the results shown in the SCREEN CAPTURE.

    The DLLs needed to support the ROUTINE are shown after the SCREEN CAPTURE.

    BY THE WAY . . .

    I rotated your EXAMPLE IMAGE 90 DEC CW so that T = 1 is the first object to be found by a THRESHOLD / COUNT, T = 2 is the second, and so on.  If not, the objects are found in the order of their highest point which I think would be 1, 5, 3, 2, 4.

    I hope this information is helpful.

    -- Matt

    *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

        Public Sub BoundaryPoints()
    
            'Show the OUTPUT WINDOW
            ThisApplication.Output.show
    
            'Clear the OUTPUT WINDOW
            ThisApplication.Output.Clear
    
            '*** Find the calibration units and resolution
    
            'Declare VARIABLES
            Dim MyTempCalibUnits As String
            Dim MyTempCalibPixelSize As Single
    
            'If IMAGE is CALIBRATED
            If (ThisApplication.ActiveImage.SpatialCalibration IsNot Nothing) _
                Then
    
                    'Learn CALIBRATION INFORMATION
                    MyTempCalibUnits = _
                        ThisApplication.ActiveImage.SpatialCalibration.UnitAbbrev
                    MyTempCalibPixelSize = _
                        ThisApplication.ActiveImage.SpatialCalibration.PixelSizeX
                Else
    
                    'Simulate CALIBRATION INFORMATION
                    MyTempCalibUnits = _
                        "pix"
                    MyTempCalibPixelSize = _
                        1
    
                End If
    
            'Connect with the ACTIVE IMAGE
            Dim im As McImage = _
                ThisApplication.ActiveImage
    
            'Connect with the MEASUREMENT DATA in the ACTIVE IMAGE
            Dim md As McMMData = _
                im.MeasurementsData
    
            'Create an ARRAY to hold the BOUNDARY POINTS
            Dim points() As SINGLEPOINT=Nothing
    
            'Loop through the FEATURES in the ACTIVE IMAGE
            For Each sf As McMMSubFeature In md.SubFeatures
    
                    'Learn and output the NAME for the FEATURE
                    Dim s As String = _
                        sf.Name
    
                    'Send FEATURE NAME to the OUTPUT WINDOW
                    ThisApplication.Output.PrintMessage s
    
                    'Output the COLUMN HEADERS
                    s = _
                        "X" & vbTab & _
                        "Y"
    
                    'Send COLUMN HEADERS to the OUTPUT WINDOW
                    ThisApplication.Output.PrintMessage s
    
                    'Fill the ARRAY with the BOUNDARY POINTS
                    sf.GetFeatures.GetFeaturePoints(sf.FeatureIndex,points)
    
                    'Loop through the BOUNDARY POINTS
                    For Each p As SINGLEPOINT In points
    
                            'Output the CURRENT BOUDARY POINT
                            s = _
                                Format _
                                    ( _
                                    p.x * _
                                    MyTempCalibPixelSize, _
                                    "0.00" _
                                    ) & _
                                vbTab & _
                                Format _
                                    ( _
                                    p.y * _
                                    MyTempCalibPixelSize, _
                                    "0.00" _
                                    )
    
                            'Send BOUNDARY POINTS to the OUTPUT WINDOW
                            ThisApplication.Output.PrintMessage s
    
                        Next
    
                Next
    
        End Sub
    





  • edited December 2017 Answer ✓
    2017-12-08-144127

    Rizwan --

    I am glad that you found the BOUNDARY POINTS ROUTINE appropriate to your task.

    There are some resources within the PREMIER UNIVERSE to help you learn about PREMIER MACROS.

    A great place to start is

        Image-Pro Premier User Guide.pdf

    in the DOCUMENTATION FOLDER for your PREMIER.

    The WORKING WITH MACROS section starts of PAGE 9-25.

    If you need assistance, ALCES and I provide our services on a consulting basis.

    I hope this information is helpful.

    -- Matt

    Matthew M. Batchelor
    President and Applications Engineer
    Alces Imaging and Automation, LLC

Answers

  • Hi Rizwan,

    I assume that all the frames of this time sequence are merged into a sequence (if not, you can create a sequence of all frames using Open as Sequence).
    You can use the following steps to track the edge of your bubble:

    1. Open line profile window and draw line profile as shown on your picture.
    2. Add Edge detector that detects the edge of the bubble (can be Falling edge, or Valley, depending on your image). Adjust Edge detector parameters to detect only 1 edge on any frame.
    3. Click the Collect button on the line profile tab, "All Frames" must be on:

    4. Then open Data Collector table or Graph and examine your data (distance from the origin to the edge:



    Yuri
  • 2017-12-07-111128

    Rizwan --

    In interpreted your question a bit differently than Yuri did.

    I found an image on the INTERNET of a bouncing ball that deforms during its motion.

    That image is below.



     
    I then:

    ** Stripped out the frames of that image
    ** Stacked them vertically
    ** Smart thresholded them
    ** Masked them
    ** Bright thresholded them
    ** Measured them

    The results are below.

    I hope this information is helpful and that it gives you some ideas.

    -- Matt

    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-


  • Hi
    YuriG and Matt thanks.
    My problem is as  follows: 
    I have a video of 5 frames where the sphere changes its shape. And I want to get the profile data to be extracted. In other words, I want the coordinate of the ppoints on the circumference of the circles.
    Your answers enlightened me, but a further specifics for this problem would assist me more. I really appreciate your assitance. Thanks
  • Rizwan,

    Why don't you just measure shape parameters on every frame, such as Aspect ratio, Centroid, Area,...?

    Yuri

  • Hi
    Matt, Thanks for your wonderful effort. This is what exactly I was looking for. However, i am quite new with macro. Is there any availabloe resources that explain how to load and run macros and about the .dll? Thank you very much for your support.

    Hi Yurig
    I wanted the exact profiles, not the shape parameters. Thanks though. 

  • Thanks Matt
    That's wonderful. I really appreciate your effort. Thanks and regards.
  • 2017-12-08-171625

    Rizwan --

    I am glad that we could help you use your PREMIER SOFTWARE to tackle your imaging challenge.

    Holler when we can assist further.

    -- Matt


Sign In or Register to comment.