支持很多功能,使用起來也算簡單。
相信的內容可以參考www.opencv.org.cn
需要配置這個庫
下面代碼是從這個網址轉來的,可以參考下
/bbs/thread-327-1-1.html
/* jink2005編寫於www.aiseminar.cn */
#include "stdio.h"
#include "cv.h"
#include "highgui.h"
#pragma comment(lib, "cv.lib")
#pragma comment(lib, "cxcore.lib")
#pragma comment(lib, "highgui.lib")
int main(int argc, char* argv[]) {
/* 通過攝像頭采集壹幀圖像 */
IplImage* img = 0;
CvCapture* capture = cvCaptureFromCAM(0);
if (! cvGrabFrame(capture)) { // 采集壹幀
printf("Could not grab a frame!\n\7");
exit(0);
}
img = cvRetrieveFrame(capture); // 提取采集到的幀
/* 獲得此幀的相關信息 */
cvQueryFrame(capture); // 此調用是獲得正確的采集屬性所必需的
int frameH = (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT);
int frameW = (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH);
/* 顯示圖像到窗口 */
cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE); // 創建窗體
cvShowImage("mainWin", img);
/* 釋放采集源對像 */
cvReleaseCapture(&capture);
// 等待壹個任意鍵
cvWaitKey(0);
cvReleaseImage(&img);
return(0);
}