From acf24cab365ace0f08ee092e85364b94c50fa41d Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Fri, 21 May 2021 14:56:45 +0200 Subject: [PATCH] [ADD] comments to skindetector --- src/computervision/SkinDetector.h | 38 +++++++++++++++++++++++++++++-- src/main.cpp | 1 + 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/computervision/SkinDetector.h b/src/computervision/SkinDetector.h index d4e0cac..13d6ecc 100644 --- a/src/computervision/SkinDetector.h +++ b/src/computervision/SkinDetector.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include @@ -17,8 +17,26 @@ namespace computervision public: SkinDetector(void); + /* + * @brief draws the positions in where the skin color will be sampled. + * + * @param input the input matrix to sample the skin color from + */ void drawSkinColorSampler(Mat input); + + /* + * @brief calibrates the skin color detector with the given input frame + * + * @param input the input frame to calibrate from + */ void calibrate(Mat input); + + /* + * @brief gets the mask for the hand + * + * @param input the input matrix to get the skin mask from + * @returns the skin mask in a new matrix + */ Mat getSkinMask(Mat input); private: @@ -31,9 +49,25 @@ namespace computervision bool calibrated = false; + // rectangles that get drawn to show where the skin color will be sampled Rect skinColorSamplerRectangle1, skinColorSamplerRectangle2; + /* + * @brief calculates the skin tresholds for the given samples + * + * @param sample1 the first sample + * @param sample2 the second sample + */ void calculateThresholds(Mat sample1, Mat sample2); - void performOpening(Mat binaryImage, int structuralElementShapde, Point structuralElementSize); + + /** + * @brief the opening. it generates the structuring element and performs the morphological transformations required to detect the hand. + * This needs to be done to get the skin mask. + * + * @param binaryImage the matrix to perform the opening on. This needs to be a binary image, so consisting of only 1's and 0's. + * @param structuralElementShape the shape to use for the kernel that is used with generating the structuring element + * @param structuralElementSize the size of the kernel that will be used with generating the structuring element. + */ + void performOpening(Mat binaryImage, int structuralElementShape, Point structuralElementSize); }; } \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index eec04b7..38a8faf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -57,6 +57,7 @@ int main(void) entities::Camera camera(glm::vec3(0, 0, 0), glm::vec3(0, 0, 0)); + // create object detection object instance computervision::ObjectDetection objDetect;