PageRenderTime 56ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/VideoLoad/main.cpp

https://github.com/straiki/VisionCup-Deep-Team
C++ | 118 lines | 58 code | 34 blank | 26 comment | 9 complexity | c339e2a98d943a45882a1ce90b3ca952 MD5 | raw file
  1. #include "MYdetektor.h"
  2. #include "MYdisplay.h"
  3. #include "MYvideo.h"
  4. #include <iostream>
  5. #include <vector>
  6. // cesta pocet_obliceju parametry ...
  7. int main( int argc, char** argv )
  8. {
  9. MYdetektor *detect;
  10. cout << "PRO DALSI SNIMEK STISTKNI KLAVESU q" << endl;
  11. MYvideo *video;
  12. video = new MYvideo();
  13. video->open(argv[1]);
  14. video->writeInit();
  15. int counter = 0 ;
  16. detect = new MYdetektor(NULL); // zpracuj frame
  17. double tta = (double)cvGetTickCount();
  18. MYoblicej *pre_ksicht=NULL;
  19. MYoblicej *ksicht;
  20. for(;;){
  21. IplImage *image = video->next_frame();
  22. if( image == NULL) break;//Pri nacteni prazdneho FRAMU == konec videa
  23. //Zpracovani snimku
  24. detect->setFrame(image);
  25. double tt = (double)cvGetTickCount();
  26. if(counter >= 0){
  27. // detect->FindFaces();
  28. // detect->DrawSezOblic();
  29. detect->FindFaces();
  30. // pokud nenajde face nic nevykresli
  31. if(!detect->sX.empty()){
  32. //! Vyprazdnit seznam kdyz si neco vyzvednu
  33. int k = 0;
  34. int x = 0;
  35. while(!detect->sX.empty()){
  36. if(x >= atoi(argv[2])){
  37. detect->sX.clear();
  38. break;
  39. }
  40. ksicht = new MYoblicej(detect->sX.at(k).rFace,detect->sX.at(k).eye1,detect->sX.at(k).eye2);
  41. //stabilizace
  42. ksicht->ber_v_uvahu(pre_ksicht);
  43. //Popnuti ze seznamu!
  44. detect->sX.pop_front();
  45. // ksicht->DrawVodiciObdel(image);
  46. // ksicht->DrawHighPoints(image);
  47. for(int i=3; i<argc; i++){
  48. ksicht->DrawOblicej(image, atoi(argv[i]));
  49. }
  50. x++;
  51. delete pre_ksicht;
  52. pre_ksicht = ksicht;
  53. }
  54. // ksicht->ber_v_uvahu(pre_ksicht);
  55. //detect->sX.clear();
  56. //ksicht->DrawOblicej(image);
  57. //MYdisplay::ShowImage(image,(char)-1);
  58. }
  59. // while(facec !epmt){ Myoblice(display->nextface);
  60. //
  61. // v
  62. // }
  63. }
  64. tt = (double)cvGetTickCount() - tt;
  65. cout << tt/(cvGetTickFrequency()*1000.) << " ms" << endl;
  66. char c = cvWaitKey(33);
  67. if(c == 27) break;
  68. video->writeFrame(image);
  69. cout << endl << counter << " - takovy snimek" << endl;
  70. counter++;
  71. }
  72. tta = (double)cvGetTickCount() - tta;
  73. cout << tta/(cvGetTickFrequency()*1000.) << " -- CELKOVY CAS ms" << endl;
  74. // detect.DrawSezOblic();
  75. //img = cvLoadImage("test/1.jpg");
  76. // detect.setFrame(img);
  77. // detect.DrawFaces();
  78. // Release the image
  79. // cvReleaseImage(&image);
  80. // Destroy the window previously created with filename: "result"
  81. cvDestroyWindow("result");
  82. // return 0 to indicate successfull execution of the program
  83. return 0;
  84. }