-
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.
- Loading branch information
1 parent
ffb5ab2
commit a310e88
Showing
2 changed files
with
37 additions
and
0 deletions.
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
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; | ||
} |