GiordiX
GiordiX

Reputation: 201

How show stereo camera with Oculus Rift?

I use the OpenCV for show in a new windows the left and right image from a stereo camera. Now I want to see the same thing on the Oculus Rift but when I connect the Oculus the image doesn't became in the Characteristic Circled image suitable with the lens inside the Oculus... I need to process by myself the image ? It's not Automatic?

This is the code for show the windows:

            cap >> frame; //cap= camera 1 & cap2=camera 2
            cap.read(frame);
            sz1 = frame.size();

            //second camera
            cap2 >> frame2;
            cap2.read(frame2);

            sz2 = frame2.size();

             cv::Mat bothFrames(sz2.height, sz2.width + sz1.width, CV_8UC3);

           // Move right boundary to the left.                
           bothFrames.adjustROI(0, 0, 0, -sz1.width);                 
           frame2.copyTo(bothFrames);

           // Move the left boundary to the right, right boundary to the right.             
           bothFrames.adjustROI(0, 0, -sz2.width, sz1.width);               
           frame.copyTo(bothFrames);

           // restore original ROI.             
           bothFrames.adjustROI(0, 0, sz2.width, 0);

           cv::imencode(".jpg", bothFrames, buf, params);

I have another problem. I'm trying to add the OVR Library to my code but I have the error "System Ambibuous Symbol" because some class inside the OVR Library used the same namaspace... This error arise when I add the

#include "OVR.h"
using namespace OVR;

-.-"

Upvotes: 0

Views: 1709

Answers (1)

Shariq
Shariq

Reputation: 579

The SDK is meant to perform lens distortion correction, chromatic aberration correction (different refractive indices for different color light causes color fringing in image without correction), time warp, and possibly other corrections in the future. Unless you have a heavy weight graphics pipeline that you're hand optimizing, it's best to use the SDK rendering option.

You can learn about the SDK and different kinds of correction here:

http://static.oculusvr.com/sdk-downloads/documents/Oculus_SDK_Overview.pdf

It also explains how the distortion corrections are applied. The SDK is open source so you could also just read the source for a more thorough understanding.

To fix your namespace issue, just don't switch to the OVR namespace! Every time you refer to something from the OVR namespace, prefix it with OVR:: - e.g, OVR::Math - this is, after all, the whole point of namespaces :p

Upvotes: 1

Related Questions