# Classify a trajectory using SVM from freeman chain codes

Hi,

Lets assume, I have set of testing trajectories (set of 2D Points) data. Now,I have generated freeman chain codes for each of these trajectory.

Now,I have a testing trajectory data,I would like to classify it using KNN and SVM. I would be glad,if someone can explain me the logic to use KNN and SVM. I really cannot understand, what can I infer from freeman chain code. All I have is codes like "02244442255333556211124".

I just want to understand the concept to apply KNN as well as SVM in this context. I am familiar with both KNN as well as SVM, but really not sure,how I can apply it here.

Thanks in advance.

Do all of the trajectories have the same number of points? Why are you using a code, when the data are already there? Just curious.

@sjhalayka: No, They do not have same number of points. Also, each of the trajectory can vary in translation,rotation and scaling. I am just trying out different approaches. So, was just curious as to how I can use KNN/SVM After generating freeman chain code.

@sjhalayka: I would be glad,if you can let me know,as to how,one can apply SVM classifier with the known freeman chain codes.

I'm too much of a noob when it comes to using the AI portions of OpenCV. Sorry man.

^^ that's not AI, just statistics ..

you NEED fixed size feature vectors for any kind of machine learning (maybe you need to resample your trajectories to say, 100 points

i'm having some doubts, if freeman chains (on their own) work nicely in a metric space, e.g. code 1 and code 7 have a metric (L1)distance of 6, but only 1 45° segment between them (same as code 1 and 2)

@berak: Ok lets say,I have resample my trajectory to 100 sample points. Then what would be your approach for classifying it using SVM. For applying SVM,you atleast need two features right (I meant,inorder to plot a particular trajectory with a given X-axis value and Y-axis value).So,in this case,for each trajectory,what do we have on X-Axis and Y-Axis??

what do you mean: "For applying SVM,you atleast need two features" (does not make much sense to me)

100 points with x and y coords result in 200 numbers.

Please explain a short algorithm,as to how you can apply SVM after resampling trajectory.Lets say,you after you have resampled the trajectory,you have generated freeman chain code for that particular trajectory.