Wiimote Project
Wiimote Projects => Wiimote Interactive Whiteboard => Topic started by: freak42 on January 13, 2008, 03:58:00 AM

Hi,
can someone shed some light how one can calculate the 2d coordinates of a (ir)point after one did the 4point synchronisation with a projection plane?
I looked at the source of Warper.cs but the nongenius I am I couldn't quite figure out what's going on.
Btw I'm trying to code the same screentracker just with a webcam and java (poor man's version, i guess)
Any help or links are appreciated.
freak42
ps I moved this message to this forum, I guess I posted it in the wrong forum first. sorry.

Hello,
A matrix is used to transform the coordinates.
By reading the source code, you should be able to find how the matrix is "fed" with the different values given during the initialisation of the wrapper. Once your matrix build, you will have to multiply it with the tracked 2D coordinates to get the "rectified" values.
Johnny do not use a specialized class for it and do the math "by hand", but Java should have a matrix class
Hope this helps

Hi,
you can save yourself the work to do that all manually in Java.
Just can use the class PerspectiveTransform from JAI.
The method getQuadToQuad creates a PerspectiveTransform. Then you just have to use one of the transformmethods to convert from one perspective to the other.
http://java.sun.com/products/javamedia/jai/forDevelopers/jaiapidocs/javax/media/jai/PerspectiveTransform.html (http://java.sun.com/products/javamedia/jai/forDevelopers/jaiapidocs/javax/media/jai/PerspectiveTransform.html)
Uwe

The WarpedX & WarpedY coordinated that this produce are they related to the current screensize?
I have to transform the warpedx/y values to an value between 0..1, currently i do this by dividing the warpedx/y by my screenwidth & height, is that correct?

:D
hey,
maybe you shoud look at my wii project page  i've got a little explanation behind my maths there...
http://www.zaunert.de/jochenz/wii

Thanks, my math is horrible, but after a couple hours i figured out the problem. Turned out to be bad calibration data and a switch of screenwidth/height i used.. together it made the results rather... funny.. :)

Hi all,
that's an old post, but didn't find any newer.
So, when calibrating we take 4 points, but the perspective transform matrix is just 3x3. What do you do with the 4th point?? It's there any point discarded or is used to rectificate the calibration??
By the way, how do you do the smoothing?? Do you take the linear predicted point calculated with the 7 last points??
Thanks you for your help
Chema

Wow, you guys are bright. I hope I'm not intruding too much but I think that this is a decent place to put in my two cents.
I was wanting to help teachers an implementers do a good job of placing the wiiremote to get the best tracking resolution. We are given the viewing angle of the Wii camera to be 45 degrees. So, I let Turbo Cad do my calculations, i.e. I drew an accurate sketch of a 45 degree angle at varrying distances from various screen sizes. Can one of you gentlemen work out the trigonometry and come up with a formula that translates a desired or given screen size into an optitmal distance that the Wiimote should be from the center of the screen, given that we will place on a normal coming straight out from the center of the screen. Are you with me?
Anyway here is a table of my results from Turbocad. Please someone tell me if I'm on the right track here. Do these numbers make sense?
Width of your screen Opitmal distance on a normal (straight out from the screen)
from left to right from the screen center for the Wiimote
32 inches 38.93 inches
52 inches 62.78 inches
102 inches 123.185 inches
200 inches 240.3469 inches
This data was just based on the demsion tools in TurboCad. I would be happy to email my turbo cad file ( or a JPEG) to anyone who is interested, but I would prefer to use trig. and develop a simple formula.
OK,... I thought a little harder about it....
The formula I have is: Optimal distance from the screen = (Sceen width (left to right) / 2)/ tan 22.5 degrees.
Bam!! I check it against the table. It works!!