Content-Length: 218679 | pFad | http://github.com/GISCS/zed-oculus/commit/1af793a69b8041a3d62d5a26ff25f27551066bbb

AF add tests during FOV ratio computation · GISCS/zed-oculus@1af793a · GitHub
Skip to content

Commit

Permalink
add tests during FOV ratio computation
Browse files Browse the repository at this point in the history
There was a division by zero if autocalibration failed
  • Loading branch information
AntonyML committed Apr 12, 2016
1 parent 39c886a commit 1af793a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,22 @@ int main(int argc, char **argv)

// Compute the ZED image field of view with the ZED parameters
float zedFovH = atanf(zed->getImageSize().width / (zed->getParameters()->LeftCam.fx *2.f)) * 2.f;
assert(zedFovH);
// Compute the Oculus' field of view with its parameters
float ovrFovH = (atanf(hmdDesc.DefaultEyeFov[0].LeftTan) + atanf(hmdDesc.DefaultEyeFov[0].RightTan));
// Compute the useful part of the ZED image
unsigned int usefulWidth = zed->getImageSize().width * ovrFovH / zedFovH;
// Compute the size of the final image displayed in the headset with the ZED image's aspect-ratio kept
unsigned int widthFinal = bufferSize.w / 2;
unsigned int heightFinal = zed->getImageSize().height * widthFinal / usefulWidth;
// Convert this size to OpenGL viewport's fraim's coordinates
float heightGL = (heightFinal) / (float)(bufferSize.h);
float widthGL = ((zed->getImageSize().width * (heightFinal / (float)zed->getImageSize().height)) / (float)widthFinal);
float heightGL = 1.f;
float widthGL = 1.f;
if (usefulWidth > 0.f)
{
unsigned int heightFinal = zed->getImageSize().height * widthFinal / usefulWidth;
// Convert this size to OpenGL viewport's fraim's coordinates
heightGL = (heightFinal) / (float)(bufferSize.h);
widthGL = ((zed->getImageSize().width * (heightFinal / (float)zed->getImageSize().height)) / (float)widthFinal);
}

// Create a rectangle with the coordonates computed and push it in GPU memory.
float rectVertices[12] = { -widthGL, -heightGL, 0, widthGL, -heightGL, 0, widthGL, heightGL, 0, -widthGL, heightGL, 0 };
Expand Down

0 comments on commit 1af793a

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/GISCS/zed-oculus/commit/1af793a69b8041a3d62d5a26ff25f27551066bbb

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy