Home Image-Pro General Discussions

Hi, How can I measure the 'change of angles' of a moving object with respective to moving baseline

I am not able to measure the dynamic contact angle of moving object in a horizontal direction with respect to the moving baseline in the vertical direction.I will highly appreciate any help. If you need any more info please let me know.

Best Regards
Palak Jain

Best Answer

  • edited May 2020 Answer ✓
    Hi Palak Jain,

    If you have a moving baseline and all measurements should made be relatively to that baseline, I would recommend aligning all your images first, so the baseline always stays on the same place, then you could just place a horizontal line profile at the given offset from the baseline and measure positions of left and right edges of the contour on all frames (automatically).

    Image-Pro provides several ways to align images:

    1. Using Align tool (including manual) - Process tab, Combine ribbon group.  
    2. Align by Feature (draw ROI around the baseline and the sequence will be aligned).
    3. Align by Track: create a track that follows the baseline and click Align By Track (Measure tab, Tracking - Object). 

    Let me know if you need more details.




  • Palak Jain,

    Do you identify contact angle and baseline automatically, or you draw them manually, and then measure angles?
    Maybe you can post some sample image(s), it may help finding a solution?


  • Hello Yuri,
    First of all, thank you for your response. Secondly, I tried to first get the contour by playing with the intensity, then I am drawing the baseline manually. But as I have so many frames, it's time-consuming and involves a lot of human error to give the baseline manually for every frame. As it is able to detect the baseline for one frame, but for the next frames, it couldn't because of the movement of the baseline in both vertical and horizontal directions as can be seen in the schematic figure given below. My AB distance and h height are kept on changing with frames. The output is to find the contact angles shown in image 1 for all the frames.
  • Hi, Yuri
    Thank you for helping me out. My apologies for contacting you late. I aligned my images for the baseline to stay in one place. But I wasn't able to exactly achieve the placing of horizontal line profile to measure positions. Kindly, help me in providing more details regarding this. 

    Thank you for all help

  • Hi Palak Jain,

    You should place 1 (or 2) line profiles on fixed distance from the base line. (if the contact point of the contour with the baseline is the same, then you can use 1 line, if not - use 2 lines). The purpose of line profiles is to detect edges of the contour. On my screenshot below I used "Valleys" edge detectors.

    You can calculate the angle from the positions of edges on 2 line profiles (Origin - Valley measure) and the vertical distance between profiles using this formula:

                                            Alpha = ArcTan(dY/dX)

    When all your images in a sequence are aligned by baseline, you can change active frame and X positions of edge detectors will be updated on new frame (can also be sent to data collector), so going through all frames you will get X positions on all time points, which give you angles on all time points.

  • Hello Yuri,
    Thank you so much for providing the process in detail. I am splitting my 3 min video into 4-5 parts to align properly because there are a lot of fluctuations for one complete video. It worked fine after that and able to use the valley operation for edge detections. However, I am not able to get valley values in mm(length) after the calibration as shown in the data table. It is still showing pixel intensity value I believe.
    One more thing as you can see in my below figure, the red line has so many valley points but I am only interested in the last one.
     I guess the table is showing the average(pixel/intensity) of all the valley points on it. Is it like something I am missing out on? Please let me know what's exactly I am doing wrong. Thank you for all the help.  :)

    Palak Jain
  • edited June 2020
    Hi Palak Jain,

    You posted the image of the real sample and now I can see that you should use "Falling" edge detector to find positions of the surface contour. Place 2 line profiles horizontally, starting from the same X coordinate with some offset (dY) in vertical direction:

    You should have only 1 "Falling" edge per profile and you will collect that position to Data Collector. 
    Data Collector can collect multiple line profile properties, but you are interested in Line Profile - Edge Measurements - Falling (be sure you add it to the selected measurements):

    Data Collector can also calculate simple derived measurements from the provided data, so I've attached the Data Collector measurements file (AnglesFromProfiles.adoxsd) that calculates "Delta X" and "Delta Y" from 2 profiles.

    Data Collector doesn't have ArcTan function, so after collecting the data from all frames in the sequence you can export this table to Excel and calculate angles there using the formula:  Alpha = ArcTan(dY/dX) .

    I've also attached the Excel file with the formula.



  • Thank you Yuri for all the help. I am able to measure both the left and right contact angles along with base diameter. 
  • Hello Yuri,
    How are you? I have one doubt regarding the same topic with different findings. I wanted to measure the diameter of these circles mentioned in the image. The issue is the profile(base diameter of top and bottom surface) is changing with the time in the video, so do these circles and their diameters. I have measured for one instance but I am not able to find the way to run it for all the frames. How can I measure them for the whole video after aligning my base diameter with the feature? I'd really appreciate it if you could help in this regard. Please let me know if you need any extra information.

  • Hi Palak Jan,

    Measuring circle diameters is similar to measuring angles, only instead of 2, you will need 3 points, from which you can build a best-fit circle. So, you use 3 line profiles and get edge coordinates (p1,p2,p3), which then passed to best-fit circle command, like this:
            With Measure.MeasurementsCommands.Add(Nothing)
                .MeasurementType = McMeasurements.enumMMSTypes.mmtsBestFitCircle
                .Points = New System.Collections.Generic.List(Of System.Drawing.PointF)
                .Points.Add(New System.Drawing.PointF(p1.x,p1.y))
                .Points.Add(New System.Drawing.PointF(p2.x,p2.y))
    .Points.Add(New System.Drawing.PointF(p3.x,p3.y))
    .FeatureName = "BFC1" .SnapFeature = False .Run(image1, meas1) End With
Sign In or Register to comment.