Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. f (LOWORD(wParam) == IdMOD4 && lock == 0)
  2. {
  3. Mat imag;
  4. Mat imaggray;
  5. int countercolor = 0;
  6. int countergray = 0;
  7. CascadeClassifier face_cascade;
  8. std::vector<Rect> g;
  9. face_cascade.load("C:\\opencv\\sources\\data\\haarcascades\\haarcascade_frontalface_default.xml");
  10. if (face_cascade.empty())
  11. if (!face_cascade.load("C:\\opencv\\sources\\data\\haarcascades\\haarcascade_frontalface_default.xml"))
  12. {
  13. cerr << "Error Loading XML file" << endl;
  14. waitKey(0);
  15. return 0;
  16. }
  17.  
  18.  
  19. for (int i = 0; i < 1; ++i)
  20. {
  21.  
  22. string fill;
  23. string faccia = "Immagine";
  24. //MessageBox(NULL, _T("Scegli la cartella con i file"), _T(""), NULL);
  25. //fill = openfilename();
  26. faccia = faccia + to_string(i + 1);
  27. faccia = faccia + ".jpg";
  28. LPTSTR risultato = new TCHAR[faccia.size() + 1];
  29. strcpy(risultato, faccia.c_str());
  30. MessageBox(NULL, risultato, "Affirmation", MB_OK);
  31.  
  32. imag = imread(faccia, CV_LOAD_IMAGE_COLOR);
  33. //imshow("Faccia", imag);
  34.  
  35.  
  36.  
  37. cvtColor(imag, imaggray, CV_BGR2GRAY);
  38. equalizeHist(imaggray, imaggray);
  39.  
  40. face_cascade.detectMultiScale(imaggray, g, 1.1, 2, 0 | CV_HAAR_SCALE_IMAGE, Size(30, 30));
  41. size_t o = 1;
  42. if ((int)(g.size()) == (o))
  43. { //MessageBox(NULL, "Failed", "Affirmation", MB_OK);
  44. ++countergray;
  45.  
  46. }
  47.  
  48.  
  49. //per vedere se l'ha presa in input con imageread
  50.  
  51. //waitKey(4000);
  52.  
  53.  
  54.  
  55. }
  56. string tempp = "Rateo Successo con grigi: " + to_string(countergray) + "/100" + " \n " + " Rateo Successo con colori " + to_string(countercolor) + "/100";
  57. LPTSTR risultat = new TCHAR[tempp.size() + 1];
  58. strcpy(risultat, tempp.c_str());
  59. MessageBox(NULL, risultat, "Affirmation", MB_OK);
  60.  
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement