How do you compare matrices A and B?

2 次查看(过去 30 天)
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.

采纳的回答

Walter Roberson
Walter Roberson 2019-1-28
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 个评论
Jae Min Lee
Jae Min Lee 2019-1-28
Thank you for answer. But can you give me a little more detail? Why do you estimate speed?
Walter Roberson
Walter Roberson 2019-1-28
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.

请先登录,再进行评论。

更多回答(1 个)

KSSV
KSSV 2019-1-28
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.

类别

Help CenterFile Exchange 中查找有关 Tracking and Motion Estimation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by