Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

computer vision to opengl 3x4 to 4x4

587 views
Skip to first unread message

Fabian Landis

unread,
Dec 19, 2003, 9:59:07 AM12/19/03
to
Hi,

Does anyone know how I can transform a standard 3x4 computer vision
matrix to a 4x4 opengl matrix? What row do I have to add? And what
additional transformation do I have to perform on the matrix?

Gernot Frisch

unread,
Dec 22, 2003, 4:40:18 AM12/22/03
to

"Fabian Landis" <fla...@ee.ethz.ch> schrieb im Newsbeitrag
news:3fe3124d$1...@pfaff2.ethz.ch...
I don't know what's stored in your 3x4 matrix. The OpenGL matrces look
like:

RRRT
RRRT
RRRT
SSSx

Where R is the rotation, T the translation and S scaling.
HTH,
GF


Fabian Landis

unread,
Dec 22, 2003, 5:44:45 AM12/22/03
to
My 3x4 matrix does the direct mapping from homogenous 3d world
coordinates to 2D pixel coordinates. The matrix was calculated from
translation, rotation, center of projection, internal camera parameters
and cutout. If the matrix is A, the point in worldcoordinates P
(x,y,z,1) and the point in pixel coordinates p (u,v,1), then:
const * p = P * A
(-> ex: u = (a11*x + a12*y + a13*z + a14) / (a31*x + a32*y + a33*z + a34) )

I tried to use a projection matrix in opengl that looks like this:
a11 ..... a14
a21 ..... a24
a31 a32 a33 dx
a31 ..... a34

but that didn't work...

fungus

unread,
Dec 22, 2003, 5:59:36 AM12/22/03
to
Gernot Frisch wrote:
> I don't know what's stored in your 3x4 matrix. The OpenGL matrces look
> like:
>
> RRRT
> RRRT
> RRRT
> SSSx
>
> Where R is the rotation, T the translation and S scaling.
>

Nope.

The scale is mixed in with the rotation. It definitely
isn't separate.

Secondly, the matrices might look like that in the man
pages but they don't look like that in memory. In memory
the translation is along the bottom.

SRR0
RSR0
RRS0
TTT1


--
<\___/> For email, remove my socks.
/ O O \
\_____/ FTB. Why isn't there mouse-flavored cat food?


Gernot Frisch

unread,
Dec 22, 2003, 7:49:12 AM12/22/03
to
> Nope.
>
> The scale is mixed in with the rotation. It definitely
> isn't separate.

Thank you, I wasn't sure about that anymore.

> Secondly, the matrices might look like that in the man
> pages but they don't look like that in memory. In memory
> the translation is along the bottom.
>
> SRR0
> RSR0
> RRS0
> TTT1

The right column is 0001? I thought it's neccessary data there? I know
the last one must be a '1', since it's not used...

-Gernot


Shadows

unread,
Dec 22, 2003, 3:04:21 PM12/22/03
to
fungus wrote:
> Gernot Frisch wrote:
>
>> I don't know what's stored in your 3x4 matrix. The OpenGL matrces look
>> like:
>>
>> RRRT
>> RRRT
>> RRRT
>> SSSx
>>
>> Where R is the rotation, T the translation and S scaling.
>>
>
> Nope.
>
> The scale is mixed in with the rotation. It definitely
> isn't separate.
>
> Secondly, the matrices might look like that in the man
> pages but they don't look like that in memory. In memory
> the translation is along the bottom.
>
> SRR0
> RSR0
> RRS0
> TTT1

So in which order would I have to fill a buffer to use with
glLoadMatrix? SRRTRSRTRRST0001? And why is the last column 0001? I am
not using a uniform scaling- so the last column would be different to right?

>
>

fungus

unread,
Dec 22, 2003, 9:47:56 PM12/22/03
to
Shadows wrote:

> fungus wrote:
>
>>
>> the matrices might look like that in the man
>> pages but they don't look like that in memory. In memory
>> the translation is along the bottom.
>>
>> SRR0
>> RSR0
>> RRS0
>> TTT1
>
>
> So in which order would I have to fill a buffer to use with
> glLoadMatrix? SRRTRSRTRRST0001?

Nope. SRR0SRR0SRR0TTT1

> And why is the last column 0001?

> I am not using a uniform scaling.
>

It can be something else in the perspective matrix but
in a modelview matrix made with scale/rotate/translate
it's *always* 0001.

Shadows

unread,
Dec 23, 2003, 8:21:27 AM12/23/03
to
fungus wrote:
> Shadows wrote:
>
>> fungus wrote:
>>
>>>
>>> the matrices might look like that in the man
>>> pages but they don't look like that in memory. In memory
>>> the translation is along the bottom.
>>>
>>> SRR0
>>> RSR0
>>> RRS0
>>> TTT1
>>
>>
>>
>> So in which order would I have to fill a buffer to use with
>> glLoadMatrix? SRRTRSRTRRST0001?
>
>
> Nope. SRR0SRR0SRR0TTT1

Thanks for the information. I see if I can get some good results with
that. Can I leave the modelview matrix just as it is (the identity
matrix) and use the projection to load my values? I thought opengl just
multiplies all the matrices anyway. Or how would you go about?

Shadows

unread,
Dec 23, 2003, 8:24:05 AM12/23/03
to
Is there any way to check what points (in pixel coordinates) opengl gets
after all the processing, i.e. projection?

fungus

unread,
Dec 23, 2003, 8:33:10 AM12/23/03
to
Shadows wrote:

>
> Can I leave the modelview matrix just as it is (the identity
> matrix) and use the projection to load my values?
>

You can if you want to, but:

a) There's no point. It won't be faster or anything.

b) Lighting and fogging won't work (among other things).

0 new messages