1,视频输入输出相关教程
-
#include <stdio.h>
-
#include <opencv2\opencv.hpp>
-
-
using namespace std;
-
using namespace cv;
-
-
int main()
-
{
-
VideoCapture cap(0); //
-
if (cap.isOpened())
-
cout << "camera is opened "<< endl;
-
else
-
cout << "camera is not opende" <<endl;
-
-
bool stop = false;
-
Mat frame;
-
-
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 480);
-
cap.set(CV_CAP_PROP_FRAME_WIDTH, 640);
-
cap.set(CV_CAP_PROP_FPS, 30.0);
-
-
//VideoWriter writer("test0.avi", CV_FOURCC('M', 'J', 'P', 'G'), 30, Size(640,480), true);
-
for(;;)
-
{
-
cap >> frame;
-
imshow("camera0", frame);
-
-
char c = (char) waitKey(50);
-
if (c == 27) break;
-
}
-
-
/* Mat grayim(600, 800, CV_8UC1);
-
Mat colorim(600, 800, CV_8UC3);
-
-
grayim = imread("E:\\会务系统开发\\Module\\opencv_door\\Debug\\ceshi.jpg");
-
-
imshow("grayim", grayim);
-
-
waitKey(0);
-
*/
-
return 0;
-
}
2, 特征提取。因为我要追踪的物体没有特征,所以需要自己去人为的创造特征。
阅读(1083) | 评论(0) | 转发(0) |