[ADD] hand detection type enum

This commit is contained in:
Sem van der Hoeven
2021-06-08 13:38:47 +02:00
parent 1e55736615
commit cadee7d8e9
6 changed files with 53 additions and 48 deletions

View File

@@ -1,7 +1,8 @@
#include "HandCalibrator.h"
#define MIN_HAND_SIZE 10000
#define MIN_MENU_HAND_SIZE 10000
#define MIN_GAME_HAND_SIZE 10000 // todo change
namespace computervision
{
namespace handcalibration
@@ -56,7 +57,7 @@ namespace computervision
fingers_amount = amount;
}
bool HandCalibrator::CheckIfHandPresent(cv::Mat input_image)
bool HandCalibrator::CheckIfHandPresent(cv::Mat input_image, HandDetectionType type)
{
std::vector<std::vector<cv::Point>> points;
cv::findContours(input_image, points, cv::RetrievalModes::RETR_LIST, cv::ContourApproximationModes::CHAIN_APPROX_SIMPLE);
@@ -66,7 +67,11 @@ namespace computervision
for (int p = 0; p < points.size(); p++)
{
int area = cv::contourArea(points[p]);
if (area > MIN_HAND_SIZE) return true;
if (type == handcalibration::HandDetectionType::MENU)
if (area > MIN_MENU_HAND_SIZE) return true;
if (type == handcalibration::HandDetectionType::GAME)
if (area > MIN_GAME_HAND_SIZE) return true;
}
return false;