kNOw SIGN
|
Class to detect the hand from a video stream using thresholding and contours. More...
#include <handDetect.h>
Public Member Functions | |
handDetect () | |
constructor More... | |
void | init (FrameGen *m) |
Function to take the initial video stream and specify the area of calibrartion squares. More... | |
void | waitForPalmCover (FrameGen *m) |
specify the location of the calibration squares on the incoming frame and draw them More... | |
void | average (FrameGen *m) |
calculate the final average color of the hand in hue lightness saturation space based on average skin color from the calibration squares to find the threshold and detect the hand. More... | |
void | initTrackbars () |
create trackbars to be able to manually adjust the threshold if needed. To use the trackbars, umcomment the function in the main file. More... | |
void | produceBinaries (FrameGen *m) |
getting the lower and upper boundries of the hand color. the function calculate these boundries based on the average color from the calibration squares after normalization and then perform median Blur to remove the noise More... | |
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 More... | |
void | makeContours (FrameGen *m, InterHand *hg) |
create contours for the hand from the incoming frame to get the hand location and detect the hand More... | |
Private Member Functions | |
void | col2origCol (int hsv[3], int bgr[3], cv::Mat src) |
convert the frame color to the original color from two input color spaces More... | |
void | printText (cv::Mat src, std::string text) |
function to print text on the frame when needed More... | |
int | getMedian (std::vector< int > val) |
calculate the median value of the color averaging results More... | |
void | getAvgColor (FrameGen *m, My_ROI roi, int avg[3]) |
aquire the average hand skin color from the calibration squares More... | |
void | normalizeColors (FrameGen *myImage) |
get the color boundries and normalize them to 0-255 More... | |
int | findBiggestContour (std::vector< std::vector< cv::Point >> contours) |
get the biggest contours and remove the cotours that do not represent hands More... | |
Class to detect the hand from a video stream using thresholding and contours.
Firstly, the skin color is sampled through several squares in the frame in different locations. Next, the average of these samples is taken and the resulting values are transformed into HLS. After that, contours are calculated and the biggest contour is considered as the hand. The hand area is then calculated and the cropped to be fed to the inference core.
handDetect::handDetect | ( | ) |
constructor
void handDetect::average | ( | FrameGen * | m | ) |
calculate the final average color of the hand in hue lightness saturation space based on average skin color from the calibration squares to find the threshold and detect the hand.
|
private |
convert the frame color to the original color from two input color spaces
crop the detected hand area of each frame and store it in Mat object to be fed to the inference model
|
private |
get the biggest contours and remove the cotours that do not represent hands
aquire the average hand skin color from the calibration squares
|
private |
calculate the median value of the color averaging results
void handDetect::init | ( | FrameGen * | m | ) |
Function to take the initial video stream and specify the area of calibrartion squares.
void handDetect::initTrackbars | ( | ) |
create trackbars to be able to manually adjust the threshold if needed. To use the trackbars, umcomment the function in the main file.
create contours for the hand from the incoming frame to get the hand location and detect the hand
|
private |
get the color boundries and normalize them to 0-255
|
private |
function to print text on the frame when needed
void handDetect::produceBinaries | ( | FrameGen * | m | ) |
getting the lower and upper boundries of the hand color. the function calculate these boundries based on the average color from the calibration squares after normalization and then perform median Blur to remove the noise
void handDetect::waitForPalmCover | ( | FrameGen * | m | ) |
specify the location of the calibration squares on the incoming frame and draw them