Quad warping / homography without opencv


#21

started a projection-mapping simple tool experiment using as a foundation the code provided in this thread.
first code ever in openframeworks and c++ for me.

http://gitorious.org/projection-mapping


#22

hi

i have used the matrix and cvfindhomography code for a projected that uses 2 hd projectors.
it works pretty good.
the projectors project on to a conveyor belt. on the belt we place real objects and on to the moving objects we projected images.

but i have noticed that the position of the real and projected images do not always match. it changes through out the projection.
it matches at the start (left side of projection), lags behind towards the middle and is a head towards the right.

i know memo mentioned that short throw lens need some sort of un-warping but this is a beng w6000 with a normal lens.

here is a link to the project:
http://www.lozano-hemmer.com/please-emp-…-ockets.php

here is my code to help make the matrix map:
www.lozano-hemmer.com/ss/keystoner5.zip

any ideas what is going on?

thanks,
stephan.


#23

@arturo thanks so much for this code!

I have a question - does it matter which order the points 0-3 are defined in? I’m using them with the ofxSimpleGUITooQuadWarper which seems to use points defined from the top left clockwise. My destPoints are also defined as such but I’m getting unexpected results.

thanks again.

Seb


#24

Ah. After some hair pulling, I figured it out. If you take Arturo’s code :

  
ofMatrix4x4 H = findHomography(sourcePoints, destPoints);    
ofVec3f v(xPos,yPos);    
ofVec3f t = v * H;   

… it doesn’t work. Instead I switched H and v and now it works!

  
ofVec3f t = H * v;   

Just thought I’d let you know in case this was a bug, or maybe just a slight change in the ofMatrix4x4 or ofVec2f objects.

cheers!

Seb


#25

I’m curious about the opposite of this code:

  
ofxMatrix4x4 H = findHomography(src,dst);  
ofxVec2f v(x,y);  
ofxVec2f t = v*H;  
  

Something like:

  
ofxMatrix4x4 H = findHomography(src,dst);  
ofxVec2f t(x,y);  
ofxVec2f v = t/H;  

Maybe someone can point me to the right direction?


#26

I solved it in a very simple way - just by swapping the source points with destination points in the find homography function call. Like the following:

  
ofxMatrix4x4 H = findHomography(dst,src);  
ofxVec2f t(x,y);  
ofxVec2f v = t*H;  

That’s it!


#27

Hi

I’m very interested in your code but the link doesnt work anymore.

Any help?


#28

Hi !
I am curious about this as well - at the moment I created my own class out of the ofxCV example to produce homography with video using 4 points . If by any chance that could increase performance/ simplify things would love to get hands on the example zip file at the beginning of the thread.
Thanks !


#29

Hi.
this might be useful.


#30

Hi Roy,
I hope you are all well !
I’ll have a look,
Cheers