• Create Account

# chucara

Member Since 07 May 2007
Offline Last Active Jan 18 2012 04:19 AM

### Finding a projection matrix from a 2D image

10 January 2012 - 05:53 PM

Hi,

I have been stuck on this problem for quite some time.. I think it is best described with a picture:

Imagine that this picture is taken of a table. I am able to find the four red dots and their coordinates on the pictures. Same goes for the green dot.

Now, I want to be able to find the location of the green dot in 2D space on the table. Assuming the following mappings:
(171,22) -> (0,0)
(488,155) -> (1,0)
(24,126) -> (0,1)
(361, 346) -> (1,1)

How do I determine what coordinate (167,128) maps to on the plane created by the table?

I seem to have read that I need to find a projection matrix (which I have a basic understanding of what is), but how?

Any hints or suggestions you can give me is very welcome, example calculations even more so.

Also, please point out if I am reinventing the wheel here. I am not aware of any libraries that do this already. (for .NET)

### World, View and Projection

29 June 2010 - 10:00 AM

I am messing around with some augmented reality library, which I have working. Now, I don't actually plan to use it for augmented reality, but rather to help me track markers.

Now, the output of the library algorithm is a transformation matrix. What I really need, is screen coordinates.

Now, my question is this:

Given my transformation (World) matrix, my View matrix, my Projection matrix and the Vector3 that is the position of my model, can I get the screen coordinates?

I tried:

Vector3.Transform(Positon, World*Projection*View), but that leaves me with another Vector3.

I'm a but lost here, so any advice you can give is appreciated.

On a second note, should I be using a different library for this? (as in: not an augmented reality library)

I want to create a board game where a projector projects the board and a webcam tracks the pieces. So basically, I just want a plane in 3D space. (I cannot be certain that the webcam and the projector are perfectly aligned*)

*some would even argue that it is a physical impossibility.

### Resources on Matrix/Vector math

23 June 2010 - 09:50 AM

So today I found out that my math is a little rusty when it comes to vectors and transformations in 3D space. (Which admittedly is a pretty big part of what I am trying to do)

Now, I will ask some questions, and while you are naturally welcome to answer them for me, I am really just looking for a few hints as to what to read to really understand this.

My scenario is this:

I am using the NyARToolkit to detect the position of markers (2D barcodes) using my webcam. When I place a marker in front of my camera, I am returned a Matrix of dimensions 3x4. Now in order to use the Matrix class from XNA, I need to convert it to a 4x4 matrix. This leads me to my first question.

1. How do I convert a 3x4 transformation matrix to a 4x4?

Now, assuming I have a proper 4x4 transformation matrix, I need to transform my cube so that it will display as if it was on top of my marker if I had the video running on my screen.

2. What do I need to transform to get a Cube rendered at (0,0,0) to align with the camera view?

Once this is working, I want to setup a projector to project my game onto a table while the camera monitors the tokens on said table.

3. What do I need to change (View/Projection/World) to get this to align correctly?

I hope my above question gives you some hints as to what I am trying to achieve.

Can anyone recommend me some books / tutorials on this? Or even just provide me with some keywords as to where to start looking?

### Best practice introduction

07 May 2007 - 11:44 AM

I've been looking through the book lists on this site, yet I'm not quite able to find exactly what I'm looking for. I'd like a resource(book, article, comic, brain implant etc.) that is as void of technology specific discussions as possible. But focuses on the best practices of game programming, regardless of whether it's DirectX, Managed DirectX, OpenGL etc. By best practices, I mean: What is the best(or at least normal) way to build and store a 3D world. Terrain maps, buildings, actors etc. That, and similar questions. I have no problem learning the specific technology, but it would be nice if someone with years of experience could guide me to use the tools I'm learning properly. Does anyone have any suggestions?

PARTNERS