使用Visual Studio + OpenCV 讀圖片檔
程式碼
----------------------------------------------------
// 160025.cpp : 定義主控台應用程式的進入點。
//
#include "stdafx.h"
#include <opencv/highgui.h>
int _tmain(int argc, _TCHAR* argv[])
{
IplImage * img = cvLoadImage("c:/aaa.jpg");
cvShowImage("window",img);
cvWaitKey(0);
return 0;
}
-----------------------------------------------------
圖片擷取
第二題
開啟視訊並且拍照
程式碼
------------------------------------------
#include "stdafx.h"
#include <opencv/highgui.h>
int _tmain(int argc, _TCHAR* argv[])
{
CvCapture * cap = cvCreateCameraCapture(0);
IplImage * img = cvQueryFrame(cap);
while(1){
img=cvQueryFrame(cap);
cvShowImage("img",img);
int key=cvWaitKey(33);
if(key==27) break;
}
cvReleaseCapture(&cap);
return 0;
}
#include <opencv/highgui.h>
int _tmain(int argc, _TCHAR* argv[])
{
CvCapture * cap = cvCreateCameraCapture(0);
IplImage * img = cvQueryFrame(cap);
while(1){
img=cvQueryFrame(cap);
cvShowImage("img",img);
int key=cvWaitKey(33);
if(key==27) break;
}
cvReleaseCapture(&cap);
return 0;
}
--------------------------------------------------------
沒有留言:
張貼留言