From 563f465e2c3e90f9a8177adad05e8ea65fd60e66 Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Tue, 25 May 2021 15:46:53 +0200 Subject: [PATCH] [EDIT] remove unused methods --- src/computervision/ObjectDetection.cpp | 38 +------------------------- src/computervision/ObjectDetection.h | 15 ++-------- 2 files changed, 3 insertions(+), 50 deletions(-) diff --git a/src/computervision/ObjectDetection.cpp b/src/computervision/ObjectDetection.cpp index 62281c2..4e19f2c 100644 --- a/src/computervision/ObjectDetection.cpp +++ b/src/computervision/ObjectDetection.cpp @@ -36,42 +36,6 @@ namespace computervision return img; } - bool ObjectDetection::setup() - { - if (!cap.isOpened()) { - cout << "Can't find camera!" << endl; - return false; - } - - cap.read(frame); - frameOut = frame.clone(); - - skinDetector.drawSkinColorSampler(frameOut); - - foreground = backgroundRemover.getForeground(frame); - - faceDetector.removeFaces(frame, foreground); - handMask = skinDetector.getSkinMask(foreground); - fingerCountDebug = fingerCount.findFingersCount(handMask, frameOut); - - //backgroundRemover.calibrate(frame); - - - imshow("output", frameOut); - imshow("foreground", foreground); - imshow("handMask", handMask); - imshow("handDetection", fingerCountDebug); - - int key = waitKey(1); - - if (key == 98) // b - backgroundRemover.calibrate(frame); - else if (key == 115) // s - skinDetector.calibrate(frame); - - return true; - } - bool ObjectDetection::detectHand(Mat cameraFrame) { Mat inputFrame = generateHandMaskSquare(cameraFrame); @@ -104,7 +68,7 @@ namespace computervision else if (key == 115) // s skinDetector.calibrate(inputFrame); - return true; + return fingers_amount > 0; } void ObjectDetection::calculateDifference() diff --git a/src/computervision/ObjectDetection.h b/src/computervision/ObjectDetection.h index 941f49f..bddf4ba 100644 --- a/src/computervision/ObjectDetection.h +++ b/src/computervision/ObjectDetection.h @@ -22,13 +22,7 @@ namespace computervision * */ ObjectDetection(); - /** - * @brief Initializes the object detection, captures a frame and modifies it - * so it is ready to use for object detection - * - * @return return true if webcam is connected, returns false if it isn't - */ - bool setup(); + /** * @brief Displays an image of the current webcam-footage * @@ -40,11 +34,6 @@ namespace computervision * */ void calculateDifference(); - /** - * @brief Listens for keypresses and handles them - * - */ - void detect(); /** * @brief generates the square that will hold the mask in which the hand will be detected. @@ -65,7 +54,7 @@ namespace computervision * @brief detects a hand based on the given hand mask input frame. * * @param inputFrame the input frame from the camera - * @return true if the webcam is connected, false if not. + * @return true if hand is open, false if hand is closed */ bool detectHand(cv::Mat cameraFrame);