[ADD] comments

This commit is contained in:
Sem van der Hoeven
2021-06-18 11:11:56 +02:00
parent b446a366fb
commit 982f787d44
4 changed files with 13 additions and 43 deletions

View File

@@ -63,6 +63,7 @@ namespace computervision
} }
// uncomment these lines to show debug hand information
//imshow("output" + region_id, frame_out); //imshow("output" + region_id, frame_out);
//imshow("foreground" + region_id, foreground); //imshow("foreground" + region_id, foreground);
//imshow("handMask" + region_id, handMask); //imshow("handMask" + region_id, handMask);

View File

@@ -1,15 +1,5 @@
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/video.hpp>
#include <GLFW/glfw3.h>
#include "object_detection.h" #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 #define TIME_DURATION 1.0f
@@ -127,6 +117,7 @@ namespace computervision
} }
imshow("camera", camera_frame); imshow("camera", camera_frame);
// uncomment these lines to show debug hand information
/*imshow("output", frame_out); /*imshow("output", frame_out);
imshow("foreground", foreground); imshow("foreground", foreground);
imshow("handMask", handMask); imshow("handMask", handMask);
@@ -136,22 +127,6 @@ namespace computervision
hand_calibrator.SetHandPresent(hand_present); 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; return fingers_amount > 0;
} }

View File

@@ -8,6 +8,14 @@
#include <opencv2/core.hpp> #include <opencv2/core.hpp>
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
#include <opencv2/video.hpp>
#include <GLFW/glfw3.h>
#include "background_remover.h"
#include "skin_detector.h"
#include "finger_count.h"
#include "async/StaticCameraInstance.h"
#include "calibration/HandCalibrator.h"
namespace computervision namespace computervision

View File

@@ -144,7 +144,7 @@ namespace scene
// load the first few house models // load the first few house models
for (int i = 0; i <= UPCOMING_MODEL_AMOUNT; i++) 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 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 we have passed a model, load a new one and delete the one behind us
if (last_model_pos != model_pos) if (last_model_pos != model_pos)
{ {
load_chunk(model_pos + UPCOMING_MODEL_AMOUNT); LoadChunk(model_pos + UPCOMING_MODEL_AMOUNT);
score += furniture_count_old; score += furniture_count_old;
std::cout << "Score: " << score << std::endl; std::cout << "Score: " << score << std::endl;
std::cout << "Furniture_count_old in model (house excluded): " << furniture_count_old << 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; 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<int> tresholds = reg_left.CalculateSkinTresholds();
reg_right.setSkinTresholds(tresholds);
reg_up.setSkinTresholds(tresholds);
}
} }
void scene::In_Game_Scene::update_hand_detection() void scene::In_Game_Scene::update_hand_detection()
@@ -351,7 +337,7 @@ namespace scene
for (int i = digits.size() - 1; i >= 0; i--) 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); render_engine::renderer::Render(score_textures[digits[i]], *gui_shader);
} }