Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f (LOWORD(wParam) == IdMOD4 && lock == 0)
- {
- Mat imag;
- Mat imaggray;
- int countercolor = 0;
- int countergray = 0;
- CascadeClassifier face_cascade;
- std::vector<Rect> g;
- face_cascade.load("C:\\opencv\\sources\\data\\haarcascades\\haarcascade_frontalface_default.xml");
- if (face_cascade.empty())
- if (!face_cascade.load("C:\\opencv\\sources\\data\\haarcascades\\haarcascade_frontalface_default.xml"))
- {
- cerr << "Error Loading XML file" << endl;
- waitKey(0);
- return 0;
- }
- for (int i = 0; i < 1; ++i)
- {
- string fill;
- string faccia = "Immagine";
- //MessageBox(NULL, _T("Scegli la cartella con i file"), _T(""), NULL);
- //fill = openfilename();
- faccia = faccia + to_string(i + 1);
- faccia = faccia + ".jpg";
- LPTSTR risultato = new TCHAR[faccia.size() + 1];
- strcpy(risultato, faccia.c_str());
- MessageBox(NULL, risultato, "Affirmation", MB_OK);
- imag = imread(faccia, CV_LOAD_IMAGE_COLOR);
- //imshow("Faccia", imag);
- cvtColor(imag, imaggray, CV_BGR2GRAY);
- equalizeHist(imaggray, imaggray);
- face_cascade.detectMultiScale(imaggray, g, 1.1, 2, 0 | CV_HAAR_SCALE_IMAGE, Size(30, 30));
- size_t o = 1;
- if ((int)(g.size()) == (o))
- { //MessageBox(NULL, "Failed", "Affirmation", MB_OK);
- ++countergray;
- }
- //per vedere se l'ha presa in input con imageread
- //waitKey(4000);
- }
- string tempp = "Rateo Successo con grigi: " + to_string(countergray) + "/100" + " \n " + " Rateo Successo con colori " + to_string(countercolor) + "/100";
- LPTSTR risultat = new TCHAR[tempp.size() + 1];
- strcpy(risultat, tempp.c_str());
- MessageBox(NULL, risultat, "Affirmation", MB_OK);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement