2018-05-25 16:41:26 +00:00
|
|
|
#ifndef MAIN_CODE_H_INCLUDED
|
|
|
|
#define MAIN_CODE_H_INCLUDED
|
|
|
|
|
|
|
|
#ifdef TARGET_ANDROID
|
|
|
|
#include "android_api.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TARGET_WIN32
|
|
|
|
#define NOMINMAX 1
|
|
|
|
#include <Windows.h>
|
|
|
|
#undef NOMINMAX
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include "boost/shared_ptr.hpp"
|
|
|
|
#include "boost/thread/thread.hpp"
|
|
|
|
#include "boost/assign.hpp"
|
|
|
|
#include "boost/bind.hpp"
|
|
|
|
|
|
|
|
#include "include/Engine.h"
|
|
|
|
|
|
|
|
#include "boost/signals2.hpp"//Signal must be included after asio
|
|
|
|
|
|
|
|
#include "../windows/DoubleHitBalls-win/DoubleHitBalls-win/FaceLandmarkDetector.h"
|
|
|
|
#include "../windows/DoubleHitBalls-win/DoubleHitBalls-win/ValueSmoother.h"
|
|
|
|
|
|
|
|
|
|
|
|
struct FaceStruct
|
|
|
|
{
|
|
|
|
SE::Vector2f center;
|
|
|
|
SE::Vector2f size;
|
|
|
|
|
|
|
|
std::array<SE::Vector2f, LANDMARK_POINT_COUNT> preds;
|
|
|
|
|
|
|
|
std::vector<cv::Point3f> modelPoints;
|
|
|
|
cv::Mat rotationVector;
|
|
|
|
cv::Mat translationVector;
|
|
|
|
cv::Mat rotationMatrix;
|
|
|
|
cv::Mat poseMatrix;
|
|
|
|
cv::Mat eulerAngles;
|
|
|
|
|
|
|
|
std::vector<cv::Point3d> boxModelSrc;
|
|
|
|
std::vector<cv::Point2d> boxModelDst;
|
|
|
|
|
2018-06-01 18:09:53 +00:00
|
|
|
ValueSmoother landmarkSmoothers[2 * LANDMARK_POINT_COUNT];
|
2018-05-25 16:41:26 +00:00
|
|
|
ValueSmoother rotationVectorSmoothers[3];
|
|
|
|
ValueSmoother translationVectorSmoothers[3];
|
|
|
|
|
|
|
|
FaceStruct();
|
|
|
|
FaceStruct(const std::array<cv::Point2f, LANDMARK_POINT_COUNT>& fromPreds, cv::Mat& cameraMatrix, cv::Mat& distortionCoefficients);
|
|
|
|
|
2018-06-04 03:24:21 +00:00
|
|
|
void CalcFromPreds(bool noticeablyChanged, cv::Mat& cameraMatrix, cv::Mat& distortionCoefficients);
|
|
|
|
void ApplyPreds(const std::array<cv::Point2f, LANDMARK_POINT_COUNT>& fromPred, bool noticeablyChanged, cv::Mat& cameraMatrix, cv::Mat& distortionCoefficientss);
|
2018-05-25 16:41:26 +00:00
|
|
|
void InnerApplyPreds(const std::array<cv::Point2f, LANDMARK_POINT_COUNT>& fromPreds);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using namespace SE;
|
|
|
|
|
|
|
|
extern const std::string CONST_LOADING_BACKGROUND_BLACK;
|
|
|
|
|
|
|
|
class TMyApplication : public TApplication
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool Inited;
|
|
|
|
|
|
|
|
std::array<TRenderPair, MAX_FACE_COUNT> faceRenderPair;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
TMyApplication() : TApplication(), Inited(false) { }
|
|
|
|
|
|
|
|
virtual void InnerInit();
|
|
|
|
|
|
|
|
virtual void InnerDeinit();
|
|
|
|
|
|
|
|
virtual void InnerDraw();
|
|
|
|
|
|
|
|
virtual void InnerUpdate(size_t dt);
|
|
|
|
|
|
|
|
bool IsInited();
|
|
|
|
|
|
|
|
virtual void InnerOnTapDown(Vector2f p);
|
|
|
|
|
|
|
|
virtual void InnerOnTapUp(Vector2f p);
|
|
|
|
|
|
|
|
virtual void InnerOnTapUpAfterMove(Vector2f p);
|
|
|
|
|
|
|
|
virtual void InnerOnMove(Vector2f p, Vector2f shift);
|
|
|
|
|
|
|
|
virtual void OnFling(Vector2f v);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
extern TMyApplication* Application;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|