1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
// Lib2_Test.cpp : This file contains the 'main' function. Program execution begins and ends there.
#include <iostream>
#include <map>
#include <tuple>
#include <Lib2/Lib2.h>
#include <opencv2/core.hpp>
#include <opencv2/opencv.hpp>
//incomplete test
int main()
{
std::string dlib_model_path = "shape_predictor_68_face_landmarks.dat";
std::string eyenet_path = "eye_detector_4.jit";
Lib2 obj(dlib_model_path, eyenet_path);
std::map<std::string, bool> statuses{ {"me", true} };
std::vector<std::tuple<std::string, double>> ids = { {"me", 99.99} };
cv::VideoCapture cap;
int apiID = cv::CAP_ANY;
cap.open(0, apiID);
// check if we succeeded
if (!cap.isOpened())
{
std::cout << "ERROR! Unable to open camera\n";
return -1;
}
int i = 0;
cv::Mat frame_orig;
while (true)
{
cap.read(frame_orig);
if (frame_orig.empty())
{
std::cout << "ERROR! blank frame recieved\n";
break;
}
bool statuss = true;
auto d = 0.75f;
bool t = true;
std::string s = "me";
auto res = obj.Evaluate(statuss, s, d, frame_orig, frame_orig, t);
auto [status, name, is_valid] = res;
std::string stat_str;
switch (status)
{
case ValidationStatus::Invalidated:
stat_str = "invalidated";
break;
case ValidationStatus::UnderValidation:
stat_str = "UnderValidation";
break;
case ValidationStatus::Validated:
stat_str = "Validated";
break;
default:
stat_str = "Unknown status is recieved!";
break;
}
std::cout << name << " is " << stat_str << " is valid?: " << is_valid << std::endl;
std::cout << "****************" << std::endl;
cv::imshow("Lib2 test", frame_orig); //or frame
if (cv::waitKey(1) == 'q')
{
break;
}
}//end of while
// When everything is done, release the capture
cap.release();
cv::destroyAllWindows();
std::cout << "Bezar ro FACE na ORIGINAL IMAGE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
}