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
Cv.NamedWindow("sample", WindowMode.AutoSize); | |
CvCapture videoCapture = Cv.CreateCameraCapture(0); //ここはUSBカメラのID | |
//サイズを320,240にしておかないとエラーになる感じ | |
double w = 320, h = 240; | |
Cv.SetCaptureProperty(videoCapture, CaptureProperty.FrameWidth, w); | |
Cv.SetCaptureProperty(videoCapture, CaptureProperty.FrameHeight, h); | |
if (videoCapture == null){ | |
//ここでカメラがない場合のエラー処理 | |
} | |
while (Cv.WaitKey(1) == -1){ | |
// カメラから1フレーム取得する | |
IplImage image = Cv.QueryFrame(videoCapture); | |
// ウィンドウに画像を表示する | |
Cv.ShowImage("sample", image); | |
} |
0 件のコメント:
コメントを投稿