Warping a captured screen to be square using homography?

Ask question on using Emgu CV with C#
Post Reply
Posts: 2
Joined: Sun Jan 12, 2020 8:01 pm

Warping a captured screen to be square using homography?

Post by digitalhigh » Fri Jan 17, 2020 2:57 pm

Hello all!

Please excuse me if this has been asked before, I did a search, and couldn't find anything relevant to the latest version of Emgu.CV.

So, I am trying to use a camera to capture a TV screen, and perspective warp the output so that it is perfectly square. No, this is in no way related to piracy or anything illegal.

Depending on the camera being used, there is a chance that some fish-eye distortion could occur.

I'm already able to successfully detect the frame of the screen and store the contour.

Now, I would like to use the detected contour to do the necessary CvInvoke.WarpPerspective() transformation on it so that it is perfectly square.

I believe using the CvInvoke.FindHomography() method is what I want to be using, but any code examples I can find appear to be from older versions of the library, with returns and values being passed having changed somewhat.

The input image is a Mat, and I know that the "source" video will always be at a specific resolution, in this case, 800x600.

So, given that I have known contour "cnt", source width "srcWidth", source height "srcHeight", and Mat input "inputImage"...what would be the magic sauce to get my Homographic(?) Matrix and warp the image?


Post Reply