image processing - Homography estimation from consecutive video frame lines gives bad results -
i trying build program detects offside situation in football video sequence. in order track better players , ball need estimate homography between consecutive frames. doing project in matlab. able find enough corresponding lines between frames seems me resulting homography isn't correct.
i start following situation, have these 2 processed images (1280x720 px) corresponding lines: image 1 , image 2.
lines derive hough transform , of form cross(p1, p2)
, p(i) [x y 1]'
, 0 < x,y < 1 (devided image width , height). lines normalized too, devided third component).
before lines normalization (just after cross product) have:
lines frame 1 (one line per row).
[ -0.9986 -0.2992 0.6792 -0.9986 -0.4305 0.5686 -0.8000 -0.4500 0.3613 -0.9986 -0.1609 0.7890 -0.9986 -0.0344 0.9074 -0.2500 -0.2164 0.0546]
these lines frame 2:
[-0.9986 -0.2984 0.6760 -0.9986 -0.4313 0.5678 -0.7903 -0.4523 0.3587 -0.9986 -0.1609 0.7890 -0.9986 -0.0391 0.9066 -0.2486 -0.2148 0.0539]
after normalization each mathching line (in case rows correspond) create matrix a(j) [-u 0 u*x -v 0 v*x -1 0 x]; [0 -u u*y 0 -v v*y 0 -1 y];
line(j)_1 [x y 1]'
, line(j)_2 [u v 1]'
. form entire matrix , calculate svd [~,~,v] = svd(a);
. rearranging last column of v 3x3 matrix give h as:
[0.4234 0.0024 -0.3962 -0.3750 -0.0030 0.3503 0.4622 0.0029 -0.4322]
this homography matrix works quite parallel lines above , vanishing point (intersection of lines) terrible job elsewhere. example 1 vanishing point in unscaled coordinates (1194.2, -607.4), supposed stay there , in fact mapped few pixel around (5~10px). if take random point in (300, 300) go (1174.1, -582.7)!
i can't see if did big mistake or because noise in measurements. can me?
well, computed homography mapping lines lines. if want corresponding pointwise homography need invert , transpose it. see, example, chapter 1.3.1 of hartley , zisserman's "multiple view geometry".
Comments
Post a Comment