00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "uvsim/sensing/StereoEngine.h"
00020 #include "uvsim/sensing/Camera.h"
00021 #include <iostream>
00022 #include <ctime>
00023
00024 int main (int argc, char const* argv[])
00025 {
00026 if(argc == 2)
00027 {
00028 std::cout<<"Running Calibration"<<std::endl;
00029 uvsim::StereoEngine::stereoCalibrate("data/stereo_calib.txt",8,5,0);
00030 return 0;
00031 }
00032
00033 else
00034 {
00035 uvsim::Camera cameraL(0);
00036 uvsim::Camera cameraR(1);
00037 uvsim::StereoEngine stereo(cameraL.m_frame, cameraR.m_frame);
00038 cvNamedWindow("leftVideo", CV_WINDOW_AUTOSIZE);
00039 cvNamedWindow("rightVideo", CV_WINDOW_AUTOSIZE);
00040
00041 char c;
00042 static const char escKey = 27;
00043 bool initialize = false;
00044 int number = 1;
00045 while (1)
00046 {
00047
00048 c = cvWaitKey(33);
00049 if ( (char)c == escKey) break;
00050
00051
00052 cameraL.update();
00053 cameraR.update();
00054 cvShowImage("leftVideo", cameraL.m_frame);
00055 cvShowImage("rightVideo", cameraR.m_frame);
00056
00057
00058 switch ( (char)c)
00059 {
00060 case 'c':
00061 std::cout<<"Running Calibration"<<std::endl;
00062 stereo.stereoCalibrate("data/stereo_calib.txt",8,5,0);
00063 break;
00064 case 'd':
00065 std::cout<<"Finding Disparity"<<std::endl;
00066 stereo.findDisparity();
00067 stereo.displayDisparity();
00068 break;
00069 case 's':
00070 std::cout<<"Image Captured- "<<number<<std::endl;
00071 stereo.captureCalibrationImages(number);
00072 number++;
00073 break;
00074 case '3':
00075 std::cout<<"Reprojecting to 3d"<<std::endl;
00076 stereo.reprojectTo3d();
00077 stereo.drawPointCloud();
00078
00079
00080 default:
00081 break;
00082 }
00083 }
00084 return 0;
00085 }
00086 }
00087
00088