Advertisement
Guest User

Untitled

a guest
Oct 21st, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. #include <opencv2/core/core.hpp>
  2. #include <opencv2/highgui/highgui.hpp>
  3. #include <stdlib.h>
  4. #include <opencv2/imgproc/imgproc.hpp>
  5. #include <opencv2/opencv.hpp>
  6. #include <iostream>
  7. #include <fstream>
  8. #include <stdio.h>
  9.  
  10. using namespace cv;
  11. using namespace std;
  12.  
  13. int main(int argc, char *argv[])
  14. {
  15. if (argc != 2)
  16. {
  17. printf("Usage:videon");
  18. return -1;
  19. }
  20. VideoCapture capture("Home//cuda-workspace//DisplayVideo//video_1.avi");
  21. namedWindow("display", cv::WINDOW_AUTOSIZE);
  22.  
  23.  
  24. if(!capture.isOpened())
  25. {
  26. printf("Failed to open the videon");
  27. return -1;
  28. }
  29.  
  30. for(;;)
  31. {
  32. Mat frame;
  33. capture >> frame; // get a new frame from camera
  34. imshow("display",frame);
  35. }
  36.  
  37. return 0;
  38. }
  39.  
  40. for(;;)
  41. {
  42. Mat frame;
  43. capture >> frame; // get a new frame from camera
  44. imshow("display",frame);
  45. }
  46.  
  47. #include <opencv2/core/core.hpp>
  48. #include <opencv2/highgui/highgui.hpp>
  49. #include <stdlib.h>
  50. #include <opencv2/imgproc/imgproc.hpp>
  51. #include <opencv2/opencv.hpp>
  52. #include <iostream>
  53. #include <fstream>
  54. #include <stdio.h>
  55.  
  56. using namespace cv;
  57. using namespace std;
  58.  
  59. int main(int argc, char *argv[])
  60. {
  61. if (argc != 2)
  62. {
  63. printf("Usage:videon");
  64. return -1;
  65. }
  66.  
  67. VideoCapture capture("Home//cuda-workspace//DisplayVideo//video_1.avi");
  68.  
  69.  
  70. double fps = cap.get(CV_CAP_PROP_FPS); //get the frames per seconds of the video
  71.  
  72. cout << "Frame per seconds : " << fps << endl;
  73.  
  74. namedWindow("display", cv::WINDOW_AUTOSIZE);
  75.  
  76.  
  77. if(!capture.isOpened())
  78. {
  79. printf("Failed to open the videon");
  80. return -1;
  81. }
  82.  
  83. while(1)
  84. {
  85. Mat frame;
  86.  
  87. bool bSuccess = capture.read(frame); // read a new frame from video
  88.  
  89. if (!bSuccess) //if not success, break loop
  90. {
  91. cout << "can't read the frame from video file" << endl;
  92. break;
  93. }
  94.  
  95. imshow("display",frame);
  96. }
  97.  
  98. return 0;
  99. }
  100.  
  101. #include <opencv2/core/core.hpp>
  102. #include <opencv2/highgui/highgui.hpp>
  103. #include <stdlib.h>
  104. #include <opencv2/imgproc/imgproc.hpp>
  105. #include <opencv2/opencv.hpp>
  106. #include <iostream>
  107. #include <fstream>
  108. #include <stdio.h>
  109.  
  110. using namespace cv;
  111. using namespace std;
  112.  
  113. int main(int argc, char *argv[])
  114. {
  115. printf("Usage: %s videon", argv[0]);
  116.  
  117. if(argc != 2)
  118. {
  119. printf("nPlease provide video path n");
  120. return -1;
  121. }
  122. else
  123. {
  124. printf("nyour video file path :%s n",argv[1]);
  125. }
  126.  
  127. VideoCapture capture(argv[1]);
  128.  
  129. namedWindow("display",cv::WINDOW_AUTOSIZE);
  130.  
  131. printf("2n");
  132.  
  133. if(!capture.isOpened())
  134. {
  135. printf("Failed to open the videon");
  136.  
  137. return -1
  138. }
  139.  
  140. while(1)
  141. {
  142. Mat frame;
  143.  
  144. bool bSuccess = capture.read(frame); // read a new frame from video
  145.  
  146. if (!bSuccess) //if not success, break loop
  147. {
  148. cout << "can't read the frame from video file" << endl;
  149. break;
  150. }
  151.  
  152. imshow("display",frame);
  153. }
  154.  
  155. return 0;
  156. }
  157.  
  158. VideoCapture capture("//Home//cuda-workspace//DisplayVideo//video_1.avi");
  159.  
  160. if(!capture.isOpened())
  161. {
  162. return -1;
  163. }
  164.  
  165. namedWindow("display");
  166. Mat frame;
  167. while(1)
  168. {
  169. capture >> frame; // get a new frame from camera
  170. if (frame.empty()) //When it finish the video it breaks out of the cycle
  171. {
  172. break;
  173. }
  174. imshow("display",frame);
  175. waitKey(30); // This is for you can visualize the video,
  176. //otherwise the reading process is very fast
  177. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement