[ADD] static skin treshold

This commit is contained in:
Sem van der Hoeven
2021-06-08 15:35:03 +02:00
parent 27594d466b
commit 88252f4dc8
5 changed files with 24 additions and 3 deletions

View File

@@ -34,7 +34,7 @@ namespace computervision
//imshow("output" + region_id, frame_out);
//imshow("foreground" + region_id, foreground);
imshow("handMask" + region_id, handMask);
//imshow("handMask" + region_id, handMask);
/*imshow("handDetection", fingerCountDebug);*/
hand_present = hand_calibrator.CheckIfHandPresent(handMask,handcalibration::HandDetectionType::GAME);
@@ -47,6 +47,8 @@ namespace computervision
hand_calibrator.DrawBackgroundSkinCalibrated(camera_frame);
}
cv::Mat HandDetectRegion::GenerateHandMaskSquare(cv::Mat img)

View File

@@ -7,6 +7,7 @@
#include "BackgroundRemover.h"
#include "SkinDetector.h"
#include "FingerCount.h"
#include "calibration/StaticSkinTreshold.h"
namespace computervision
{
class HandDetectRegion

View File

@@ -10,6 +10,8 @@
#include "async/StaticCameraInstance.h"
#include "calibration/HandCalibrator.h"
#include "calibration/StaticSkinTreshold.h"
namespace computervision
{
@@ -63,7 +65,6 @@ namespace computervision
// draw the hand rectangle on the camera input, and draw text showing if the hand is open or closed.
DrawHandMask(&camera_frame);
hand_calibrator.SetAmountOfFingers(fingers_amount);
finger_count.DrawHandContours(camera_frame);
hand_calibrator.DrawHandCalibrationText(camera_frame);
@@ -88,7 +89,13 @@ namespace computervision
}
else if (key == 115) // s, calibrate the skin color
{
skin_detector.calibrate(input_frame);
std::vector<int> treshold = skin_detector.calibrateAndReturn(input_frame);
StaticSkinTreshold::hLowThreshold = treshold[0];
StaticSkinTreshold::hHighThreshold = treshold[1];
StaticSkinTreshold::sLowThreshold = treshold[2];
StaticSkinTreshold::sHighThreshold = treshold[3];
StaticSkinTreshold::vLowThreshold = treshold[4];
StaticSkinTreshold::vHighThreshold = treshold[5];
hand_calibrator.SetSkinCalibration(true);
}

View File

@@ -0,0 +1,10 @@
#pragma once
namespace StaticSkinTreshold
{
static int hLowThreshold,
hHighThreshold,
sLowThreshold,
sHighThreshold,
vLowThreshold,
vHighThreshold;
};

View File

@@ -130,6 +130,7 @@ namespace scene
{
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS)
{
cv::destroyWindow("camera");
return_value = scene::Scenes::STOP;
}