# subtraction of point2f vectors

I get features from goodFeaturesToTrack. Then I use Lucas-Kanade optiacal flow to get new vector. To subtruct two vectors(current and previous) I use: Mat dist = Mat(features_next) - Mat(features_prev);. сout<<dist<<endl; send me something like this:

[-8.173645, 1.7280884;
-9.0476074, 1.3460178;
-8.053894, 1.6729126;
-8.3344727, 1.5041504;
-8.4681396, 1.2983398;
-7.7624168, 1.3024292;
-7.5558472, 1.5894165;
-6.0166016, -6.3443604;
-8.6588135, 1.4471436;
-8.5440674, 1.5252075;
-8.5332642, 1.2217712;
-9.019043, 1.1412964;
-8.1793213, 1.1274414;
-8.4523926, 1.3099365;
-8.0050659, 1.4452515;
-7.769989, 1.5503235;
-8.8361816, 1.4925537;
-8.8579407, 1.8752441;
-7.7745361, 1.0702209;
-7.8722687, 1.7235107]


What is this? Where are my coordinates? Is there another way to subtract them?

edit retag close merge delete

that's the difference Mat. what did you expect ?

( 2018-11-17 09:10:04 -0600 )edit

But why aren't they whole numbers?

( 2018-11-17 09:30:51 -0600 )edit

Point2f == float coords ;)

(it's all entirely correct !)

so, why did you expect integers, and why is it a problem ?

( 2018-11-17 09:40:22 -0600 )edit

I don't get it. How the coordinates work? Aren't they just numbers of pixels of the photo?

( 2018-11-17 09:53:01 -0600 )edit

think of it like this: 3.6 is between 3 and 4, but slightly closer to 4 ;)

it's called: "subpixel accuracy", btw.

( 2018-11-17 09:55:59 -0600 )edit

Interesting, thank you!

( 2018-11-17 10:07:31 -0600 )edit