I have a camera pointed at a rectangular 2D area. The camera is off
center (say high and to the right) so that the rectangle appears
distorted to the camera.
I detect a point within the rectangle with the camera.
How do I translate the coordinates I'm seeing in the camera to the
"real" coordinates that the point represents on the rectangle?
I can get calibration data points for the 4 corners of the rectangle
in the camera (or any other points on the rectangle if the math is
easier):
For Example
Here's some actual test data from the camera:
The camera "sees" the four corners of my rectangle as:
261,54 540,60
280,258 534,319
It then read the center point as 386,176
The 4 points that are halfway from the middle of the rectangle to the corners were:
322,113 456,124
329,220 456,245
To map this back to the "real" rectangle that is, say, 400x300 I would
want to transform these sample data points to, roughly:
center: 200,150
halfway to corners: 100,75 300,75 100,225 300,225
What I'm hoping to get is a simple algorithm or formula(s) for taking
calibration readings I get for the corner points (which I can control)
and transforming any future reading I take in the space into it's
"real" coordinates on the rectangle.
Any help would be much appreciated.
To the extent this involves any libraries, I'm using the .net environment.
Thanks! |
Clarification of Question by
keithc-ga
on
04 Jun 2005 16:11 PDT
Thanks for taking a look at this!
Just to clarify, all the readings I gave were measured results.
For instance, I placed objects in the corners and the middle of the
rectangle and the data came back as listed in the question.
What I'm trying to do is figure out how I would *calculate* from an
x,y coordinate I see in the camera to determine where it was on the
"real" rectangle if I didn't know.
So if I got the reading 386,176 how would I calculate that that is
200,150 on the real rectangle if I didn't already know it?
Thanks!
|
Clarification of Question by
keithc-ga
on
04 Jun 2005 18:02 PDT
SIMPLIFICATION:
Let me boil this down to the core question:
If I have skewed space 1 with corners:
261,54 540,60
280,258 534,319
And I want to map that a rectangle 2 with corners
0,0 400,0
300,0 400,300
What is the formula for taking a point in space 1 and determining what
point it would map to in rectangle 2?
What is the generalized formula for solving this class of problems?
As an example, I would expect the point 386,176 in space 1 to map to
200,150 in rectangle 2.
|