How do you compare matrices A and B?

조회 수: 2 (최근 30일)
Jae Min Lee
Jae Min Lee 2019년 1월 28일
댓글: Walter Roberson 2019년 1월 28일
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
madhan ravi
madhan ravi 2019년 1월 28일
So give an explicit example of your desired output.
Jae Min Lee
Jae Min Lee 2019년 1월 28일
Example image has been updated.

댓글을 달려면 로그인하십시오.

채택된 답변

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