From 9b3362dd8bf6e64bf6dd682cbfe11e6396ba1310 Mon Sep 17 00:00:00 2001 From: Epicalert Date: Tue, 12 Jan 2021 22:24:02 +0800 Subject: [PATCH] Clean up directory structure --- CMakeLists.txt | 7 +++++++ .../haarcascade_frontalface_alt2.xml | 0 lbfmodel.yaml => cvdata/lbfmodel.yaml | 0 face-eyes.png => models/test/face-eyes.png | Bin .../test/face-mouth-closed.png | Bin .../test/face-mouth-open.png | Bin head-base.png => models/test/head-base.png | Bin src/cv.cpp | 4 ++-- src/graphics.cpp | 8 ++++---- 9 files changed, 13 insertions(+), 6 deletions(-) rename haarcascade_frontalface_alt2.xml => cvdata/haarcascade_frontalface_alt2.xml (100%) rename lbfmodel.yaml => cvdata/lbfmodel.yaml (100%) rename face-eyes.png => models/test/face-eyes.png (100%) rename face-mouth-closed.png => models/test/face-mouth-closed.png (100%) rename face-mouth-open.png => models/test/face-mouth-open.png (100%) rename head-base.png => models/test/head-base.png (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 21a579a..6ea5125 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,13 @@ include_directories( ${GLEW_INCLUDE_DIRS} ) include_directories( ${GLM_INCLUDE_DIRS} ) include_directories( ${GLUT_INCLUDE_DIR} ) include_directories( ${PROJECT_SOURCE_DIR}/src ) +file( + COPY + ${PROJECT_SOURCE_DIR}/models + ${PROJECT_SOURCE_DIR}/cvdata + + DESTINATION + ${PROJECT_BINARY_DIR} ) add_executable( fc2d src/main.cpp src/graphics.cpp src/modelpart.cpp src/cv.cpp ) target_link_libraries( fc2d ${OpenCV_LIBS} ${OPENGL_LIBRARIES} FreeGLUT::freeglut GLEW::glew ) set( CMAKE_BUILD_TYPE Debug ) diff --git a/haarcascade_frontalface_alt2.xml b/cvdata/haarcascade_frontalface_alt2.xml similarity index 100% rename from haarcascade_frontalface_alt2.xml rename to cvdata/haarcascade_frontalface_alt2.xml diff --git a/lbfmodel.yaml b/cvdata/lbfmodel.yaml similarity index 100% rename from lbfmodel.yaml rename to cvdata/lbfmodel.yaml diff --git a/face-eyes.png b/models/test/face-eyes.png similarity index 100% rename from face-eyes.png rename to models/test/face-eyes.png diff --git a/face-mouth-closed.png b/models/test/face-mouth-closed.png similarity index 100% rename from face-mouth-closed.png rename to models/test/face-mouth-closed.png diff --git a/face-mouth-open.png b/models/test/face-mouth-open.png similarity index 100% rename from face-mouth-open.png rename to models/test/face-mouth-open.png diff --git a/head-base.png b/models/test/head-base.png similarity index 100% rename from head-base.png rename to models/test/head-base.png diff --git a/src/cv.cpp b/src/cv.cpp index 03b8c27..18cbfea 100644 --- a/src/cv.cpp +++ b/src/cv.cpp @@ -10,10 +10,10 @@ cv::Mat frame, gray, small; void initCV() { //TODO: switch to DNN face detection - faceDetector = cv::CascadeClassifier ("haarcascade_frontalface_alt2.xml"); + faceDetector = cv::CascadeClassifier ("cvdata/haarcascade_frontalface_alt2.xml"); facemark = cv::face::FacemarkLBF::create(); - facemark->loadModel ("lbfmodel.yaml"); + facemark->loadModel ("cvdata/lbfmodel.yaml"); vid = cv::VideoCapture (0); } diff --git a/src/graphics.cpp b/src/graphics.cpp index 588ff9b..2e18330 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -78,10 +78,10 @@ void initGraphics () { initShader(); - parts[0] = ModelPart("head-base.png", transUniform); - parts[1] = ModelPart("face-eyes.png", transUniform); - parts[2] = ModelPart("face-mouth-closed.png", transUniform); - parts[2].addTexture("face-mouth-open.png", 1); + parts[0] = ModelPart("models/test/head-base.png", transUniform); + parts[1] = ModelPart("models/test/face-eyes.png", transUniform); + parts[2] = ModelPart("models/test/face-mouth-closed.png", transUniform); + parts[2].addTexture("models/test/face-mouth-open.png", 1); //enable blending for alpha textures glEnable(GL_BLEND);