Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <opencv2/core/core.hpp>
- #include <opencv2/highgui/highgui.hpp>
- #include <stdlib.h>
- #include <opencv2/imgproc/imgproc.hpp>
- #include <opencv2/opencv.hpp>
- #include <iostream>
- #include <fstream>
- #include <stdio.h>
- using namespace cv;
- using namespace std;
- int main(int argc, char *argv[])
- {
- if (argc != 2)
- {
- printf("Usage:videon");
- return -1;
- }
- VideoCapture capture("Home//cuda-workspace//DisplayVideo//video_1.avi");
- namedWindow("display", cv::WINDOW_AUTOSIZE);
- if(!capture.isOpened())
- {
- printf("Failed to open the videon");
- return -1;
- }
- for(;;)
- {
- Mat frame;
- capture >> frame; // get a new frame from camera
- imshow("display",frame);
- }
- return 0;
- }
- for(;;)
- {
- Mat frame;
- capture >> frame; // get a new frame from camera
- imshow("display",frame);
- }
- #include <opencv2/core/core.hpp>
- #include <opencv2/highgui/highgui.hpp>
- #include <stdlib.h>
- #include <opencv2/imgproc/imgproc.hpp>
- #include <opencv2/opencv.hpp>
- #include <iostream>
- #include <fstream>
- #include <stdio.h>
- using namespace cv;
- using namespace std;
- int main(int argc, char *argv[])
- {
- if (argc != 2)
- {
- printf("Usage:videon");
- return -1;
- }
- VideoCapture capture("Home//cuda-workspace//DisplayVideo//video_1.avi");
- double fps = cap.get(CV_CAP_PROP_FPS); //get the frames per seconds of the video
- cout << "Frame per seconds : " << fps << endl;
- namedWindow("display", cv::WINDOW_AUTOSIZE);
- if(!capture.isOpened())
- {
- printf("Failed to open the videon");
- return -1;
- }
- while(1)
- {
- Mat frame;
- bool bSuccess = capture.read(frame); // read a new frame from video
- if (!bSuccess) //if not success, break loop
- {
- cout << "can't read the frame from video file" << endl;
- break;
- }
- imshow("display",frame);
- }
- return 0;
- }
- #include <opencv2/core/core.hpp>
- #include <opencv2/highgui/highgui.hpp>
- #include <stdlib.h>
- #include <opencv2/imgproc/imgproc.hpp>
- #include <opencv2/opencv.hpp>
- #include <iostream>
- #include <fstream>
- #include <stdio.h>
- using namespace cv;
- using namespace std;
- int main(int argc, char *argv[])
- {
- printf("Usage: %s videon", argv[0]);
- if(argc != 2)
- {
- printf("nPlease provide video path n");
- return -1;
- }
- else
- {
- printf("nyour video file path :%s n",argv[1]);
- }
- VideoCapture capture(argv[1]);
- namedWindow("display",cv::WINDOW_AUTOSIZE);
- printf("2n");
- if(!capture.isOpened())
- {
- printf("Failed to open the videon");
- return -1
- }
- while(1)
- {
- Mat frame;
- bool bSuccess = capture.read(frame); // read a new frame from video
- if (!bSuccess) //if not success, break loop
- {
- cout << "can't read the frame from video file" << endl;
- break;
- }
- imshow("display",frame);
- }
- return 0;
- }
- VideoCapture capture("//Home//cuda-workspace//DisplayVideo//video_1.avi");
- if(!capture.isOpened())
- {
- return -1;
- }
- namedWindow("display");
- Mat frame;
- while(1)
- {
- capture >> frame; // get a new frame from camera
- if (frame.empty()) //When it finish the video it breaks out of the cycle
- {
- break;
- }
- imshow("display",frame);
- waitKey(30); // This is for you can visualize the video,
- //otherwise the reading process is very fast
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement