From 982f787d446f320d1a8412522c1696413b53d2d5 Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Fri, 18 Jun 2021 11:11:56 +0200 Subject: [PATCH] [ADD] comments --- src/computervision/hand_detect_region.cpp | 1 + src/computervision/object_detection.cpp | 27 +---------------------- src/computervision/object_detection.h | 8 +++++++ src/scenes/in_Game_Scene.cpp | 20 +++-------------- 4 files changed, 13 insertions(+), 43 deletions(-) diff --git a/src/computervision/hand_detect_region.cpp b/src/computervision/hand_detect_region.cpp index d17ddb5..5022d99 100644 --- a/src/computervision/hand_detect_region.cpp +++ b/src/computervision/hand_detect_region.cpp @@ -63,6 +63,7 @@ namespace computervision } + // uncomment these lines to show debug hand information //imshow("output" + region_id, frame_out); //imshow("foreground" + region_id, foreground); //imshow("handMask" + region_id, handMask); diff --git a/src/computervision/object_detection.cpp b/src/computervision/object_detection.cpp index f52fc43..ea3c13f 100644 --- a/src/computervision/object_detection.cpp +++ b/src/computervision/object_detection.cpp @@ -1,15 +1,5 @@ -#include -#include -#include -#include - #include "object_detection.h" -#include "background_remover.h" -#include "skin_detector.h" -#include "finger_count.h" -#include "async/StaticCameraInstance.h" -#include "calibration/HandCalibrator.h" #define TIME_DURATION 1.0f @@ -127,6 +117,7 @@ namespace computervision } imshow("camera", camera_frame); + // uncomment these lines to show debug hand information /*imshow("output", frame_out); imshow("foreground", foreground); imshow("handMask", handMask); @@ -136,22 +127,6 @@ namespace computervision hand_calibrator.SetHandPresent(hand_present); - - int key = waitKey(1); - - if (key == 98) // b, calibrate the background - { - background_remover.calibrate(input_frame); - hand_calibrator.SetBackGroundCalibrated(true); - } - else if (key == 115) // s, calibrate the skin color - { - skin_detector.calibrate(input_frame); - hand_calibrator.SetSkinCalibration(true); - - } - - return fingers_amount > 0; } diff --git a/src/computervision/object_detection.h b/src/computervision/object_detection.h index 8c26660..4cf76d6 100644 --- a/src/computervision/object_detection.h +++ b/src/computervision/object_detection.h @@ -8,6 +8,14 @@ #include #include #include +#include +#include + +#include "background_remover.h" +#include "skin_detector.h" +#include "finger_count.h" +#include "async/StaticCameraInstance.h" +#include "calibration/HandCalibrator.h" namespace computervision diff --git a/src/scenes/in_Game_Scene.cpp b/src/scenes/in_Game_Scene.cpp index 4542720..1b43566 100644 --- a/src/scenes/in_Game_Scene.cpp +++ b/src/scenes/in_Game_Scene.cpp @@ -144,7 +144,7 @@ namespace scene // load the first few house models for (int i = 0; i <= UPCOMING_MODEL_AMOUNT; i++) { - load_chunk(i); + LoadChunk(i); } lights.push_back(entities::Light(glm::vec3(0, 1000, 7000), glm::vec3(5, 5, 5))); // sun @@ -266,7 +266,7 @@ namespace scene // if we have passed a model, load a new one and delete the one behind us if (last_model_pos != model_pos) { - load_chunk(model_pos + UPCOMING_MODEL_AMOUNT); + LoadChunk(model_pos + UPCOMING_MODEL_AMOUNT); score += furniture_count_old; std::cout << "Score: " << score << std::endl; std::cout << "Furniture_count_old in model (house excluded): " << furniture_count_old << std::endl; @@ -297,20 +297,6 @@ namespace scene { game_state = scene::Game_State::RUNNING; } - - if (glfwGetKey(window, GLFW_KEY_B) == GLFW_PRESS) - { - reg_left.CalibrateBackground(); - reg_right.CalibrateBackground(); - reg_up.CalibrateBackground(); - } - - if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS) - { - std::vector tresholds = reg_left.CalculateSkinTresholds(); - reg_right.setSkinTresholds(tresholds); - reg_up.setSkinTresholds(tresholds); - } } void scene::In_Game_Scene::update_hand_detection() @@ -351,7 +337,7 @@ namespace scene for (int i = digits.size() - 1; i >= 0; i--) { - score_textures[digits[i]].get()->position.x = 0.15 * i - 0.9; + score_textures[digits[i]].get()->position.x = 0.15 * i - 0.9; // place the number at the top left. the numbers are just fine tuned to get the position just right render_engine::renderer::Render(score_textures[digits[i]], *gui_shader); }