# 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.

edit retag close merge delete

1

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.

( 2019-02-19 19:48:04 -0500 )edit

@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.

( 2019-02-20 01:01:02 -0500 )edit

@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.

( 2019-02-20 12:21:49 -0500 )edit

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

( 2019-02-20 13:53:47 -0500 )edit

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

( 2019-02-21 02:26:58 -0500 )edit
• 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)

( 2019-02-21 02:32:24 -0500 )edit

@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??

( 2019-02-21 03:40:06 -0500 )edit

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.

( 2019-02-21 03:53:08 -0500 )edit

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.

( 2019-02-21 03:57:45 -0500 )edit