How do you compare matrices A and B?

2 vues (au cours des 30 derniers jours)
Jae Min Lee
Jae Min Lee le 28 Jan 2019
Commenté : Walter Roberson le 28 Jan 2019
I do not know what to do and ask questions.
The matrices A and B are as follows.
A = [21, 58;
47, 82;
56, 83;
64, 255;
0, 0 ];
B = [24, 61;
0, 0;
37, 83;
56, 82;
0, 0;
0, 0;
0, 0;
7, 178;
64, 255];
A is the object center coordinates of the previous video frame, and B is the object center coordinates of the current video frame.
I want to delete an object whose center coordinates have not moved more than 3 pixels.
So, we want to get only information about the coordinates where the difference between each coordinate of A and B matrix is ​​more than 3 pixels.
  2 commentaires
madhan ravi
madhan ravi le 28 Jan 2019
So give an explicit example of your desired output.
Jae Min Lee
Jae Min Lee le 28 Jan 2019
Example image has been updated.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 28 Jan 2019
eliminate the 0 0 entries . then pdist2 and min to find the distance to the closest centre .
Beware that your algorithm will get confused when objects pass close to each other . Tracking only distance is prone to failure . Better would be to track over multiple frames to estimate velocity so you can better predict which of two close centre belongs to which object. You would also be better if collision were taken into account .
  2 commentaires
Jae Min Lee
Jae Min Lee le 28 Jan 2019
Thank you for answer. But can you give me a little more detail? Why do you estimate speed?
Walter Roberson
Walter Roberson le 28 Jan 2019
Computer Vision Toolbox has example code for tracking multiple objects with velocity predictions .
As for why you are better estimating velocity: suppose you have one object at y 0 headed left and one at y 1 headed right. At some point the one that is leftmost becomes the rightmost as they pass each other going opposite ways. If you just look at closest relative to the old centers then the old left center might be closer to the new centre of what moved from right to left so you might accidentally think that the left object moved up and turned around to move back to the left instead of figuring that they passed each other.

Connectez-vous pour commenter.

Plus de réponses (1)

KSSV
KSSV le 28 Jan 2019
Read about knnsearch. Here you can speicfy the distance and pick the points nearest to the given set of points. This function might work for you.

Catégories

En savoir plus sur Tracking and Motion Estimation dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by