From 8720e50ba82227f67a2b3d03799eb4601517e96d Mon Sep 17 00:00:00 2001 From: Jasper Date: Fri, 21 May 2021 15:10:05 +0200 Subject: [PATCH] [ADD] added comments to the classes FaceDetector and ObjectDetection --- src/computervision/FaceDetector.h | 10 ++++++++++ src/computervision/ObjectDetection.cpp | 11 +++-------- src/computervision/ObjectDetection.h | 24 +++++++++++++++++++++++- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/computervision/FaceDetector.h b/src/computervision/FaceDetector.h index 690a29e..208e051 100644 --- a/src/computervision/FaceDetector.h +++ b/src/computervision/FaceDetector.h @@ -15,7 +15,17 @@ namespace computervision { class FaceDetector { public: + /** + * @brief Constructor for the class FaceDetector, loads training data from a file + * + */ FaceDetector(void); + /** + * @brief Detects faces on an image and blocks them with a black rectangle + * + * @param input Input image + * @param output Output image + */ void removeFaces(Mat input, Mat output); }; } \ No newline at end of file diff --git a/src/computervision/ObjectDetection.cpp b/src/computervision/ObjectDetection.cpp index 0781a87..5f16929 100644 --- a/src/computervision/ObjectDetection.cpp +++ b/src/computervision/ObjectDetection.cpp @@ -58,11 +58,6 @@ namespace computervision return true; } - void ObjectDetection::readWebcam() - { - cap.read(img); - } - void ObjectDetection::calculateDifference() { cap.read(img); @@ -79,11 +74,11 @@ namespace computervision void ObjectDetection::detect() { - - int key = waitKey(1); - if (key == 115) + if (key == 98) // b + backgroundRemover.calibrate(frame); + else if (key == 115) // s skinDetector.calibrate(frame); } diff --git a/src/computervision/ObjectDetection.h b/src/computervision/ObjectDetection.h index e57cadf..4344ed7 100644 --- a/src/computervision/ObjectDetection.h +++ b/src/computervision/ObjectDetection.h @@ -17,11 +17,33 @@ namespace computervision private: public: + /** + * @brief default constructor of ObjectDetection + * + */ 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(); - void readWebcam(); + /** + * @brief Displays an image of the current webcam-footage + * + */ void showWebcam(); + /** + * @brief Calculates the difference between two images + * and outputs an image that only shows the difference + * + */ void calculateDifference(); + /** + * @brief Listens for keypresses and handles them + * + */ void detect(); };