00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "uvsim/sensing/DepthEngine.h"
00020 #include "uvsim/sensing/Camera.h"
00021 #include <iostream>
00022 #include <ctime>
00023
00024 int main (int argc, char const* argv[])
00025 {
00026 uvsim::Camera camera(0);
00027 uvsim::DepthEngine depth(camera.m_frame);
00028 cvNamedWindow("video", CV_WINDOW_AUTOSIZE);
00029 cvNamedWindow("image", CV_WINDOW_AUTOSIZE);
00030 cvNamedWindow("prevImage", CV_WINDOW_AUTOSIZE);
00031 cvNamedWindow("prevRectified / rectified", CV_WINDOW_AUTOSIZE);
00032 char c;
00033 static const char escKey = 27;
00034 bool initialize = false;
00035 while (1)
00036 {
00037
00038 c = cvWaitKey(33);
00039 if ( (char)c == escKey) break;
00040
00041
00042 camera.update();
00043 cvShowImage("video", camera.m_frame);
00044
00045
00046 switch ( (char)c)
00047 {
00048 case 'r':
00049 initialize = true;
00050
00051 case 'n':
00052 depth.update(initialize);
00053 initialize = false;
00054 cvShowImage("image", depth.image);
00055 cvShowImage("prevImage", depth.prevImage);
00056
00057 break;
00058 case 'd':
00059 depth.calculateDepth();
00060 cvShowImage("prevRectified / rectified", depth.pair);
00061 break;
00062 default:
00063 break;
00064 }
00065 }
00066 cvDestroyWindow("depth.test");
00067 return 0;
00068 }
00069
00070