From 81dec3b9f4c27845b9bfedbc9c57cff52e90ae1b Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Fri, 4 Jun 2021 13:10:11 +0200 Subject: [PATCH] [ADD] detecting if hand is in square --- src/computervision/HandPresentChecker.cpp | 18 ++++++++++++++++++ src/computervision/HandPresentChecker.h | 7 +++++++ 2 files changed, 25 insertions(+) create mode 100644 src/computervision/HandPresentChecker.cpp create mode 100644 src/computervision/HandPresentChecker.h diff --git a/src/computervision/HandPresentChecker.cpp b/src/computervision/HandPresentChecker.cpp new file mode 100644 index 0000000..2cb4784 --- /dev/null +++ b/src/computervision/HandPresentChecker.cpp @@ -0,0 +1,18 @@ +#include "HandPresentChecker.h" +#include +#include + + +namespace computervision +{ + bool check_if_hand_present(cv::Mat inputImage) + { + std::vector> points; + cv::Mat imgCont; + cv::findContours(inputImage, points, cv::RetrievalModes::RETR_LIST, cv::ContourApproximationModes::CHAIN_APPROX_SIMPLE); + bool hand_present = points.size() > 0; + std::cout << (hand_present ? "hey a hand!" : "damn no hand") << std::endl; + return hand_present; + } + +} diff --git a/src/computervision/HandPresentChecker.h b/src/computervision/HandPresentChecker.h new file mode 100644 index 0000000..5f0b0b7 --- /dev/null +++ b/src/computervision/HandPresentChecker.h @@ -0,0 +1,7 @@ +#pragma once + +#include +namespace computervision +{ + bool check_if_hand_present(cv::Mat inputImage); +}