-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdepth_image_stream_test.cpp
77 lines (65 loc) · 2.06 KB
/
depth_image_stream_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/******************************************************************************
* BRICS_3D - 3D Perception and Modeling Library
* Copyright (c) 2011, GPS GmbH
*
* Author: Sebastian Blumenthal
*
*
* This software is published under a dual-license: GNU Lesser General Public
* License LGPL 2.1 and Modified BSD license. The dual-license implies that
* users of this code may choose which terms they prefer.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License LGPL and the BSD license for
* more details.
*
******************************************************************************/
/**
* @file
* depth_image_stream_test.cpp
*
* @brief Simple test file to demonstrate depth image capturing from a video
* stream
*
* @author: Sebastian Blumenthal
* @date: Sep 15, 2009
* @version: 0.1
*/
#include <iostream>
#include <brics_3d/util/DepthImageLoader.h>
using namespace std;
using namespace brics_3d;
int main(int argc, char **argv) {
/* check argument */
if(argc != 2) {
cerr << "Usage: " << argv[0] << " <filename>" << endl;
cerr << "Try for example: " << argv[0] << " ../examples/test_data/depth_images/zcam_stream.avi" << endl;
return -1;
}
string filename = argv[1];
cout << filename << endl;
/* get depth images */
IplImage* depthImage;
DepthImageLoader *depthImageLoader = new DepthImageLoader();
depthImage = depthImageLoader->loadDepthImageVideo(filename);
/* create a window */
cvNamedWindow("depthImageVideo", CV_WINDOW_AUTOSIZE);
int i = 0;
while(true) {
cout << "Processing Image "<< ++i << endl;
/* display the current image */
cvShowImage("depthImageVideo", depthImage);
/* wait a certain amount of time */
cvWaitKey(100);
depthImage = depthImageLoader->getNextDepthImage();
if (depthImage == NULL) {
cout << endl << "Done" << endl;
break;
}
}
/* free memory */
cvDestroyWindow("depthImageVideo");
}
/* EOF */