2

I'm currently working on a project where I need to create a virtual screen for feedback during a game

My program draws an image at a tracked position. What I wan't it to do is to have this image follow my 4 tracked points, so it scales and rotates.

What I need for this is to get the homography to work, and I'm sorry to ask this question, because I know there's a lot of different articles, and I've been trying to go through quite many of these, but they don't make much sense to me. The issue i'm facing right now is that I don't know how to.

I can get it to scale the texture or the content of the image but it remains the same format of height and width. It doesn't rotate it, right now since I don't have a update function for it yet, which I don't know how to create either. I need it to stretch the picture itself so it scales accordingly to the points tracked.

With this post I hope you can help me in the right direction for just scaling the format of my image accordingly, that would be a major break-through for me.

I'm using openframeworks with openCV and ofxCV addons in Codeblocks (C++) on windows 7.

There's some functions in the addons of ofxCv, I'm pretty confused about: For instance, I have not much idea of how the "imitate();" works and what it does. This neither:

  "homography = findHomography(Mat(dstPoints), Mat(srcPoints);"

and the: "warpPerspective(origImg, warpImg, homography, CV_INTER_LINEAR);"

I'm not sure I'm using these correctly, and have had difficulties finding proper documentation on these, that makes sense to me.

Another thing I have doubts about, is the usage of matrices in regards to this task.

As you've propably already figured out, I'm really not an experienced programmer. Any help in the right direction would be much appreciated!

This is a paste of all of the code: http://pastebin.com/MFfJqGZ1 The most interesting part, or where I personally believe I'm missing something or have done something wrong is between line 199-223. And heres the header file: http://pastebin.com/XfQySAmh

Thanks so much in advance

Best regards Jesper

Jellezilla
  • 3,950
  • 1
  • 15
  • 15
  • Does http://stackoverflow.com/questions/8181872/finding-homography-and-warping-perspective help you ? – mmgp Dec 07 '12 at 17:06
  • Thank you for your response. Well not much. I've been trying some of the things in that post and the post that's linked to in the comments section. I'm still faced with the same problem though. :/ – Jellezilla Dec 08 '12 at 13:50
  • 1
    I suggest you to simplify your post, i.e. it is not important to say that you can do tracking or what project you are working on, but it is very important to say what you tried to do to solve the problem regarding homography. You could also include simpler images as input, what your program produces as output, and what you expected. – mmgp Dec 08 '12 at 13:57
  • `This is a paste of all of the code` Just one way in which this is not an appropriate Stack Overflow question. – Lightness Races in Orbit Dec 08 '12 at 14:47
  • I just edited my post, presenting the code I'm uncertain of. I've still left a link to all of my code, just in case someone would find that helpfull when searhing for a solution. Hope it's alright. – Jellezilla Dec 08 '12 at 15:00
  • One thing that has been confusing me regarding the use of matrices, is that any example I find have extensive use of such. I've now come to the impression, that the way I'm using two arrays for looping through the frames in my image or video feed, don't have the same need of matrices. Is this somewhat a correct understanding? I'm still stuck, however I've found this article on documentation for the findHomography function: http://bit.ly/Vs2CkV – Jellezilla Dec 09 '12 at 13:58

0 Answers0