Skip to content

Commit

Permalink
add stereo sample
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki-asano committed Dec 7, 2016
1 parent ffb5ab2 commit a310e88
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions stereo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
all: sample5

sample5: sample5.c
gcc -o sample5 sample5.c `pkg-config opencv --cflags` `pkg-config opencv --libs`
33 changes: 33 additions & 0 deletions stereo/sample5.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <cv.h>
#include <highgui.h>
#include <ctype.h>

int
main (int argc, char **argv)
{
CvCapture *capture = 0;
IplImage *frame = 0;
int c;

// (1)指定された番号のカメラに対するキャプチャ構造体を作成する
capture = cvCreateCameraCapture(1);

// (2)表示用ウィンドウをの初期化
cvNamedWindow ("Capture", CV_WINDOW_AUTOSIZE);

while (1) {
// (3)カメラから画像をキャプチャする
frame = cvQueryFrame (capture);
// (4) カメラ画像の表示
cvShowImage ("Capture", frame);
// (5) 2msecだけキー入力を待つ
c = cvWaitKey (2);
if (c == '\x1b') // Escキー
break;
}

cvReleaseCapture (&capture);
cvDestroyWindow ("Capture");

return 0;
}

0 comments on commit a310e88

Please sign in to comment.