Skip to content

Commit

Permalink
Merge pull request #10 from yuki-asano/add-stereo2
Browse files Browse the repository at this point in the history
add stereo sample
  • Loading branch information
yuki-asano authored Dec 7, 2016
2 parents f2c9f0d + d38cd2d commit 0fa63e8
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
7 changes: 6 additions & 1 deletion khr_driver_semi2016/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# How to compile
# Install
```
sudo apt-get install libftdi-dev
```

# How to compile
```
cd build
cmake ..
make
```

# How to execute
Expand Down
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 0fa63e8

Please sign in to comment.