kNOw SIGN
handDetect.h
Go to the documentation of this file.
1 #include "opencv2/imgproc/imgproc.hpp"
2 #include "opencv2/imgproc/types_c.h"
3 #include "opencv2/highgui/highgui_c.h"
4 #include <opencv2/opencv.hpp>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <iostream>
8 #include <string>
9 #include "FrameGen.hpp"
10 #include "roi.hpp"
11 #include "InterHand.hpp"
12 #include <vector>
13 #include <cmath>
14 
15 
27 class handDetect{
28 
29  public:
30 
31  handDetect();
32 
33 
39  void init(FrameGen *m);
40 
41 
48  void waitForPalmCover(FrameGen* m);
49 
56  void average(FrameGen *m);
57 
64  void initTrackbars();
65 
71  void produceBinaries(FrameGen *m);
72 
78  cv::Mat crop(FrameGen *m, InterHand *hg);
79 
85  void makeContours(FrameGen *m, InterHand* hg);
86 
87  private:
88 
95  void col2origCol(int hsv[3], int bgr[3], cv::Mat src);
96 
103  void printText(cv::Mat src, std::string text);
104 
110  int getMedian(std::vector<int> val);
111 
117  void getAvgColor(FrameGen *m,My_ROI roi,int avg[3]);
118 
124  void normalizeColors(FrameGen * myImage);
125 
131  int findBiggestContour(std::vector<std::vector<cv::Point>> contours);
132 
133 
134 
135 };
void makeContours(FrameGen *m, InterHand *hg)
create contours for the hand from the incoming frame to get the hand location and detect the hand ...
Definition: handDetect.cpp:211
int findBiggestContour(std::vector< std::vector< cv::Point >> contours)
get the biggest contours and remove the cotours that do not represent hands
Definition: handDetect.cpp:189
handDetect()
constructor
Definition: handDetect.cpp:23
int getMedian(std::vector< int > val)
calculate the median value of the color averaging results
Definition: handDetect.cpp:77
void normalizeColors(FrameGen *myImage)
get the color boundries and normalize them to 0-255
Definition: handDetect.cpp:145
void waitForPalmCover(FrameGen *m)
specify the location of the calibration squares on the incoming frame and draw them ...
Definition: handDetect.cpp:48
Class to handle intermediate processing of the hand detection such as hand bounding rectangle and con...
Definition: InterHand.hpp:14
Class to detect the hand from a video stream using thresholding and contours.
Definition: handDetect.h:27
void initTrackbars()
create trackbars to be able to manually adjust the threshold if needed. To use the trackbars...
Definition: handDetect.cpp:128
void produceBinaries(FrameGen *m)
getting the lower and upper boundries of the hand color. the function calculate these boundries based...
Definition: handDetect.cpp:171
void col2origCol(int hsv[3], int bgr[3], cv::Mat src)
convert the frame color to the original color from two input color spaces
Definition: handDetect.cpp:32
std::vector< My_ROI > roi
Definition: handDetect.cpp:19
void getAvgColor(FrameGen *m, My_ROI roi, int avg[3])
aquire the average hand skin color from the calibration squares
Definition: handDetect.cpp:89
Class for video capturing from camera module. It takes the frames from the camera and passes it to ot...
Definition: FrameGen.hpp:14
cv::Mat crop(FrameGen *m, InterHand *hg)
crop the detected hand area of each frame and store it in Mat object to be fed to the inference model...
Definition: handDetect.cpp:200
void average(FrameGen *m)
calculate the final average color of the hand in hue lightness saturation space based on average skin...
Definition: handDetect.cpp:108
Class for drawing region of interest. The functions and variables of this class are used to draw regi...
Definition: roi.hpp:15
void init(FrameGen *m)
Function to take the initial video stream and specify the area of calibrartion squares.
Definition: handDetect.cpp:27
void printText(cv::Mat src, std::string text)
function to print text on the frame when needed
Definition: handDetect.cpp:43