Main.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include <iostream>
  2. #include <QImage>
  3. #include <vector>
  4. #include <QString>
  5. #include "SLList.hpp"
  6. int main(int argc, char** argv)
  7. {
  8. if(argc!=4)
  9. {
  10. std::cout << "usage : " << argv[0] << " json1 json2 image" << std::endl;
  11. return EXIT_FAILURE;
  12. }
  13. std::string fichier1 = argv[1];
  14. std::string fichier2 = argv[2];
  15. SLList sll1(fichier1);
  16. SLList sll2(fichier2);
  17. QImage img(argv[3]);
  18. std::pair<double, int> resultat = SLList::distance(&sll1, &sll2, &img);
  19. std::cout << "( " << resultat.first << " , " << resultat.second << " )" << std::endl;
  20. /*std::string path="../officialTestDirectory/img";
  21. std::vector<std::string> numImg;
  22. std::vector<std::string> nomExpert;
  23. for(unsigned int i=1; i<10; i++)
  24. numImg.push_back(std::string("0").append(std::to_string(i)));
  25. for(unsigned int i=10; i<41; i++)
  26. numImg.push_back(std::to_string(i));
  27. nomExpert.push_back("algo");
  28. nomExpert.push_back("jing");
  29. nomExpert.push_back("rcozot");
  30. nomExpert.push_back("remiS");
  31. nomExpert.push_back("samuel");
  32. for(unsigned int i=0; i<numImg.size(); i++)
  33. {
  34. QImage img(std::string(path).append(numImg[i]).append(".jpg").c_str());
  35. SLList listA(std::string(path).append(numImg[i]).append("_").append(nomExpert[1]).append(".json"));
  36. SLList listB(std::string(path).append(numImg[i]).append("_").append(nomExpert[2]).append(".json"));
  37. SLList listC(std::string(path).append(numImg[i]).append("_").append(nomExpert[3]).append(".json"));
  38. SLList listD(std::string(path).append(numImg[i]).append("_").append(nomExpert[4]).append(".json"));
  39. std::pair<double, int> dAB = SLList::distance(&listA, &listB, &img);
  40. std::pair<double, int> dAC = SLList::distance(&listA, &listC, &img);
  41. std::pair<double, int> dAD = SLList::distance(&listA, &listD, &img);
  42. std::pair<double, int> dBC = SLList::distance(&listB, &listC, &img);
  43. std::pair<double, int> dBD = SLList::distance(&listB, &listD, &img);
  44. std::pair<double, int> dCD = SLList::distance(&listC, &listD, &img);
  45. std::cout << "--------" << numImg[i] << "--------" << std::endl;
  46. std::cout << "Score A - Jing : " << std::get<0>(dAB)+std::get<0>(dAC)+std::get<0>(dAD) << std::endl;
  47. std::cout << "Score B - rcozot : " << std::get<0>(dAB)+std::get<0>(dBC)+std::get<0>(dBD) << std::endl;
  48. std::cout << "Score C - remiS : " << std::get<0>(dAC)+std::get<0>(dBC)+std::get<0>(dCD) << std::endl;
  49. std::cout << "Score D - samuel : " << std::get<0>(dAD)+std::get<0>(dBD)+std::get<0>(dCD) << std::endl;
  50. std::cout << std::endl << std::endl << std::endl;
  51. }*/
  52. }