-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from yuki-asano/add-stereo2
add stereo sample
- Loading branch information
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |