[ADD] static skin treshold
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "BackgroundRemover.h"
|
||||
#include "SkinDetector.h"
|
||||
#include "FingerCount.h"
|
||||
#include "calibration/StaticSkinTreshold.h"
|
||||
namespace computervision
|
||||
{
|
||||
class HandDetectRegion
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
10
src/computervision/calibration/StaticSkinTreshold.h
Normal file
10
src/computervision/calibration/StaticSkinTreshold.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
namespace StaticSkinTreshold
|
||||
{
|
||||
static int hLowThreshold,
|
||||
hHighThreshold,
|
||||
sLowThreshold,
|
||||
sHighThreshold,
|
||||
vLowThreshold,
|
||||
vHighThreshold;
|
||||
};
|
||||
@@ -130,6 +130,7 @@ namespace scene
|
||||
{
|
||||
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS)
|
||||
{
|
||||
cv::destroyWindow("camera");
|
||||
return_value = scene::Scenes::STOP;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user