0

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;

-.-"

GiordiX
  • 201
  • 4
  • 10
  • Isn´t this transformation part of the occulus sdk? Otherwise you need the exact transformation parameters. – Mailerdaimon Apr 07 '14 at 10:10
  • I found a function that can transform an image with the Barrel Distorction... yes, now I need the parameter... I look this but not help... http://stackoverflow.com/questions/6199636/formulas-for-barrel-pincushion-distortion – GiordiX Apr 07 '14 at 13:35
  • I don´t have a occulus (yet) so i can´t really help with that, but i found a link that may contain some usefull information: http://rifty-business.blogspot.de/2013/08/understanding-oculus-rift-distortion.html – Mailerdaimon Apr 07 '14 at 13:51
  • Yes I read it but until now I can't understand how apply the right Barrel distortion on my left and right image... – GiordiX Apr 07 '14 at 14:09

1 Answers1

1

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

Shariq
  • 581
  • 1
  • 5
  • 12