8

Okay so i am trying to find homography of a soccer match. What i have till now is

  1. Read images from a folder which is basically many cropped images of a template soccer field. Basically this has images for center circle and penalty lines etc.
  2. Read video stream from a file and crop it into many smaller segments.
  3. Loop inside the images in video stream and inside that another loop for images that i read from folder.
  4. Now in the two images that i get through iteration , i applied a green filter because of my assumption that field is green
  5. Use orb to find points and then find matches.

Now the Problem is that because of players and some noise from croud, i am unable to find proper matches for homography. Also removing them is a problem because that also tends to hide the soccer field lines that i need to calculate the homography on.

Any suggestions on this is greatly appreciated. Also below are some sample code and images that i am using.

"Code being used"

Sample images

Output that i am getting

The image on right of output is a frame from video and that on left is the same sample image that i uploaded after filterGreen function as can be seen from the code.

Finally what i want is for the image to properly map to center circle so i can draw a cube in center, Somewhat similar to "This example" . Thanks in advance for helping me out.

Community
  • 1
  • 1
georoot
  • 3,557
  • 1
  • 30
  • 59
  • The input is "real images" or computer generated ones? – Leonardo Alves Machado Apr 14 '16 at 17:39
  • @LeonardoAlvesMachado computer generated, for the ones that i used but there is not restriction on that as such – georoot Apr 15 '16 at 04:50
  • @LeonardoAlvesMachado should mention that the video stream is real football match – georoot Apr 15 '16 at 04:58
  • Corners are very important features but your template has only 2 corners theoretically. Also since you're converting images to binary, you lose out on a lot more possible features. So you're getting poor matches and incorrect homography. I think you should look into shape descriptors. That would work better than this approach. – Froyo Apr 15 '16 at 19:35
  • @Froyo that is just a sample screenshot. it can be goal are also. And then there are always people in the video because that is from a live stream. Currently i am using green color detection to detect the field but even after that there are a lot of outliers. And i have aldready tried hough circle and hough lines but because of players they give inaccurate results – georoot Apr 17 '16 at 16:57
  • The features are probably not that good due to the symmetry of your template, even if you use green instead of binary image, it may think that the features found in one side of the circle belong to any part of the circle... trying to identify the lines may yield a much better result. In the example you gave they use PNP, for this case you will need a 3D model, correct intrinsics and the corresponding 2D points to the 3D points and you will get the extrinsics... with this you can draw anything to the 3D model and project it back to the image plane – api55 Apr 20 '16 at 11:21
  • With the homography you will be able to map, you will be able to change the perspective only, and drawing the cube will be drawing an image of the cube seen from a perspective, I recommend you to read this [paper](http://www.wakayama-u.ac.jp/~wuhy/cvim139-2.pdf) where they did a similar thing as what you want to achieve... – api55 Apr 20 '16 at 11:27

1 Answers1

4

An interesting technique to throw at this problem is RASL. It computes homographies that align stacks of related images. It does not require that you specify corresponding points on the images, but operates directly on the image pixels. It is robust against image occlusions (eg, players moving in the foreground).

I've just released a Python implementation here: https://github.com/welch/rasl (there are also links there to the original RASL paper, MATLAB implementation, and data).

I am unsure if you'd want to crop the input images to that center circle, or if the entire frames can be aligned. Try both and see.

welch
  • 936
  • 8
  • 12