「OpenCV-カメラキャプチャ」の編集履歴(バックアップ)一覧はこちら
「OpenCV-カメラキャプチャ」(2007/06/15 (金) 20:20:47) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
//cpp/linenumber
#include <iostream>
#include <string>
using namespace std;
#include <cv.h>
#include <cxcore.h>
#include <cvaux.h>
#include <highgui.h>
int main()
{
CvCapture *cap = NULL;
IplImage *img = NULL;
string wname( "Capture" );
if( ( cap = cvCreateCameraCapture( -1 ) ) == NULL ) { // Capture用オブジェクト生成
cerr << "Camera not found." << endl;
abort();
}
cvNamedWindow( wname.c_str() ); // Window生成
while( cvWaitKey( 1 ) != 0x1b ) { // ESCで終了
cvShowImage( wname.c_str(), cvQueryFrame( cap ) );
}
cvDestroyWindow( wname.c_str() ); // Window破棄
cvReleaseCapture( &cap ); // Capture用オブジェクト破棄
}
//cpp/linenumber
#include <iostream>
#include <string>
#include <cassert>
using namespace std;
#include <cv.h>
#include <cxcore.h>
#include <cvaux.h>
#include <highgui.h>
int main()
{
CvCapture *cap = cvCreateCameraCapture( -1 ); // Capture用オブジェクト生成
assert( cap != NULL );
string wname( "Capture" );
cvNamedWindow( wname.c_str() ); // Window生成
while( cvWaitKey( 1 ) != 0x1b ) { // ESCで終了
cvShowImage( wname.c_str(), cvQueryFrame( cap ) );
}
cvDestroyWindow( wname.c_str() ); // Window破棄
cvReleaseCapture( &cap ); // Capture用オブジェクト破棄
}