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