LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

compare motion paths on graph

hi ..
 i'm trying to do motion analysis by plotting the motion path onto an XY graph .....

for similar motion, the shape of the path would be similar but the number of points to plot the graph will not always be the same ..  the position of the curve in the graph will also not be the same.( i think in this case i have to normalise the data) but how do i normalize them ?

my question is.. how do i get the difference between the 2 graphs?? is there any function to analyse the difference between 2 graphs? my idea is to do spline interpolation and get the discrepancy between every point...

could anyone guide me on the steps to compare the curves from the data and how to analyse the graph ??


for example

i've got 3 continuous motion ..

so i have 3 sets of data and therefore 3 plots. each set of data consist of an array of centroids

the number of centroids obtained will be random.. but the shape of the path from this data will be similar.. so the only thing i can do is compare the shape ..

i want to compare each of them with a database which has similar shape.

thanks very much


Message Edited by kupikupi on 09-08-2006 12:35 PM

0 Kudos
Message 1 of 7
(3,503 Views)
hi ... could anyone help me please ... thanks br>
0 Kudos
Message 2 of 7
(3,491 Views)
kupikupi,

If I understand you correctly, then you will have a set of (x,y) coordinates as a template for your motion shape. You will then acquire another set of (x,y) coordinates that may have a different number of x points and various amount of offset. You want to find a way to compare the two shapes?

If this is correct, then there is no LabVIEW VI that will easily compare two XY Graphs; you will need to normalize the data and compare the arrays. What I would suggest is to use the first data point as your basis (0,0). You can then compare subsequent points to the template value to determine if the point is close enough. I would also suggest that you look at the Mask and Limit express VI. You can use this to define a data range into which your points can fall. If all of the points are within a predetermined threshold, then the shape “passes.”

Please take a look at these suggestions and let me know if they will not solve your application requirements. Thanks a lot, and good luck with your application.

Mike
0 Kudos
Message 3 of 7
(3,455 Views)
hi ...

mike ,

i think u understood me correctly .. i've tried building a program .. with the help of altenbach ..
but i have a problem ...

the outcome form the program is not wat i expected .. for the same motion .. the graph is different ..

i think my idea works fine without spline .. but then  i can't compare every point in the graph... that's whyi need the spline ...

i actually dont really get how this spline works.. as far as i know .. from the few points that i get .. the spline will help me connect them together..

my simple idea was

i get the motion path using the centroids... i plot the centroids on an XY graph ...( i'm wondering whether  i can change the axis of the graph to match the image frames where the origin of the coordinates starts from the top left corner with negative values..


so similar motions will have similar shape .. i then normalize the data so that i can compare them with my database of motions..

to compare the shape .. i can compare every point in the path .. but the problem is each points might be at a different position .. and the number of points that forms the path will not be the same.. that's why spline comes in .. but this is where i get confused..

i've attached my program here.. i hope u can help me check ... i really need help .. i've been stuck at this stage for few days.. i can't get other ideas...




0 Kudos
Message 4 of 7
(3,430 Views)
I was taking a look at your code, but I had not considered that you were using IMAQ VIs. I am not as familiar with the IMAQ functions, but I know that there are several examples that deal with pattern recognition. Would it be possible to convert your XY plot to an image? You could then use these IMAQ features to compare the images to detect a match.

Aside from this suggestion, it is difficult for me to see where your code might not function as you expect without those IMAQ tools. I can help with specific questions, but it is difficult for me to debug this type of application. I also did not understand what you meant when you said you wanted to “change the axis of the graph to match the image frames where the origin of the coordinates starts from the top left corner with negative values.” Could you explain what you mean by this? I may have some suggestions on how this can be done, and this may be the key to solving your application. Thank you very much for you time,

Mike
0 Kudos
Message 5 of 7
(3,407 Views)
hi .... thanks very much for the reply

i've edited my program so that u dont need imaq to run it ....

have 3 sets of data to test , the 1st set of x and y are already connected...

the other 2 sets is supposed to have a similar shape when i plot them directly on an XY graph ... but when i go thru the spline . the shape of the graph of the 3 sets of data somehow becomes so different..

my aim here is to match the shape to the graphs.. if the shape is similar .. then it's a match ...

i dont know how to convert the graphs to images ..  ..

about changing the axis...

the XY graphs has axis with the origin (0, 0 ) at the bottom left corner of the graph ..like normal graphs do ... but in image .. the coordinates of origin (0, 0) starts at the top left corner of the graph .. .

im just wondering if i could change it so that i can get the exact path  of the motion .. . but that's not realy important .. i just want to match the shape of the graph ...

thanks ...
0 Kudos
Message 6 of 7
(3,396 Views)
Thank you very much for removing the IMAQ functions from the VI. I was able to run the code on the 3 different sets of data. You mentioned that each of these 3 sets of data are for similar motion, but the graphs do not appear to be similar at all. I don’t believe the spline analysis is performing the functionality that you want. Again, it is difficult for me to debug the way those shapes are supposed to be normalized to look similar.

Even if you were to get those graphs to be of similar shape, I still do not have a method for comparing graph shapes. I would attack the problem by normalizing each set of data and comparing the arrays. You have a set of known patterns and you will then acquire new patterns. You must first ensure that the array lengths are the same for the new data and the known patterns. You must then ensure that the data points are on roughly the same scale (magnitude) by dividing the acquired data by some scale factor. At this point, you can do point-by-point analysis on the resulting array. It should be noted that this will not actually use the graphs to compare the shapes. If you are set on using this methodology, then you may want to consider creating an image and using IMAQ tools to compare images.

You can easily create an image from a plot by right-clicking on the plot and selecting Create >> Invoke Node >> Export Image. From here you may be able to use some of the image comparison tools provided by the IMAQ module. It may also be useful if you post your question to the Machine Vision forum. This may be a common application that can be solved with IMAQ tools. I hope this is useful for you!
0 Kudos
Message 7 of 7
(3,373 Views)