本文整理汇总了C++中VideoCapture::setVideo方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoCapture::setVideo方法的具体用法?C++ VideoCapture::setVideo怎么用?C++ VideoCapture::setVideo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoCapture
的用法示例。
在下文中一共展示了VideoCapture::setVideo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: img_input
/*int main(int argc, char **argv)
{
std::cout << "Using OpenCV " << CV_MAJOR_VERSION << "." << CV_MINOR_VERSION << "." << CV_SUBMINOR_VERSION << std::endl;
int resize_factor = 100;
CvCapture *capture = 0;
capture = cvCaptureFromAVI("dataset/video.avi");//D:/video/9.MP4
if(!capture){
std::cerr << "Cannot open video!" << std::endl;
return 1;
}
IplImage *frame_aux = cvQueryFrame(capture);
IplImage *frame = cvCreateImage(cvSize((int)((frame_aux->width*resize_factor)/100) , (int)((frame_aux->height*resize_factor)/100)), frame_aux->depth, frame_aux->nChannels);
//cvResize(frame_aux, frame);
// Background Subtraction Algorithm
IBGS *bgs;
//bgs = new PixelBasedAdaptiveSegmenter;
bgs = new FrameDifferenceBGS ;
//Blob Tracking Algorithm
cv::Mat img_blob;
BlobTracking* blobTracking;
blobTracking = new BlobTracking;
//Vehicle Counting Algorithm //
VehicleCouting* vehicleCouting;
vehicleCouting = new VehicleCouting;
std::cout << "Press 'q' to quit..." << std::endl;
int key = 0;
IplImage *frameTemp;
while(key != 'q')
{
frameTemp = cvQueryFrame(capture);
cvResize(frameTemp,frame );
if(!frame) break;
cv::Mat img_input(frame);
cv::imshow("Input", img_input);
// bgs->process(...) internally process and show the foreground mask image
cv::Mat img_mask;
cv::Mat img_model_bg;
const clock_t begin_time = clock();
bgs->process(img_input, img_mask,img_model_bg);
std::cout << "Time spent bgs:" <<float( clock () - begin_time ) / CLOCKS_PER_SEC << "\n" << std::endl ;
if(!img_mask.empty())
{
// Perform blob tracking
const clock_t begin_time = clock();
blobTracking->process(img_input, img_mask, img_blob);
cv::imshow("img_blob", img_blob);
// Perform vehicle counting
//vehicleCouting->setInput(img_blob);
//vehicleCouting->setTracks(blobTracking->getTracks());
//vehicleCouting->process();
std::cout << "Time spent blobTracking:" << float( clock () - begin_time ) / CLOCKS_PER_SEC << "\n" << std::endl ;
}
key = cvWaitKey(150);
}
system("pause");
delete vehicleCouting;
delete blobTracking;
delete bgs;
cvDestroyAllWindows();
cvReleaseCapture(&capture);
return 0;
} */
int main(int argc, char **argv){
VideoCapture* videoCapture;
videoCapture = new VideoCapture;
videoCapture->setVideo("D:/video/100ANV01/9.MP4");
videoCapture->setUpVideo();
videoCapture->start();
system("pause");
return 0;
};