Log in or register to post comments

projection matrix weirdness

December 17, 2012 - 2:57am #1

hi,

i calculated my projection matrix usind the size of the view bounds (self.bounds.size.width,self.bounds.size.height)

i am on an iphone 5, so i get  568x320

my renderings are stretched in height. it looks very wrong...

so i tried to identify the problem:

I found out, that the video QCAR::VideoBackgroundConfig size is set to 1136x852.
when i set my projection matrix to those numbers everything looks fine.

what kind of number is this ? the resolution of a iphone 5 is 1136x640 ! 

i need to project input (touch) coordinates to the same projection matrix, so i need the same ratio for both matrices.
(because i do ray collision testing with my 3d objects)

how can i set vuforia to use the correct resolution ?
why is the resolution of the video background different ?

 

thanks for your help,
tom

 

Hi, as you have correctly

December 17, 2012 - 6:16am #3

Hi, as you have correctly found out by yourself,

the 1136x852 resolution is computed based on the aspect ratio of the camera frame; 

this ensures that the video background is rendered without distortion, i.e. preserving the aspect ratio of the camera video feed.

In practice, there is a part of the OpenGL viewport which is rendered with the origin outside of the screen (so what you see on screen is not the entire camera video frame, but a portion of it, as there are typically a few pixels which are rendered outside the screen (and that is given by the difference 852 - 640 in your case; half of those "hidden" pixels are on the top part of the screen, the other half on the bottom; also, note that depending on the screen orientation, it could also happen that the hidden parts are on the left and right of the screen, as Vuforia always adjust with a "best fit" appraoch)

If you want to dig more in the maths detais of this topic, you may want to have a look at the "BackgroundTextureAccess" sample code; this sample exlains quite clearly how things are computed with respect to the viewport and the texture size.

I hope this helps.

ok i think i got it. the

December 17, 2012 - 6:08am #2

ok i think i got it.

the resolution of 1136x852 is in the ratio of the camera picture.

so the camera picture is centered (upper and lower parts are cutted i think)

now i add that cutted part to my touch pixel positions i get correct results.

i guess there is some easier way to do this but i cannot find any hint how.

 

Log in or register to post comments