video.cpp
Go to the documentation of this file.
1 #include "peddetect.h"
2 
3 using namespace cv;
4 
5 int main(int, char**)
6 {
7  PVector vect;
8  vect.clear();
9 
10  Mat frame;
11  string folder_path="/media/Novo volume/bags_tese_results/teste_AtlasCar_outside/Rua_DETI_vir";
12 
13  path p = folder_path;
14 
15  try
16  {
17  if (exists(p)) // does p actually exist?
18  {
19 
20  if (is_directory(p)) // is p a directory?
21  {
22 
23  copy(directory_iterator(p), directory_iterator(), back_inserter(vect));
24 
25  }
26  else
27  cout << p << " is not a folder"<<endl;
28 
29  }
30 
31  }
32  catch (const filesystem_error& ex)
33  {
34  cout << ex.what() << '\n';
35  }
36 
37  sort(vect.begin(), vect.end() );
38 
39  frame=imread(vect[0].string(), CV_LOAD_IMAGE_COLOR);
40 
41  for(int i=0; i<vect.size(); i++)
42  {
43  cout<<vect[i]<<endl;
44  }
45 
46  cout<<vect.size()<<endl;
47  // record video
48  VideoWriter record("/media/Novo volume/bags_tese_results/videos/Rua_DETI_vir.avi", CV_FOURCC('D','I','V','X'), 16, frame.size(), true);
49  if( !record.isOpened() ) {
50  printf("VideoWriter failed to open!\n");
51  return -1;
52  }
53 
54  namedWindow("video",1);
55 
56  for(uint n=1; n<vect.size();n++)
57  {
58  // get a new frame from camera
59  string ImgPath=vect[n].string();
60  frame=imread(ImgPath, CV_LOAD_IMAGE_COLOR);
61 
62  // show frame on screen
63  imshow("video", frame);
64 
65  // add frame to recorded video
66  record << frame;
67 
68  if(waitKey(30) >= 0) break;
69  }
70 
71  // the camera will be deinitialized automatically in VideoCapture destructor
72  // the recorded video will be closed automatically in the VideoWriter destructor
73  return 0;
74 }
int main(int, char **)
Definition: video.cpp:5
vector< path > PVector
Definition: peddetect.h:92


multimodal_pedestrian_detect
Author(s): Rui Azevedo
autogenerated on Mon Mar 2 2015 01:32:27