WO2019085060A1 - Method and system for detecting waving of robot, and robot - Google Patents

Method and system for detecting waving of robot, and robot Download PDF

Info

Publication number
WO2019085060A1
WO2019085060A1 PCT/CN2017/112211 CN2017112211W WO2019085060A1 WO 2019085060 A1 WO2019085060 A1 WO 2019085060A1 CN 2017112211 W CN2017112211 W CN 2017112211W WO 2019085060 A1 WO2019085060 A1 WO 2019085060A1
Authority
WO
WIPO (PCT)
Prior art keywords
corner point
corner
palm
pixel
motion
Prior art date
Application number
PCT/CN2017/112211
Other languages
French (fr)
Chinese (zh)
Inventor
张帆
Original Assignee
南京阿凡达机器人科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 南京阿凡达机器人科技有限公司 filed Critical 南京阿凡达机器人科技有限公司
Publication of WO2019085060A1 publication Critical patent/WO2019085060A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/50Extraction of image or video features by performing operations within image blocks; by using histograms, e.g. histogram of oriented gradients [HoG]; by summing image-intensity values; Projection analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/20Movements or behaviour, e.g. gesture recognition
    • G06V40/28Recognition of hand or arm movements, e.g. recognition of deaf sign language

Definitions

  • the invention relates to the field of image recognition, in particular to a wave detection method and system for a robot and a robot.
  • the invention patent of the application No. 201610859376.7 discloses a wave detection method based on a motion history image.
  • the invention first detects the approximate area in which the human body is located by the human body detector, and then analyzes the area based on the motion history image to determine whether the person is waving.
  • the method based on motion history image analysis is only suitable for static background. When a person is in a complex dynamic background, it is easy to judge the background of the movement as the person is waving.
  • the wave detection algorithm of the prior patent actually performs differential operation on three consecutive images of the detection area, and then uses the threshold method to obtain a binary image of the obtained difference image, and finally uses the acquired series of binary image history information to wave Judge. Since the invention adopts the frame difference method of continuous images, when the background is not fixed but dynamic, for example, when someone in the area to be detected is moving, it is easily interfered to recognize the dynamic background as a person waving.
  • the invention provides a wave detecting method and system for a robot and a robot, which realizes the recognition of the palm of the hand in a complicated background, and tracks the palm of the hand, thereby detecting whether the wave is handed, and the anti-interference against the background noise is strong.
  • a method for detecting a wave of a robot includes: detecting, by a cascade classifier, a palm in a standard position in a video stream; extracting a corner point of the palm in a standard position to obtain a corner set; and in the video stream Each corner point in the corner point set is tracked and detected, and the motion track corresponding to each corner point is obtained; whether the palm is waved according to the motion track of each corner point in the corner point set.
  • the wave detection method can perform palm detection on a separate video frame, and does not need to combine the historical data of the video frames before and after, that is, the wave can be detected in the process of waving.
  • the gesture recognition can be completed in complex background, and then the corner points of the palm of the hand are detected and tracked, which realizes the detection of the wave in a complex environment, and has strong anti-interference ability to the dynamic background noise, and the correct rate of the wave detection. high.
  • determining whether the user is waving according to the motion trajectory of each corner point in the corner point set specifically includes: a motion trajectory between two adjacent frames in the video stream according to each corner point in the corner point set and Presetting the pixel distance, and analyzing the number of effective motion corner points in the corner point set; when the number of the effective motion corner points is greater than the first preset number, continuing to perform all the corner points in the corner point set Tracking detection; according to the motion trajectory of the effective motion corner point, analyzing the number of effective wave corner points in the effective motion corner point; when the number of the effective wave corner points is greater than the second preset number, determining that the user is waving.
  • analyzing the number of effective motion corner points in the corner point set specifically includes: Calculating, by the motion trajectory between two adjacent frames in the video stream, the motion distance of the same corner point between two adjacent frames in the video stream; determining whether the motion distance is And greater than the preset pixel distance; when the moving distance is greater than the preset pixel distance, determining that the corner point performs effective motion, and using the corner point as the effective motion corner point; when the motion distance is less than the preset when setting the pixel distance, the corner point determined lost motion, and the motion of the effective corner point N track number minus 1, N track finally calculated is the number of active motion of the inner corner angle set point,
  • the initial value of N track is the total number N of corner points in the corner set;
  • the corner points of the effective motion can be effectively screened out, and the number of effective motion corner points N track obtained is also relatively accurate, in order to judge whether the palm is waved or not. .
  • determining, according to the number of the effective motion corner points and the first preset number, the detection of all the corner points in the corner point set comprises: determining whether the number of the effective motion corner points N track is greater than a first predetermined number; when the number of active motion corners N track is smaller than said first number, said effective stop motion trajectory is detected corner points, and determines the user or waving; effective when the motion When the number of corner points N track is greater than the first predetermined number, the motion trajectory of the effective motion corner point is continuously detected.
  • Determining whether the number N Track of the effective motion corner points is greater than the first preset number can initially determine whether the palm is waving, and if the number of corner points for effective motion is too low, it can be determined that the palm does not move, if the effective motion If the number of corner points N track is greater than the first preset number, the subsequent judgment process is continued.
  • the number N track of the effective motion corner points is greater than the first preset number
  • detecting a left moving distance and a right moving motion between the two adjacent frames in the video stream Determining whether the left moving distance and the right moving distance of the effective moving corner between the adjacent two frames in the video stream are greater than a preset distance; when the effective moving corner between two adjacent frames in the video stream When the left movement distance and the right movement distance are both greater than the preset distance, the effective movement corner point is recorded as the effective wave corner point, and the effective wave corner point number N move is increased by 1, and the finally calculated N move is The number of effective wave corner points in the set of corner points, and the initial value of the number of effective wave corner points N move is 0.
  • the number N Track of the effective motion corner points is greater than the first preset number, it is determined whether the effective motion corner point is effectively moved from left to right, and an effective wave corner point for performing effective motion from left to right can be accurately obtained.
  • the number N move is convenient for the next judgment process.
  • determining whether the user is waving or not according to the number of valid wave corner points and the second preset number comprises: determining whether the number of valid wave corner points is greater than a second preset number; and when the number of valid wave corner points is When it is greater than the second preset number, it is judged that the palm is waving; otherwise, it is judged that the palm is not waved.
  • the trajectory of the palm corner point will also move to the left and right, thereby detecting the number of effective wave corner points through the effective wave angle
  • the judgment of the number of points, when the number of effective wave corner points is greater than the second preset number, can accurately distinguish whether the palm is waving.
  • the palm training sample is generated before the palm of the standard position is detected in the video stream by the cascade classifier; the LBP texture feature vector of the palm training sample is extracted, and the palm training sample after the extraction process is obtained; After the palm training sample training cascade categorizer.
  • the Adaboost cascade classifier needs to be trained to perform LBP texture feature extraction on the palm training samples needed to train the Adaboost cascade classifier, which can improve the recognition accuracy of the Adaboost cascade classifier.
  • the preparation of the palm training sample comprises: collecting palm samples of different users in different backgrounds, the palm samples including samples in which the palm rotates within a preset angle range with respect to the standard position.
  • the selected palm sample is the palm sample of the palm relative to the standard position within the preset angle range, so as to better enhance the gesture recognition success rate of the cascade classifier near the standard position. .
  • Collecting palm samples from different users in different backgrounds improves the diversity of samples.
  • the detection results obtained will be very good, and the cascade classification is improved. The success rate of gesture recognition.
  • the process of extracting the LBP texture feature vector of the palm training sample comprises: dividing the detection window into N ⁇ N pixel regions, and centering a central pixel point in the pixel region with adjacent 8 adjacent pixels The gray value of the pixel is compared, where N ⁇ ⁇ 64, 32, 16, 8 ⁇ ; if the pixel value of the adjacent pixel is greater than the pixel value of the central pixel, the adjacent pixel is marked as 1, otherwise 0, thereby generating an 8-bit binary As the LBP value of the central pixel point, the LBP value of each pixel in the pixel region can be calculated; and the statistical histogram of the pixel region is calculated according to the LBP value of each pixel in the pixel region. And normalizing the statistical histogram; and connecting the statistical histogram of each pixel region of the palm training sample to form an LBP texture feature vector of the palm training sample.
  • the palm sample is tested for LBP features, and the trained cascade classifier is faster in calculation and can accurately locate the position of the palm on the image.
  • the corner points of the palm area are detected, a set of corner points is obtained, and all corner points in the corner point set are tracked and detected in the video stream, and the motion track corresponding to each corner point is obtained as follows:
  • the point detection algorithm extracts the corner points of the palms in the standard position, obtains a set of corner points, and performs optical flow tracking on all the corner points in the corner point set in the video stream, and detects the corner points according to the optical flow tracking algorithm.
  • the position of all the corner points in the set is calculated, and the motion trajectory corresponding to each corner point is calculated according to the sparse optical flow algorithm.
  • the corner points of the palm area can be effectively extracted, and the optical flow tracking algorithm can better realize the optical flow tracking of each corner point in the video stream, and can be better detected by the sparse optical flow algorithm.
  • the trajectory of the corner points facilitates the subsequent detection process of the wave.
  • a wave detection system for a robot includes: a detection module, configured to detect a palm in a standard position in a video stream by a cascade classifier; and a corner point extraction module electrically connected to the detection module for extracting the a corner point of the palm of the standard position, obtaining a set of corner points; a corner point tracking module electrically connected to the corner point extraction module, configured to perform tracking detection on each corner point in the corner point set in the video stream, a motion track corresponding to each corner point; a judging module electrically connected to the corner point tracking module, configured to determine whether the palm is waving according to the motion track of each corner point in the corner point set.
  • the determining module includes: an analysis sub-module, and analyzing, according to a motion track between two adjacent frames in the video stream and a preset pixel distance, The number of effective motion corner points in the corner point set; the analysis sub-module is further configured to continue tracking all corner points in the corner point set when the number of the effective motion corner points is greater than the first preset number Detecting; the analysis sub-module is further configured to analyze, according to the motion trajectory of the effective motion corner point, the number of effective wave corner points in the effective motion corner point; the determining sub-module is electrically connected to the analysis sub-module, For determining that the user is waving when the number of valid wave corner points is greater than the second preset number.
  • the determining module further includes: a calculating submodule, configured to calculate, in the video stream, adjacent to each other according to a motion track between two adjacent frames in the video stream in the corner set
  • the judging sub-module is further electrically connected to the computing sub-module for determining whether the moving distance is greater than a preset pixel distance; the judging sub-module is further used for When the moving distance is greater than the preset pixel distance, determining that the corner point performs effective motion and using the corner point as the effective motion corner point; the determining sub-module is further configured to: when the moving distance is smaller than the when the predetermined pixel distance, the corner point determined lost motion, and the motion of the effective corner point N track number minus 1, N track finally calculated is the number of active motion of the inner corner angle set point
  • the initial value of N track is the total number N of corner points in the corner set.
  • the determination sub-module is further for determining whether said effective amount of N track motion corners is greater than a first predetermined number; the determining sub-module is further configured to, when moving the active corner point less than the number N track said first predetermined number, said effective stop motion trajectory is detected corner points, and determines the user does not wave; the determining sub-module is further configured to, when moving the active corner point is greater than the first number N track When a predetermined number is reached, the motion trajectory of the effective motion corner point is continuously detected.
  • the determining module further includes a detecting submodule, configured to detect, between the adjacent two frames in the video stream, when the number N track of the effective motion corner points is greater than the first preset number The effective motion corner point moves to the left and the distance to the right; the determining sub-module is further configured to determine whether the left moving distance and the right moving distance of the effective moving corner between the adjacent two frames in the video stream are greater than The determining sub-module is further configured to: when the effective moving corner point leftward moving distance and the rightward moving distance are greater than a preset distance between adjacent two frames in the video stream, the effective moving angle The point is recorded as the effective wave corner point, and the number of effective wave corner points N move is increased by 1.
  • the final calculated N move is the number of effective wave corner points in the corner point set, and the number of valid wave corner points N move The initial value is 0.
  • the determining sub-module is further configured to determine whether the number of valid wave corner points is greater than a second preset number; the determining sub-module is further configured to: when the number of valid wave corner points is greater than the second preset When the quantity is counted, it is judged that the palm is waving; otherwise, it is judged that the palm does not wave.
  • the method further includes: a sample making module, configured to generate a palm training sample; a feature extraction module, extracting an LBP texture feature vector of the palm training sample, and obtaining an extracted palm training sample; a classifier training module, and the The feature extraction module is electrically connected for training the cascade classifier by extracting the processed palm training samples.
  • a sample making module configured to generate a palm training sample
  • a feature extraction module extracting an LBP texture feature vector of the palm training sample, and obtaining an extracted palm training sample
  • a classifier training module and the The feature extraction module is electrically connected for training the cascade classifier by extracting the processed palm training samples.
  • the feature extraction module includes: a processing sub-module, configured to divide the detection window into N ⁇ N pixel regions, and one central pixel point in the pixel region and adjacent eight adjacent pixel points The gray value is compared, wherein N ⁇ ⁇ 64, 32, 16, 8 ⁇ ; the eigenvalue calculation sub-module is electrically connected to the processing sub-module, if the pixel value of the adjacent pixel is greater than the pixel of the central pixel a value, the adjacent pixel is marked as 1, otherwise 0, thereby generating an 8-bit binary number as the LBP value of the central pixel, whereby each pixel in the pixel region can be calculated An LBP value; the processing sub-module is further configured to calculate a statistical histogram of the pixel region according to an LBP value of each pixel in the pixel region, and perform normalization processing on the statistical histogram; The sub-module is further configured to connect a statistical histogram of each pixel region of the palm training sample to form an LBP texture feature vector of the
  • the corner tracking module is further configured to extract a corner point of the palm in a standard position by a corner detection algorithm, obtain a corner point set, and perform all corner points in the corner point set in the video stream.
  • the optical flow tracking method detects the position of all the corner points in the corner point set according to the optical flow tracking algorithm, and calculates the motion track corresponding to each corner point according to the sparse optical flow algorithm.
  • a robot integrated with a wave detection system of a robot provided by the present invention.
  • a wave detection method and system for a robot and a robot can achieve at least one of the following beneficial effects:
  • the present invention is capable of being in a separate video frame relative to prior art detection methods for waving Performing palm detection on the above does not need to combine the historical data of the video frames before and after, that is, the wave can be detected in the process of waving.
  • the gesture recognition can be completed in complex background, and then the corner points of the palm of the hand are detected and tracked, which realizes the detection of the wave in a complex environment, and has strong anti-interference ability to the dynamic background noise, and the correct rate of the wave detection. high.
  • the corner points of the palm area can be effectively extracted, and the optical flow tracking algorithm can better realize the optical flow tracking of each corner point in the video stream, which can be better by the sparse optical flow algorithm.
  • the trajectory of the corner points is detected to facilitate the subsequent detection process of the wave.
  • the selected palm sample is the palm sample of the palm relative to the standard position within the preset angle range, so as to better enhance the gesture recognition of the cascade classifier near the standard position. Success rate. Collecting palm samples from different users in different backgrounds improves the diversity of samples. When the collected palm training samples have a certain degree of shape and illumination difference, the detection results obtained will be very good, and the cascade classification is improved. The success rate of gesture recognition.
  • the LBP feature detection is performed on the palm sample, and the trained cascade classifier is faster in calculation and can accurately locate the position of the palm on the image.
  • FIG. 1 is a flow chart of an embodiment of a method for detecting a wave of a robot according to the present invention
  • FIG. 2 is a flow chart showing another embodiment of a method for detecting a wave of a robot according to the present invention
  • Figure 3 is a schematic view of the palm of the present invention.
  • FIG. 4 is a flow chart showing another embodiment of a method for detecting a wave of a robot according to the present invention.
  • Figure 5 is a diagram showing the tracking of the corner of the palm of the present invention.
  • FIG. 6 is a flow chart of another embodiment of a method for detecting a wave of a robot according to the present invention.
  • FIG. 7 is a schematic structural view of a wave detection system of a robot according to the present invention.
  • FIG. 8 is another schematic structural view of a wave detection system of a robot according to the present invention.
  • FIG. 9 is another schematic structural view of a wave detection system of a robot of the present invention.
  • the present invention provides an embodiment of a method for detecting a wave of a robot, comprising:
  • S4 detects the palm in the standard position in the video stream through the cascade classifier
  • S6 performs tracking detection on each corner point in the corner point set in the video stream to obtain a motion track corresponding to each corner point
  • S7 determines whether the palm is waving according to the motion trajectory of each corner point in the corner point set.
  • the Adaboost cascade classifier first uses the Adaboost algorithm to detect the palm in the standard position in the video stream, and after detecting the palm in the standard position, the method of corner point acquisition is used to collect the palm of the hand.
  • the corner points are tracked and detected in the video stream to obtain the motion trajectory of each corner point. Through the motion trajectory, it can be judged whether the palm of the video stream is waving.
  • the robot can synchronously detect the palm and the palm when collecting the video stream.
  • the motion trajectory of the upper corner point does not need to be waved based on the historical image.
  • the recognition rate of the palm of the hand using the Adaboost cascade classifier is relatively high.
  • the present embodiment can also be accurate under complex background and dynamic background.
  • the palm in the standard position is detected in the video stream, which facilitates the tracking detection of the subsequent opponent's palm corner point.
  • the present invention further provides another embodiment of a method for detecting a wave of a robot, including:
  • S2 extracts an LBP texture feature vector of the palm training sample, and obtains a palm training sample after the extraction process;
  • S3 trains the cascade classifier by extracting the processed palm training samples
  • S4 detects the palm in the standard position in the video stream through the cascade classifier
  • S6 performs tracking detection on each corner point in the corner point set in the video stream to obtain a motion track corresponding to each corner point
  • S7 determines whether the palm is waving according to the motion trajectory of each corner point in the corner point set.
  • the preparing the palm training sample comprises: S11 collecting palm samples of different users in different backgrounds, wherein the palm samples comprise samples in which the palm rotates within a preset angle range with respect to the standard position.
  • the process of extracting the LBP texture feature vector of the palm training sample specifically includes:
  • S21 divides the detection window into N ⁇ N pixel regions, and compares a central pixel point in the pixel region with gray values of adjacent 8 adjacent pixel points, where N ⁇ 64, 32, 16 ,8 ⁇ ;
  • S24 connects the statistical histogram of each pixel region of the palm training sample to form an LBP texture feature vector of the palm training sample.
  • the cascading classifier needs to be trained.
  • This embodiment specifically describes the sample making process of the cascading classifier, and how to train the cascading classifier. process.
  • the Adaboost algorithm is combined with the LBP feature to detect the palm of the video frame. Since the algorithm does not have rotational invariance, it can only recognize the palm of the hand whose rotation angle is within ⁇ 15° at a certain standard position. In this embodiment, the gesture of selecting the palm at the 2 position is the standard palm, and the gestures at other positions are not recognized.
  • the training process of the cascade classifier can be divided into: 1. Making a palm training sample; 2. Extracting the LBP feature of the palm training sample; 3. Training the cascade classifier.
  • the selected palm sample is the palm sample of the palm relative to the standard position within the preset angle range, so as to better enhance the gesture of the cascade classifier near the standard position.
  • the recognition success rate, the palm preset angle range may be a range of ⁇ 15°, that is, the sample includes a gesture sample with a relative standard position rotation angle within a range of ⁇ 15° to better improve the gesture recognition rate of the algorithm near the standard position.
  • the extraction process of the LBP feature of the palm training sample is as follows: a.
  • the detection window is divided into 16 ⁇ 16 small cells, and the gray values of the adjacent 8 pixels are compared with one pixel in each cell. If the surrounding pixel value is greater than the center pixel value, the position of the pixel is marked as 1, otherwise 0.
  • 8 points in the 3*3 neighborhood are compared to produce an 8-bit binary number, that is, an LBP value of the center pixel of the window is obtained;
  • a histogram of each cell is calculated, that is, each number (assuming the decimal number LBP value) appears; normalize the histogram; c.
  • the AdaBoost algorithm used in the training cascade classifier is an iterative algorithm.
  • the core idea is to train different classifiers, ie weak classifiers, for the same training set, and then combine these weak classifiers to construct a stronger one.
  • the final classifier, the algorithm is divided into the following three steps:
  • the error rate on the training data set is the sum of the weights of the misclassified samples.
  • the calculated coefficient indicating the degree of importance in the final classifier (purpose: to get the weight of the basic classifier in the final classifier):
  • the weights that are misclassified by the basic classifier are increased, while the weights of the correctly classified samples are reduced. In this way, in this way, the Adaboost method can "focus” or "focus” on those samples that are more difficult to distinguish.
  • the gesture detection algorithm performs palm detection on a separate video frame, and does not need to combine historical data of front and rear video frames.
  • the detection algorithm is detected by the LBP feature of the palm image, the calculation speed is relatively fast, and the position of the palm on the image can be accurately located.
  • the present invention further provides another embodiment of a method for detecting a wave of a robot, including:
  • S11 collects a palm sample of different users in different backgrounds, wherein the palm sample includes a sample in which the palm rotates within a preset angle range with respect to a standard position;
  • S21 divides the detection window into N ⁇ N pixel regions, and compares a central pixel point in the pixel region with gray values of adjacent 8 adjacent pixel points, where N ⁇ 64, 32, 16 ,8 ⁇ ;
  • S3 trains the cascade classifier by extracting the processed palm training samples
  • S4 detects the palm in the standard position in the video stream through the cascade classifier
  • S51 extracts a corner point of the palm in the standard position by a corner detection algorithm to obtain a corner point set
  • S61 performs optical flow tracking on all the corner points in the corner point set in the video stream, detects the position of all the corner points in the corner point set according to the optical flow tracking algorithm, and calculates each corner according to the sparse optical flow algorithm. Point corresponding motion trajectory;
  • S71 analyzing, according to the motion trajectory between two adjacent frames in the video stream and the preset pixel distance of each corner point in the corner point set, analyzing the number of effective motion corner points in the corner point set;
  • S73 analyzes, according to the motion trajectory of the effective motion corner point, the number of effective wave corner points in the effective motion corner point;
  • S74 determines that the user is waving when the number of valid wave corner points is greater than the second preset number.
  • This embodiment specifically describes the detection, tracking of the palm corner points, and how to detect the waved motion according to the motion trajectory of the corner points.
  • the process of detecting and tracking the movement of the palm 1 is the palm in the video frame detected in the standard position; 2 is the corner point extracted into the palm area by the corner detection algorithm, and the extracted corner points are multiple, and a part of the figure is schematically shown in the figure.
  • the black point is the detected corner point; 3 is the initial position of the corner detected when the palm is in the standard position in the video frame, and the optical frame is tracked by using the point as the initial position; 4, 5 are The position of the corner point detected by the optical flow tracking algorithm in the next video frame; L1, L2 are the motion paths tracked to the hand corner point by the sparse optical flow algorithm during the palm waving process.
  • the corner point extraction method adopts a corner point detection algorithm, which can effectively extract the corner points of the palm area, and in addition, other feature point extraction methods, such as the FAST feature point extraction method, etc., can be used. I will not repeat them here.
  • the tracking of diagonal points in the video stream uses an optical flow tracking algorithm, which can effectively track each corner point in the video stream, which improves the effective degree of tracking, and can better detect the angle by the sparse optical flow algorithm.
  • the trajectory of the point is convenient for the subsequent detection process of the wave.
  • the motion trajectory of each corner point between two adjacent frames in the video stream is detected, and the motion distance of each corner point can be obtained.
  • the corner point is used as Effectively move the corner points while counting the number of effective motion corner points.
  • the detection situation of all the corner points in the corner point set is analyzed, and the specific detection condition is: one is that the number of effective motion corner points is smaller than the first The preset number, the value of the first preset number is relatively small, and can be set to 5 to 10, because the number of extracted palm corner points is far more than 5 to 10, when the number of effective motion corner points is smaller than the first The preset number, that is, most of the corner points are not effectively exercised, and it can be judged that the palm is not waved.
  • the effective wave angle in the effective motion corner point is obtained according to the motion trajectory of the effective motion corner point.
  • the number of points, when waving, the palm will definitely move to the left and right, the corners of the palm will also do the same movement, which will form a corresponding movement trajectory, according to the movement trajectory of the corner point can judge the palm of the hand.
  • the target will be lost inevitably, so the number of effective motion corner points obtained by tracking will not have so many original effective motion corner points, when the effective motion corner point is left to right.
  • the effective motion corner point is recorded as an effective wave corner point.
  • the number of valid wave corner points is greater than the second preset number, it can be determined that the user is waving.
  • the present invention further provides another embodiment of a method for detecting a wave of a robot, including:
  • S11 collects a palm sample of different users in different backgrounds, wherein the palm sample includes a sample in which the palm rotates within a preset angle range with respect to a standard position;
  • S21 divides the detection window into N ⁇ N pixel regions, and compares a central pixel point in the pixel region with gray values of adjacent 8 adjacent pixel points, where N ⁇ 64, 32, 16 ,8 ⁇ ;
  • S3 trains the cascade classifier by extracting the processed palm training samples
  • S4 detects the palm in the standard position in the video stream through the cascade classifier
  • S51 extracts a corner point of the palm in the standard position by a corner detection algorithm to obtain a corner point set
  • S61 performs optical flow tracking on all the corner points in the corner point set in the video stream, detects the position of all the corner points in the corner point set according to the optical flow tracking algorithm, and calculates each corner according to the sparse optical flow algorithm. Point corresponding motion trajectory;
  • S711 calculating a motion distance of the same corner point between two adjacent frames in the video stream according to a motion trajectory between two adjacent frames in the video stream according to each corner point in the corner point set;
  • S712 determines whether the moving distance is greater than a preset pixel distance
  • S721 determines whether the number N Track of the effective motion corner points is greater than the first preset number
  • S722 stops detecting the motion track of the effective motion corner point when the number N track of the effective motion corner points is smaller than the first preset number, and determines that the user does not wave;
  • S732 determines whether the left moving distance and the right moving distance of the effective moving corner between two adjacent frames in the video stream are greater than a preset distance
  • S741 determines whether the number of valid wave corner points N move is greater than a second preset number
  • the present embodiment describes how to determine whether the palm is waving or not according to the motion trajectory of each corner point in the corner point set.
  • the wave detection process is specifically as follows:
  • N track ⁇ 5 When the total number of corner points that are valid is tracked, N track ⁇ 5, the tracking is stopped. When the total number of effective corner points is tracked, N track ⁇ 5, it is determined whether the effective motion corner point in the video stream is valid both left and right. motion.
  • This embodiment proposes a method for accurately recognizing a human hand waving in a dynamic background, and the camera can detect whether a person is waving through a continuous video frame.
  • the invention is essentially different from the recognition based on the frame difference method. Firstly, the palm is detected on the picture of each frame by the palm detector. Once the palm is detected, the palm is tracked, and the motion trajectory of the palm is used for the wave judgment. Since the palm detection is performed on a single frame picture and does not need to combine the upper and lower historical image frames, it is not interfered by the complex background and the dynamic background. That is to say, the detection method is accurate and stable, and can be free from the influence of complex backgrounds, and can accurately identify whether it is waving even if the motion of the background or other objects interferes.
  • the present invention provides an embodiment of a robot's wave detection system, including:
  • a detecting module 4 configured to detect a palm in a standard position in the video stream by using a cascade classifier
  • a corner point extraction module 5 electrically connected to the detection module 4, for extracting a corner point of the palm in a standard position, to obtain a corner point set;
  • the corner tracking module 6 is electrically connected to the corner point extraction module 5 for performing tracking detection on each corner point in the corner point set in the video stream to obtain a motion track corresponding to each corner point;
  • the judging module 7 is electrically connected to the corner tracking module 6 for judging whether the palm is waving according to the motion trajectory of each corner point in the corner point set.
  • the robot call detection module detects the palm in the standard position in the video stream through the cascade classifier; secondly, the corner point extraction module is called to extract the corner point of the palm in the standard position to obtain the corner point set; again, the call angle is The point tracking module performs tracking detection on each corner point in the corner point set in the video stream to obtain a motion track corresponding to each corner point; finally, the judgment module is called, according to the motion of each corner point in the corner point set.
  • the trajectory determines whether the palm is waving.
  • the robot can synchronously detect the motion trajectory of the palm and the corner of the palm when collecting the video stream, and does not perform the wave detection based on the historical image.
  • the recognition rate of the palm of the hand using the Adaboost cascade classifier is relatively high, compared with In the prior art, in the complex background and the dynamic background, the palm of the standard position can be accurately detected in the video stream, which facilitates the tracking detection of the subsequent palm corner points.
  • the present invention provides an embodiment of a wave detection system for a robot. Based on the previous embodiment, the present invention further includes:
  • the feature extraction module 2 extracts an LBP texture feature vector of the palm training sample, and obtains a palm training sample after the extraction process;
  • the classifier training module 3 is electrically connected to the feature extraction module 2 for training the cascade classifier by extracting the processed palm training samples.
  • the feature extraction module 2 includes:
  • the processing sub-module 21 is configured to divide the detection window into N ⁇ N pixel regions, and compare one central pixel point in the pixel region with gray values of adjacent eight adjacent pixel points, where N ⁇ ⁇ 64,32,16,8 ⁇ ;
  • the feature value calculation sub-module 22 is electrically connected to the processing sub-module 21, and if the pixel value of the adjacent pixel point is greater than the pixel value of the central pixel point, the adjacent pixel point is marked as 1, otherwise 0. Thereby generating an 8-bit binary number as the LBP value of the central pixel point, whereby the LBP value of each pixel in the pixel region can be calculated;
  • the processing sub-module 21 is further configured to obtain an LBP value according to each pixel in the pixel region. Calculating a statistical histogram of the pixel region, and normalizing the statistical histogram;
  • the processing sub-module 21 is further configured to connect a statistical histogram of each pixel region of the palm training sample to form an LBP texture feature vector of the palm training sample;
  • the corner tracking module 6 is further configured to extract a corner point of the palm in a standard position by a corner detection algorithm, obtain a corner point set, and perform optical flow on all corner points in the corner point set in the video stream. Tracking, detecting the position of all the corner points in the corner point set according to the optical flow tracking algorithm, and calculating the motion trajectory corresponding to each corner point according to the sparse optical flow algorithm.
  • the Adaboost algorithm is combined with the LBP feature to detect the palm of the video frame. Since the algorithm does not have rotational invariance, it can only recognize the palm of the hand whose rotation angle is within ⁇ 15° at a certain standard position. In this embodiment, the gesture of selecting the palm at the 2 position is the standard palm, and the gestures at other positions are not recognized.
  • the training process of the cascade classifier can be divided into: 1. Making a palm training sample; 2. Extracting the LBP feature of the palm training sample; 3. Training the cascade classifier.
  • the selected palm sample is the palm sample of the palm relative to the standard position within the preset angle range, so as to better enhance the gesture of the cascade classifier near the standard position.
  • the recognition success rate, the palm preset angle range may be a range of ⁇ 15°, that is, the sample includes a gesture sample with a relative standard position rotation angle within a range of ⁇ 15° to better improve the gesture recognition rate of the algorithm near the standard position.
  • the process of extracting the LBP feature of the palm training sample by the feature extraction module is: a. dividing the detection window into 16 ⁇ 16 small cells, and for each pixel in each cell, the gray value of the adjacent 8 pixels In contrast, if the surrounding pixel value is greater than the center pixel value, the position of the pixel is marked as 1, otherwise 0. Thus, 8 points in the 3*3 neighborhood are compared to produce an 8-bit binary number, that is, the LBP value of the center pixel of the window is obtained; b. The histogram of each cell is calculated, that is, each number (assumed to be a decimal number) The frequency at which the LBP value appears; normalize the histogram Finally, c. Finally, the obtained statistical histogram of each cell is connected into a feature vector, that is, an LBP texture feature vector of the entire image.
  • the AdaBoost algorithm used in the training cascade classifier is an iterative algorithm.
  • the core idea is to train different classifiers, ie weak classifiers, for the same training set, and then combine these weak classifiers to construct a stronger one.
  • the final classifier, the algorithm is divided into the following three steps:
  • the error rate on the training data set is the sum of the weights of the misclassified samples.
  • the calculated coefficient indicating the degree of importance in the final classifier (purpose: to get the weight of the basic classifier in the final classifier):
  • the weights that are misclassified by the basic classifier are increased, while the weights of the correctly classified samples are reduced. In this way, in this way, the Adaboost method can "focus” or "focus” on those samples that are more difficult to distinguish.
  • the gesture detection algorithm performs palm detection on a separate video frame, and does not need to combine historical data of front and rear video frames.
  • the detection algorithm is detected by the LBP feature of the palm image, the calculation speed is relatively fast, and the position of the palm on the image can be accurately located.
  • the present invention provides an embodiment of a robot's wave detection system, including:
  • a detecting module 4 configured to detect a palm in a standard position in the video stream by using a cascade classifier
  • a corner point extraction module 5 electrically connected to the detection module 4, for extracting a corner point of the palm in a standard position, to obtain a corner point set;
  • the corner tracking module 6 is electrically connected to the corner point extraction module 5 for performing tracking detection on each corner point in the corner point set in the video stream to obtain a motion track corresponding to each corner point;
  • the judging module 7 is electrically connected to the corner tracking module 6 for judging whether the palm is waving according to the motion trajectory of each corner point in the corner point set;
  • the determining module 7 includes:
  • the analyzing sub-module 71 analyzes, according to the motion trajectory between two adjacent frames in the video stream and the preset pixel distance, the number of effective motion corner points in the corner point set is obtained;
  • the analysis sub-module 71 is further configured to analyze, according to the number of the effective motion corner points and the first preset number, the detection status of all the corner points in the corner point set;
  • the analysis sub-module 71 is further configured to analyze, according to the motion trajectory of the effective motion corner point, the number of effective wave corner points in the effective motion corner point when the detection condition satisfies a preset requirement;
  • the determining sub-module 72 is electrically connected to the analyzing sub-module 71, and is configured to determine whether the user is waving according to the number of valid wave corner points and the second preset number;
  • the determining module 7 further includes:
  • a calculation sub-module 73 configured to calculate, according to a motion trajectory between two adjacent frames in the video stream, the motion of the same corner between the adjacent two frames in the video stream distance;
  • the determining sub-module 72 is further electrically connected to the calculating sub-module 73, and configured to determine whether the moving distance is greater than a preset pixel distance;
  • the determining sub-module 72 is further configured to: when the moving distance is greater than a preset pixel distance, determine that the corner point performs effective motion, and use the corner point as the effective motion corner point;
  • Determining sub-module 72 is further configured, when the movement distance is less than the predetermined pixel distance, the corner point determined lost motion, and the motion of the effective number of corners Track N minus 1, finally calculated N Track is the number of effective motion corner points in the corner set, and the initial value of N track is the total number N of corner points in the corner set;
  • the determining sub-module 72 is further configured to determine whether the number N Track of the effective motion corner points is greater than the first preset number;
  • the determining sub-module 72 is further configured to stop detecting the motion track of the effective motion corner point when the number N track of the effective motion corner points is less than the first preset number, and determine that the user does not wave;
  • the determining sub-module 72 is further configured to continue to detect a motion trajectory of the effective motion corner point when the number N track of the effective motion corner points is greater than the first preset number.
  • the determining module 7 further comprising detecting sub-module 74, configured to, when moving the active corners N track number is greater than the first predetermined number, the video stream is detected in between two adjacent ones of said active The moving angle of the moving corner to the left and the distance to the right;
  • the determining sub-module 72 is further configured to determine whether the left moving distance and the right moving distance of the effective moving corner point between the adjacent two frames in the video stream are greater than a preset distance;
  • the determining sub-module 72 is further configured to: when the effective moving corner point leftward moving distance and the rightward moving distance between the adjacent two frames in the video stream are greater than a preset distance, the effective moving corner point is recorded as Effectively wave the corner point and increase the number of effective wave corner points N move by 1.
  • the final calculated N move is the number of effective wave corner points in the corner point set, and the initial value of the number of valid wave corner points N move Is 0;
  • the determining sub-module 72 is further configured to determine whether the number of valid wave corner points N move is greater than a second preset number
  • the determining sub-module 72 is further configured to: when the number of valid wave corner points N move is greater than the second preset number, determine that the palm is waving; otherwise, determine that the palm has not waved;
  • the feature extraction module 1 extracts an LBP texture feature vector of the palm training sample, and obtains a palm training sample after the extraction process;
  • a classifier training module 3 electrically connected to the feature extraction module 2, for training the cascade classifier by extracting the processed palm training samples;
  • the feature extraction module 2 includes:
  • the processing sub-module 21 is configured to divide the detection window into N ⁇ N pixel regions, and compare one central pixel point in the pixel region with gray values of adjacent eight adjacent pixel points, where N ⁇ ⁇ 64,32,16,8 ⁇ ;
  • the feature value calculation sub-module 22 is electrically connected to the processing sub-module 21, and if the pixel value of the adjacent pixel point is greater than the pixel value of the central pixel point, the adjacent pixel point is marked as 1, otherwise 0. Thereby generating an 8-bit binary number as the LBP value of the central pixel point, whereby the LBP value of each pixel in the pixel region can be calculated;
  • the processing sub-module 21 is further configured to calculate a statistical histogram of the pixel region according to an LBP value of each pixel in the pixel region, and perform normalization processing on the statistical histogram;
  • the processing sub-module 21 is further configured to connect a statistical histogram of each pixel region of the palm training sample to form an LBP texture feature vector of the palm training sample;
  • the corner tracking module 6 is further configured to extract a corner point of the palm in a standard position by a corner detection algorithm, obtain a corner point set, and perform optical flow on all corner points in the corner point set in the video stream. Tracking, detecting the position of all the corner points in the corner point set according to the optical flow tracking algorithm, and calculating the motion trajectory corresponding to each corner point according to the sparse optical flow algorithm.
  • This embodiment specifically describes the detection, tracking of the palm corner points, and how to detect the waved motion according to the motion trajectory of the corner points.
  • the process of detecting and tracking the movement of the palm 1 is the palm in the video frame detected in the standard position; 2 is the corner point extracted into the palm area by the corner detection algorithm, and the extracted corner points are multiple, and a part of the figure is schematically shown in the figure.
  • the black point is the detected corner point; 3 is the initial position of the corner detected when the palm is in the standard position in the video frame, and the optical frame is tracked by using the point as the initial position; 4, 5 are The position of the corner point detected by the optical flow tracking algorithm in the next video frame; L1, L2 are the motion paths tracked to the hand corner point by the sparse optical flow algorithm during the palm waving process.
  • the corner point extraction method adopts a corner point detection algorithm, which can effectively extract the corner points of the palm area, and in addition, other feature point extraction methods, such as the FAST feature point extraction method, etc., can be used. I will not repeat them here.
  • the tracking of diagonal points in the video stream uses an optical flow tracking algorithm, which can effectively track each corner point in the video stream, which improves the effective degree of tracking, and can better detect the angle by the sparse optical flow algorithm.
  • the trajectory of the point is convenient for the subsequent detection process of the wave.
  • the motion trajectory of each corner point between two adjacent frames in the video stream is detected, and the motion distance of each corner point can be obtained.
  • the corner point is used as Effectively move the corner points while counting the number of effective motion corner points.
  • the detection situation of all the corner points in the corner point set is obtained, and the specific detection condition is: one is the effective motion corner point
  • the quantity is smaller than the first preset quantity, and the value of the first preset quantity is relatively small, and can be set to 5 to 10, because the number of extracted palm corner points is far more than 5-10, when the effective movement corner point
  • the number is smaller than the first preset number, that is, most of the corner points are not effectively moved, and it can be judged that the palm is not waved.
  • the effective wave angle in the effective motion corner point is obtained according to the motion trajectory of the effective motion corner point.
  • the number of points, when waving, the palm will definitely move to the left and right, the corners of the palm will also do the same movement, which will form a corresponding movement trajectory, according to the movement trajectory of the corner point can judge the palm of the hand.
  • the target will be lost inevitably, so the number of effective motion corner points obtained by tracking will not have so many original effective motion corner points, when the effective motion corner point is left to right.
  • the effective motion corner point is recorded as an effective wave corner point.
  • the number of valid wave corner points is greater than the second preset number, it can be determined that the user is waving.
  • the wave detection process is specifically:
  • N track ⁇ 5 When the total number of corner points that are valid is tracked, N track ⁇ 5, the tracking is stopped. When the total number of effective corner points is tracked, N track ⁇ 5, it is determined whether the effective motion corner point in the video stream is valid both left and right. motion,
  • This embodiment proposes a method for accurately recognizing a human hand waving in a dynamic background, and the camera can detect whether a person is waving through a continuous video frame.
  • the invention is essentially different from the recognition based on the frame difference method. Firstly, the palm is detected on the picture of each frame by the palm detector. Once the palm is detected, the palm is tracked, and the motion trajectory of the palm is used for the wave judgment. Since the palm detection is performed on a single frame picture and does not need to combine the upper and lower historical image frames, it is not interfered by the complex background and the dynamic background. That is to say, the detection method is accurate and stable, and can be free from the influence of complex backgrounds, and can accurately identify whether it is waving even if the motion of the background or other objects interferes.

Abstract

A method and system for detecting waving of a robot, and a robot. The method comprises: detecting, in a video stream, a palm at a standard position by means of a cascade classifier; extracting angular points of the palm at the standard position so as to obtain an angular point set; tracking and detecting, in the video stream, each angular point in the angular point set, so as to obtain a motion trajectory corresponding to each angular point; and determining whether the palm is waving according to the motion trajectory of each angular point in the angular point set. Also comprised are a system and a robot using the method. The method, system and robot realize waving detection in a complex environment, and have a strong anti-interference capability with regards to dynamic background noise and a high detection accuracy.

Description

一种机器人的挥手检测方法、系统及一种机器人Wavelet detecting method and system for robot and robot
本申请要求2017年10月30日提交的申请号为:201711042859.9、发明名称为“一种机器人的挥手检测方法、系统及一种机器人”的中国专利申请的优先权,其全部内容合并在此。The present application claims the priority of the Japanese Patent Application Serial No. No. No. No. No. No. No. No. No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No.
技术领域Technical field
本发明涉及图像识别领域,特别是一种机器人的挥手检测方法、系统及一种机器人。The invention relates to the field of image recognition, in particular to a wave detection method and system for a robot and a robot.
背景技术Background technique
随着科技的进步,人工智能越来越普及的,人们希望与机器人进行像真人一样的交互。但目前与机器人的交互方式还是以鼠标、键盘及触摸屏为主,人们已经不能满足这种有诸多限制的传统交互方式。所以,我们需要设计一些更加智能化的交互方式。视觉是人与人之间理解交互信息的一种重要渠道,通过视觉观察交互对象的肢体动作,可以明白对方的交互意图。所以,为了增加机器人与人交互过程中的拟人化特征,有必要让机器人理解人的一些肢体语言,比如挥手打招呼。With the advancement of technology, artificial intelligence is becoming more and more popular, and people want to interact with robots like real people. However, the current interaction with robots is mainly based on mouse, keyboard and touch screen. People can't satisfy this traditional interaction with many limitations. So, we need to design some more intelligent ways of interacting. Vision is an important channel for understanding interaction information between people. By visually observing the body movements of interacting objects, you can understand each other's interaction intentions. Therefore, in order to increase the anthropomorphic characteristics of the robot-human interaction process, it is necessary for the robot to understand some of the human body language, such as waving a greeting.
申请号为201610859376.7的发明专利公开了一种基于运动历史图像的挥手检测方法。该发明首先通过人体检测器检测到人体所处的大致区域,然后对该区域进行基于运动历史图像的分析,判断人是否在挥手。但是基于运动历史图像分析的方法只适合于静态背景下,当人处在复杂的动态背景下时,则很容易将运动的背景判断为该人是在进行挥手。该现有专利的挥手检测算法实际是对待检测区域连续的三帧图像进行差分运算,然后对获得的差分图像采用阈值法获取二值图像,最后利用获取的一系列的二值图像历史信息进行挥手判断。由于该发明采用了连续图像的帧差法,所以当背景不是固定的而是动态的,比如待检测区域中有人在动,则很容易受到干扰将动态背景识别为人在挥手。The invention patent of the application No. 201610859376.7 discloses a wave detection method based on a motion history image. The invention first detects the approximate area in which the human body is located by the human body detector, and then analyzes the area based on the motion history image to determine whether the person is waving. However, the method based on motion history image analysis is only suitable for static background. When a person is in a complex dynamic background, it is easy to judge the background of the movement as the person is waving. The wave detection algorithm of the prior patent actually performs differential operation on three consecutive images of the detection area, and then uses the threshold method to obtain a binary image of the obtained difference image, and finally uses the acquired series of binary image history information to wave Judge. Since the invention adopts the frame difference method of continuous images, when the background is not fixed but dynamic, for example, when someone in the area to be detected is moving, it is easily interfered to recognize the dynamic background as a person waving.
因此,需要设计一种在复杂背景下也能准确识别挥手的方法,提高人 机交互的智能化。Therefore, it is necessary to design a method that can accurately recognize waving in a complicated background and improve people. The intelligence of machine interaction.
发明内容Summary of the invention
本发明提供了一种机器人的挥手检测方法、系统及一种机器人,实现了的在复杂背景下对手掌的识别,并对手掌进行跟踪,从而检测是否在挥手,对背景噪声的抗干扰性强。其技术方案如下:The invention provides a wave detecting method and system for a robot and a robot, which realizes the recognition of the palm of the hand in a complicated background, and tracks the palm of the hand, thereby detecting whether the wave is handed, and the anti-interference against the background noise is strong. . Its technical solutions are as follows:
一种机器人的挥手检测方法,包括:通过级联分类器在视频流中检测处于标准位置的手掌;提取所述处于标准位置的手掌的角点,得到角点集;在视频流中对所述角点集内每个角点进行跟踪检测,得到每个角点对应的运动轨迹;根据所述角点集内每个角点的运动轨迹判断手掌是否在挥手。A method for detecting a wave of a robot includes: detecting, by a cascade classifier, a palm in a standard position in a video stream; extracting a corner point of the palm in a standard position to obtain a corner set; and in the video stream Each corner point in the corner point set is tracked and detected, and the motion track corresponding to each corner point is obtained; whether the palm is waved according to the motion track of each corner point in the corner point set.
相对于现有技术对挥手的检测方法,本发明能够在单独的视频帧上执行手掌检测,不需要结合前后视频帧的历史数据,即在挥手的过程中即可检测挥手。通过级联分类器在复杂背景能够完成手势识别,之后对手掌的角点进行检测及跟踪,实现了复杂环境下对挥手的检测,对动态背景噪声的抗干扰能力强,对挥手检测的正确率高。Compared with the prior art, the wave detection method can perform palm detection on a separate video frame, and does not need to combine the historical data of the video frames before and after, that is, the wave can be detected in the process of waving. Through the cascaded classifier, the gesture recognition can be completed in complex background, and then the corner points of the palm of the hand are detected and tracked, which realizes the detection of the wave in a complex environment, and has strong anti-interference ability to the dynamic background noise, and the correct rate of the wave detection. high.
优选的,根据所述角点集内每个角点的运动轨迹判断用户是否在挥手具体包括:根据所述角点集内每个角点在视频流中相邻两帧之间的运动轨迹以及预设像素距离,分析得到所述角点集内有效运动角点的数量;当所述有效运动角点的数量大于第一预设数量时,继续对所述角点集内的所有角点进行跟踪检测;根据所述有效运动角点的运动轨迹,分析得到所述有效运动角点内的有效挥手角点数量;当所述有效挥手角点数量大于第二预设数量,判断用户在挥手。Preferably, determining whether the user is waving according to the motion trajectory of each corner point in the corner point set specifically includes: a motion trajectory between two adjacent frames in the video stream according to each corner point in the corner point set and Presetting the pixel distance, and analyzing the number of effective motion corner points in the corner point set; when the number of the effective motion corner points is greater than the first preset number, continuing to perform all the corner points in the corner point set Tracking detection; according to the motion trajectory of the effective motion corner point, analyzing the number of effective wave corner points in the effective motion corner point; when the number of the effective wave corner points is greater than the second preset number, determining that the user is waving.
通过对视频流中角点轨迹的检测,首先判断角点是否进行了有效运动,提高了挥手检测的正确率;判断角点是否进行了向左向右的有效运动,能够有效判断手掌是否在挥手。By detecting the corner trajectory in the video stream, it is first judged whether the corner point has been effectively moved, which improves the correct rate of the wave detection; whether the corner point is effectively moved left to right, can effectively judge whether the palm is waving .
优选的,根据所述角点集内每个角点在视频流相邻两帧之间的运动轨迹以及预设像素距离,分析得到所述角点集内有效运动角点的数量具体包括:根据所述角点集内每个角点在所述视频流中相邻两帧之间的运动轨迹计算所述视频流中相邻两帧之间同一角点的运动距离;判断所述运动距离 是否大于预设像素距离;当所述运动距离大于预设像素距离时,判断所述角点进行有效运动,并将所述角点作为所述有效运动角点;当所述运动距离小于所述预设像素距离时,判定所述角点进行无效运动,并将所述有效运动角点的数量Ntrack减1,最终计算得到的Ntrack即为所述角点集内有效运动角点的数量,Ntrack的初始值为所述角点集中的角点总数量N;Preferably, according to the motion trajectory of each corner point in the corner point set between two adjacent frames of the video stream and the preset pixel distance, analyzing the number of effective motion corner points in the corner point set specifically includes: Calculating, by the motion trajectory between two adjacent frames in the video stream, the motion distance of the same corner point between two adjacent frames in the video stream; determining whether the motion distance is And greater than the preset pixel distance; when the moving distance is greater than the preset pixel distance, determining that the corner point performs effective motion, and using the corner point as the effective motion corner point; when the motion distance is less than the preset when setting the pixel distance, the corner point determined lost motion, and the motion of the effective corner point N track number minus 1, N track finally calculated is the number of active motion of the inner corner angle set point, The initial value of N track is the total number N of corner points in the corner set;
通过对角点运动距离与预设像素距离的比较,可以有效筛选出做了有效运动的角点,由此得到的有效运动角点Ntrack的数量也比较精确,为判断手掌是否挥手做前期准备。By comparing the distance between the corner point and the preset pixel distance, the corner points of the effective motion can be effectively screened out, and the number of effective motion corner points N track obtained is also relatively accurate, in order to judge whether the palm is waved or not. .
优选的,根据所述有效运动角点的数量以及第一预设数量,分析得到所述角点集内的所有角点的检测情况具体包括:判断所述有效运动角点的数量Ntrack是否大于第一预设数量;当所述有效运动角点的数量Ntrack小于所述第一预设数量时,停止检测所述有效运动角点的运动轨迹,并判断用户没有挥手;当所述有效运动角点的数量Ntrack大于所述第一预设数量时,继续检测所述有效运动角点的运动轨迹。Preferably, determining, according to the number of the effective motion corner points and the first preset number, the detection of all the corner points in the corner point set comprises: determining whether the number of the effective motion corner points N track is greater than a first predetermined number; when the number of active motion corners N track is smaller than said first number, said effective stop motion trajectory is detected corner points, and determines the user or waving; effective when the motion When the number of corner points N track is greater than the first predetermined number, the motion trajectory of the effective motion corner point is continuously detected.
判断所述有效运动角点的数量Ntrack是否大于第一预设数量,能够初步判断手掌是否挥手,若做了有效运动的角点数量太低,可以判断出手掌没有移动,若所述有效运动角点的数量Ntrack大于第一预设数量,则继续进行接下来的判断过程。Determining whether the number N Track of the effective motion corner points is greater than the first preset number, can initially determine whether the palm is waving, and if the number of corner points for effective motion is too low, it can be determined that the palm does not move, if the effective motion If the number of corner points N track is greater than the first preset number, the subsequent judgment process is continued.
优选的,当所述有效运动角点的数量Ntrack大于所述第一预设数量时,检测所述视频流中相邻两帧之间所述有效运动角点向左运动距离以及向右运动距离;判断视频流中相邻两帧之间所述有效运动角点向左运动距离以及向右运动距离是否都大于预设距离;当视频流中相邻两帧之间所述有效运动角点向左运动距离以及向右运动距离都大于预设距离时,将所述有效运动角点记为有效挥手角点,并将有效挥手角点数量Nmove加1,最终计算得到的Nmove即为所述角点集内有效挥手角点的数量,所述有效挥手角点数量Nmove的初始值为0。Preferably, when the number N track of the effective motion corner points is greater than the first preset number, detecting a left moving distance and a right moving motion between the two adjacent frames in the video stream Determining whether the left moving distance and the right moving distance of the effective moving corner between the adjacent two frames in the video stream are greater than a preset distance; when the effective moving corner between two adjacent frames in the video stream When the left movement distance and the right movement distance are both greater than the preset distance, the effective movement corner point is recorded as the effective wave corner point, and the effective wave corner point number N move is increased by 1, and the finally calculated N move is The number of effective wave corner points in the set of corner points, and the initial value of the number of effective wave corner points N move is 0.
若所述有效运动角点的数量Ntrack大于第一预设数量,判断有效运动角点是否向左向右进行了有效运动,可以精确得到向左向右都进行了有效 运动的有效挥手角点数量Nmove,便于接下来的判断过程。If the number N Track of the effective motion corner points is greater than the first preset number, it is determined whether the effective motion corner point is effectively moved from left to right, and an effective wave corner point for performing effective motion from left to right can be accurately obtained. The number N move is convenient for the next judgment process.
优选的,根据所述有效挥手角点数量以及第二预设数量,判断用户是否在挥手具体包括:判断所述有效挥手角点数量是否大于第二预设数量;当所述有效挥手角点数量大于所述第二预设数量时,判断手掌正在挥手;否则,判断手掌没有挥手。Preferably, determining whether the user is waving or not according to the number of valid wave corner points and the second preset number comprises: determining whether the number of valid wave corner points is greater than a second preset number; and when the number of valid wave corner points is When it is greater than the second preset number, it is judged that the palm is waving; otherwise, it is judged that the palm is not waved.
由于手掌在挥手的时候必须要进行向左向右的挥手过程,因此手掌角点的运动轨迹也会向左向右进行运动,由此可以检测得到有效挥手角点的数量,通过对有效挥手角点数量的判断,当有效挥手角点数量大于第二预设数量时,则能够准确地分别出手掌是否正在挥手。Since the palm must perform the left-to-right wave process when waving, the trajectory of the palm corner point will also move to the left and right, thereby detecting the number of effective wave corner points through the effective wave angle The judgment of the number of points, when the number of effective wave corner points is greater than the second preset number, can accurately distinguish whether the palm is waving.
优选的,通过级联分类器在视频流中检测处于标准位置的手掌之前包括:制作手掌训练样本;提取所述手掌训练样本的LBP纹理特征向量,得到提取处理后的手掌训练样本;通过提取处理后的手掌训练样本训练级联分类器。Preferably, before the palm of the standard position is detected in the video stream by the cascade classifier, the palm training sample is generated; the LBP texture feature vector of the palm training sample is extracted, and the palm training sample after the extraction process is obtained; After the palm training sample training cascade categorizer.
在挥手检测之前,需要训练Adaboost级联分类器,对训练Adaboost级联分类器所需的手掌训练样本进行LBP纹理特征提取,可以提高Adaboost级联分类器的识别准确率。Before the wave detection, the Adaboost cascade classifier needs to be trained to perform LBP texture feature extraction on the palm training samples needed to train the Adaboost cascade classifier, which can improve the recognition accuracy of the Adaboost cascade classifier.
优选的,制作手掌训练样本具体包括:采集不同用户在不同背景下的手掌样本,所述手掌样本包括手掌相对于标准位置在预设角度范围内旋转的样本。Preferably, the preparation of the palm training sample comprises: collecting palm samples of different users in different backgrounds, the palm samples including samples in which the palm rotates within a preset angle range with respect to the standard position.
筛选手掌样本时,为了便于提取LBP特征值,因此选择的手掌样本为手掌相对于标准位置在预设角度范围内手掌样本,以便更好地提升级联分类器在标准位置附近的手势识别成功率。采集不同用户在不同背景下的手掌样本,提高了样本的多样性,当采集的手掌训练样本之间具一定程度的形状及光照上的差异,获得的检测效果会非常好,提高了级联分类器对手势识别的成功率。When screening the palm sample, in order to facilitate the extraction of the LBP feature value, the selected palm sample is the palm sample of the palm relative to the standard position within the preset angle range, so as to better enhance the gesture recognition success rate of the cascade classifier near the standard position. . Collecting palm samples from different users in different backgrounds improves the diversity of samples. When the collected palm training samples have a certain degree of shape and illumination difference, the detection results obtained will be very good, and the cascade classification is improved. The success rate of gesture recognition.
优选的,提取所述手掌训练样本的LBP纹理特征向量的过程具体包括:将检测窗口划分为N×N的像素区域,将所述像素区域中的一个中心像素点与相邻的8个相邻像素点的灰度值进行比较,其中N∈ {64,32,16,8};若所述相邻像素点的像素值大于中心像素点的像素值,则该相邻像素点被标记为1,否则为0,由此产生8位二进制数,作为所述中心像素点的LBP值,由此可以计算得到所述像素区域内每个像素点的LBP值;根据所述像素区域内每个像素点得LBP值计算所述像素区域的统计直方图,并对所述统计直方图进行归一化处理;将所述手掌训练样本每个像素区域的统计直方图进行连接,形成所述手掌训练样本的LBP纹理特征向量。Preferably, the process of extracting the LBP texture feature vector of the palm training sample comprises: dividing the detection window into N×N pixel regions, and centering a central pixel point in the pixel region with adjacent 8 adjacent pixels The gray value of the pixel is compared, where N∈ {64, 32, 16, 8}; if the pixel value of the adjacent pixel is greater than the pixel value of the central pixel, the adjacent pixel is marked as 1, otherwise 0, thereby generating an 8-bit binary As the LBP value of the central pixel point, the LBP value of each pixel in the pixel region can be calculated; and the statistical histogram of the pixel region is calculated according to the LBP value of each pixel in the pixel region. And normalizing the statistical histogram; and connecting the statistical histogram of each pixel region of the palm training sample to form an LBP texture feature vector of the palm training sample.
在训练级联分类器之前,对手掌样本进行了LBP特征检测,由此训练得到的级联分类器计算速度比较快,且能够准确定位到手掌在图像上的位置。Before training the cascade classifier, the palm sample is tested for LBP features, and the trained cascade classifier is faster in calculation and can accurately locate the position of the palm on the image.
优选的,检测所述手掌区域的角点,得到角点集,以及在视频流中对所述角点集内所有角点进行跟踪检测,得到每个角点对应的运动轨迹具体为:通过角点检测算法提取所述处于标准位置的手掌的角点,得到角点集,并在视频流中对所述角点集内所有角点进行光流跟踪,根据光流跟踪算法检测所述角点集内所有角点运动后的位置,根据稀疏光流算法计算得到每个角点对应的运动轨迹。Preferably, the corner points of the palm area are detected, a set of corner points is obtained, and all corner points in the corner point set are tracked and detected in the video stream, and the motion track corresponding to each corner point is obtained as follows: The point detection algorithm extracts the corner points of the palms in the standard position, obtains a set of corner points, and performs optical flow tracking on all the corner points in the corner point set in the video stream, and detects the corner points according to the optical flow tracking algorithm. The position of all the corner points in the set is calculated, and the motion trajectory corresponding to each corner point is calculated according to the sparse optical flow algorithm.
通过角点检测算法,能够有效地提取手掌区域的角点,通过光流跟踪算法,能够更好地实现在视频流中对各个角点的光流跟踪,通过稀疏光流算法可以更好地检测角点的运动轨迹,便于之后对挥手的检测过程。Through the corner detection algorithm, the corner points of the palm area can be effectively extracted, and the optical flow tracking algorithm can better realize the optical flow tracking of each corner point in the video stream, and can be better detected by the sparse optical flow algorithm. The trajectory of the corner points facilitates the subsequent detection process of the wave.
一种机器人的挥手检测系统,包括:检测模块,用于通过级联分类器在视频流中检测处于标准位置的手掌;角点提取模块,与所述检测模块电连接,用于提取所述处于标准位置的手掌的角点,得到角点集;角点跟踪模块,与所述角点提取模块电连接,用于在视频流中对所述角点集内每个角点进行跟踪检测,得到每个角点对应的运动轨迹;判断模块,与所述角点跟踪模块电连接,用于根据所述角点集内每个角点的运动轨迹判断手掌是否在挥手。A wave detection system for a robot includes: a detection module, configured to detect a palm in a standard position in a video stream by a cascade classifier; and a corner point extraction module electrically connected to the detection module for extracting the a corner point of the palm of the standard position, obtaining a set of corner points; a corner point tracking module electrically connected to the corner point extraction module, configured to perform tracking detection on each corner point in the corner point set in the video stream, a motion track corresponding to each corner point; a judging module electrically connected to the corner point tracking module, configured to determine whether the palm is waving according to the motion track of each corner point in the corner point set.
优选的,所述判断模块包括:分析子模块,根据所述角点集内每个角点在视频流中相邻两帧之间的运动轨迹以及预设像素距离,分析得到所述 角点集内有效运动角点的数量;所述分析子模块还用于当所述有效运动角点的数量大于第一预设数量时,继续对所述角点集内的所有角点进行跟踪检测;所述分析子模块还用于根据所述有效运动角点的运动轨迹,分析得到所述有效运动角点内的有效挥手角点数量;判断子模块,与所述分析子模块电连接,用于当所述有效挥手角点数量大于第二预设数量,判断用户在挥手。Preferably, the determining module includes: an analysis sub-module, and analyzing, according to a motion track between two adjacent frames in the video stream and a preset pixel distance, The number of effective motion corner points in the corner point set; the analysis sub-module is further configured to continue tracking all corner points in the corner point set when the number of the effective motion corner points is greater than the first preset number Detecting; the analysis sub-module is further configured to analyze, according to the motion trajectory of the effective motion corner point, the number of effective wave corner points in the effective motion corner point; the determining sub-module is electrically connected to the analysis sub-module, For determining that the user is waving when the number of valid wave corner points is greater than the second preset number.
优选的,所述判断模块还包括:计算子模块,用于根据所述角点集内每个角点在所述视频流中相邻两帧之间的运动轨迹计算所述视频流中相邻两帧之间同一角点的运动距离;所述判断子模块,还与所述计算子模块电连接,用于判断所述运动距离是否大于预设像素距离;所述判断子模块还用于当所述运动距离大于预设像素距离时,判断所述角点进行有效运动,并将所述角点作为所述有效运动角点;所述判断子模块还用于当所述运动距离小于所述预设像素距离时,判定所述角点进行无效运动,并将所述有效运动角点的数量Ntrack减1,最终计算得到的Ntrack即为所述角点集内有效运动角点的数量,Ntrack的初始值为所述角点集中的角点总数量N。Preferably, the determining module further includes: a calculating submodule, configured to calculate, in the video stream, adjacent to each other according to a motion track between two adjacent frames in the video stream in the corner set The judging sub-module is further electrically connected to the computing sub-module for determining whether the moving distance is greater than a preset pixel distance; the judging sub-module is further used for When the moving distance is greater than the preset pixel distance, determining that the corner point performs effective motion and using the corner point as the effective motion corner point; the determining sub-module is further configured to: when the moving distance is smaller than the when the predetermined pixel distance, the corner point determined lost motion, and the motion of the effective corner point N track number minus 1, N track finally calculated is the number of active motion of the inner corner angle set point The initial value of N track is the total number N of corner points in the corner set.
优选的,所述判断子模块还用于判断所述有效运动角点的数量Ntrack是否大于第一预设数量;所述判断子模块还用于当所述有效运动角点的数量Ntrack小于所述第一预设数量时,停止检测所述有效运动角点的运动轨迹,并判断用户没有挥手;所述判断子模块还用于当所述有效运动角点的数量Ntrack大于所述第一预设数量时,继续检测所述有效运动角点的运动轨迹。Preferably, the determination sub-module is further for determining whether said effective amount of N track motion corners is greater than a first predetermined number; the determining sub-module is further configured to, when moving the active corner point less than the number N track said first predetermined number, said effective stop motion trajectory is detected corner points, and determines the user does not wave; the determining sub-module is further configured to, when moving the active corner point is greater than the first number N track When a predetermined number is reached, the motion trajectory of the effective motion corner point is continuously detected.
优选的,所述判断模块还包括检测子模块,用于当所述有效运动角点的数量Ntrack大于所述第一预设数量时,检测所述视频流中相邻两帧之间所述有效运动角点向左运动距离以及向右运动距离;所述判断子模块还用于判断视频流中相邻两帧之间所述有效运动角点向左运动距离以及向右运动距离是否都大于预设距离;所述判断子模块还用于当视频流中相邻两帧之间所述有效运动角点向左运动距离以及向右运动距离都大于预设距离时,将所述有效运动角点记为有效挥手角点,并将有效挥手角点数量 Nmove加1,最终计算得到的Nmove即为所述角点集内有效挥手角点的数量,所述有效挥手角点数量Nmove的初始值为0。Preferably, the determining module further includes a detecting submodule, configured to detect, between the adjacent two frames in the video stream, when the number N track of the effective motion corner points is greater than the first preset number The effective motion corner point moves to the left and the distance to the right; the determining sub-module is further configured to determine whether the left moving distance and the right moving distance of the effective moving corner between the adjacent two frames in the video stream are greater than The determining sub-module is further configured to: when the effective moving corner point leftward moving distance and the rightward moving distance are greater than a preset distance between adjacent two frames in the video stream, the effective moving angle The point is recorded as the effective wave corner point, and the number of effective wave corner points N move is increased by 1. The final calculated N move is the number of effective wave corner points in the corner point set, and the number of valid wave corner points N move The initial value is 0.
优选的,所述判断子模块还用于判断所述有效挥手角点数量是否大于第二预设数量;所述判断子模块还用于当所述有效挥手角点数量大于所述第二预设数量时,判断手掌正在挥手;否则,判断手掌没有挥手。Preferably, the determining sub-module is further configured to determine whether the number of valid wave corner points is greater than a second preset number; the determining sub-module is further configured to: when the number of valid wave corner points is greater than the second preset When the quantity is counted, it is judged that the palm is waving; otherwise, it is judged that the palm does not wave.
优选的,还包括:样本制作模块,用于制作手掌训练样本;特征提取模块,提取所述手掌训练样本的LBP纹理特征向量,得到提取处理后的手掌训练样本;分类器训练模块,与所述特征提取模块电连接,用于通过提取处理后的手掌训练样本训练级联分类器。Preferably, the method further includes: a sample making module, configured to generate a palm training sample; a feature extraction module, extracting an LBP texture feature vector of the palm training sample, and obtaining an extracted palm training sample; a classifier training module, and the The feature extraction module is electrically connected for training the cascade classifier by extracting the processed palm training samples.
优选的,所述特征提取模块包括:处理子模块,用于将检测窗口划分为N×N的像素区域,将所述像素区域中的一个中心像素点与相邻的8个相邻像素点的灰度值进行比较,其中N∈{64,32,16,8};特征值计算子模块,与所述处理子模块电连接,若所述相邻像素点的像素值大于中心像素点的像素值,则该相邻像素点被标记为1,否则为0,由此产生8位二进制数,作为所述中心像素点的LBP值,由此可以计算得到所述像素区域内每个像素点的LBP值;所述处理子模块还用于根据所述像素区域内每个像素点得LBP值计算所述像素区域的统计直方图,并对所述统计直方图进行归一化处理;所述处理子模块还用于将所述手掌训练样本每个像素区域的统计直方图进行连接,形成所述手掌训练样本的LBP纹理特征向量。Preferably, the feature extraction module includes: a processing sub-module, configured to divide the detection window into N×N pixel regions, and one central pixel point in the pixel region and adjacent eight adjacent pixel points The gray value is compared, wherein N ∈ {64, 32, 16, 8}; the eigenvalue calculation sub-module is electrically connected to the processing sub-module, if the pixel value of the adjacent pixel is greater than the pixel of the central pixel a value, the adjacent pixel is marked as 1, otherwise 0, thereby generating an 8-bit binary number as the LBP value of the central pixel, whereby each pixel in the pixel region can be calculated An LBP value; the processing sub-module is further configured to calculate a statistical histogram of the pixel region according to an LBP value of each pixel in the pixel region, and perform normalization processing on the statistical histogram; The sub-module is further configured to connect a statistical histogram of each pixel region of the palm training sample to form an LBP texture feature vector of the palm training sample.
优选的,所述角点跟踪模块还用于通过角点检测算法提取所述处于标准位置的手掌的角点,得到角点集,并在视频流中对所述角点集内所有角点进行光流跟踪,根据光流跟踪算法检测所述角点集内所有角点运动后的位置,根据稀疏光流算法计算得到每个角点对应的运动轨迹。Preferably, the corner tracking module is further configured to extract a corner point of the palm in a standard position by a corner detection algorithm, obtain a corner point set, and perform all corner points in the corner point set in the video stream. The optical flow tracking method detects the position of all the corner points in the corner point set according to the optical flow tracking algorithm, and calculates the motion track corresponding to each corner point according to the sparse optical flow algorithm.
一种机器人,其集成有本发明提供的一种机器人的挥手检测系统。A robot integrated with a wave detection system of a robot provided by the present invention.
根据本发明提供的一种机器人的挥手检测方法、系统及一种机器人,能够实现以下至少一种有益效果:According to the present invention, a wave detection method and system for a robot and a robot can achieve at least one of the following beneficial effects:
1、相对于现有技术对挥手的检测方法,本发明能够在单独的视频帧 上执行手掌检测,不需要结合前后视频帧的历史数据,即在挥手的过程中即可检测挥手。通过级联分类器在复杂背景能够完成手势识别,之后对手掌的角点进行检测及跟踪,实现了复杂环境下对挥手的检测,对动态背景噪声的抗干扰能力强,对挥手检测的正确率高。1. The present invention is capable of being in a separate video frame relative to prior art detection methods for waving Performing palm detection on the above does not need to combine the historical data of the video frames before and after, that is, the wave can be detected in the process of waving. Through the cascaded classifier, the gesture recognition can be completed in complex background, and then the corner points of the palm of the hand are detected and tracked, which realizes the detection of the wave in a complex environment, and has strong anti-interference ability to the dynamic background noise, and the correct rate of the wave detection. high.
2、通过角点检测算法,能够有效地提取手掌区域的角点,通过光流跟踪算法,能够更好地实现在视频流中对各个角点的光流跟踪,通过稀疏光流算法可以更好地检测角点的运动轨迹,便于之后对挥手的检测过程。2. Through the corner detection algorithm, the corner points of the palm area can be effectively extracted, and the optical flow tracking algorithm can better realize the optical flow tracking of each corner point in the video stream, which can be better by the sparse optical flow algorithm. The trajectory of the corner points is detected to facilitate the subsequent detection process of the wave.
3、通过对视频流中角点轨迹的检测,首先判断角点是否进行了有效运动,提高了挥手检测的正确率。判断角点是否进行了向左向右的有效运动,能够有效判断手掌是否在挥手。3. By detecting the corner trajectory in the video stream, it is first determined whether the corner point has been effectively moved, and the correct rate of the wave detection is improved. It is judged whether or not the corner point has an effective movement to the left and right, and it is possible to effectively judge whether the palm is waving.
4、筛选手掌样本时,为了便于提取LBP特征值,因此选择的手掌样本为手掌相对于标准位置在预设角度范围内手掌样本,以便更好地提升级联分类器在标准位置附近的手势识别成功率。采集不同用户在不同背景下的手掌样本,提高了样本的多样性,当采集的手掌训练样本之间具一定程度的形状及光照上的差异,获得的检测效果会非常好,提高了级联分类器对手势识别的成功率。4. When screening the palm sample, in order to facilitate the extraction of the LBP feature value, the selected palm sample is the palm sample of the palm relative to the standard position within the preset angle range, so as to better enhance the gesture recognition of the cascade classifier near the standard position. Success rate. Collecting palm samples from different users in different backgrounds improves the diversity of samples. When the collected palm training samples have a certain degree of shape and illumination difference, the detection results obtained will be very good, and the cascade classification is improved. The success rate of gesture recognition.
5、在训练级联分类器之前,对手掌样本进行了LBP特征检测,由此训练得到的级联分类器计算速度比较快,且能够准确定位到手掌在图像上的位置。5. Before training the cascade classifier, the LBP feature detection is performed on the palm sample, and the trained cascade classifier is faster in calculation and can accurately locate the position of the palm on the image.
附图说明DRAWINGS
下面将以明确易懂的方式,结合附图说明优选实施方式,对一种机器人的挥手检测方法、系统及机器人的上述特性、技术特征、优点及其实现方式予以进一步说明。The above-described characteristics, technical features, advantages and implementation manners of a robot hand wave detection method, system and robot will be further described below in a clear and understandable manner with reference to the accompanying drawings.
图1是本发明一种机器人的挥手检测方法的一个实施例流程图;1 is a flow chart of an embodiment of a method for detecting a wave of a robot according to the present invention;
图2是本发明一种机器人的挥手检测方法的另一个实施例流程图;2 is a flow chart showing another embodiment of a method for detecting a wave of a robot according to the present invention;
图3是本发明手掌挥动示意图;Figure 3 is a schematic view of the palm of the present invention;
图4是本发明一种机器人的挥手检测方法的另一个实施例流程图; 4 is a flow chart showing another embodiment of a method for detecting a wave of a robot according to the present invention;
图5是本发明手掌角点跟踪检测图;Figure 5 is a diagram showing the tracking of the corner of the palm of the present invention;
图6是本发明一种机器人的挥手检测方法的另一个实施例流程图;6 is a flow chart of another embodiment of a method for detecting a wave of a robot according to the present invention;
图7是本发明一种机器人的挥手检测系统的一个结构示意图;7 is a schematic structural view of a wave detection system of a robot according to the present invention;
图8是本发明一种机器人的挥手检测系统的另一个结构示意图;8 is another schematic structural view of a wave detection system of a robot according to the present invention;
图9是本发明一种机器人的挥手检测系统的另一个结构示意图。9 is another schematic structural view of a wave detection system of a robot of the present invention.
具体实施方式Detailed ways
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对照附图说明本发明的具体实施方式。显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图,并获得其他的实施方式。In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the specific embodiments of the present invention will be described below with reference to the accompanying drawings. Obviously, the drawings in the following description are only some embodiments of the present invention, and those skilled in the art can obtain other drawings according to the drawings without obtaining creative labor, and obtain Other embodiments.
为使图面简洁,各图中只示意性地表示出了与本发明相关的部分,它们并不代表其作为产品的实际结构。另外,以使图面简洁便于理解,在有些图中具有相同结构或功能的部件,仅示意性地绘示了其中的一个,或仅标出了其中的一个。在本文中,“一个”不仅表示“仅此一个”,也可以表示“多于一个”的情形。In order to simplify the drawings, only the parts related to the present invention are schematically shown in the drawings, and they do not represent the actual structure of the product. In addition, in order to make the drawings simple and easy to understand, components having the same structure or function in some of the figures are only schematically illustrated, or only one of them is marked. In the present context, "a" means not only "only one" but also "more than one".
如图1所示,本发明提供了一种机器人的挥手检测方法的一个实施例,包括:As shown in FIG. 1, the present invention provides an embodiment of a method for detecting a wave of a robot, comprising:
S4通过级联分类器在视频流中检测处于标准位置的手掌;S4 detects the palm in the standard position in the video stream through the cascade classifier;
S5提取所述处于标准位置的手掌的角点,得到角点集;S5 extracts a corner point of the palm in the standard position to obtain a corner point set;
S6在视频流中对所述角点集内每个角点进行跟踪检测,得到每个角点对应的运动轨迹;S6 performs tracking detection on each corner point in the corner point set in the video stream to obtain a motion track corresponding to each corner point;
S7根据所述角点集内每个角点的运动轨迹判断手掌是否在挥手。S7 determines whether the palm is waving according to the motion trajectory of each corner point in the corner point set.
具体的,在本实施例中,首先Adaboost级联分类器采用Adaboost算法,检测视频流中的处于标准位置的手掌,当检测到处于标准位置的手掌之后,运用角点采集的方法采集手掌上的角点,并在视频流中对角点进行跟踪检测,得到每个角点的运动轨迹,通过运动轨迹则可以判断出判断视频流中的手掌是否在挥手。Specifically, in this embodiment, the Adaboost cascade classifier first uses the Adaboost algorithm to detect the palm in the standard position in the video stream, and after detecting the palm in the standard position, the method of corner point acquisition is used to collect the palm of the hand. The corner points are tracked and detected in the video stream to obtain the motion trajectory of each corner point. Through the motion trajectory, it can be judged whether the palm of the video stream is waving.
本实施例中,机器人在采集视频流的时候能够同步检测手掌以及手掌 上角点的运动轨迹,不用基于历史图像来进行挥手检测,运用Adaboost级联分类器对手掌的识别率比较高,相对于现有技术,本实施例在复杂背景下、动态背景下也可以准确地在视频流中检测到处于标准位置的手掌,便于后续对手掌角点的跟踪检测。In this embodiment, the robot can synchronously detect the palm and the palm when collecting the video stream. The motion trajectory of the upper corner point does not need to be waved based on the historical image. The recognition rate of the palm of the hand using the Adaboost cascade classifier is relatively high. Compared with the prior art, the present embodiment can also be accurate under complex background and dynamic background. The palm in the standard position is detected in the video stream, which facilitates the tracking detection of the subsequent opponent's palm corner point.
本实施例通过对角点运动轨迹的检测来对手掌是否挥手进行判断,比如,检测到角点集中每个角点的运动轨迹,若超过一半的角点进行了向左向右的有效运动,则可以判断用户正在挥手。In this embodiment, by detecting the trajectory of the corner point, whether the palm is waved or not is determined, for example, the motion trajectory of each corner point in the corner point is detected, and if more than half of the corner points are effectively moved left to right, Then you can judge that the user is waving.
如图2所示,本发明还提供了一种机器人的挥手检测方法的另一个实施例,包括:As shown in FIG. 2, the present invention further provides another embodiment of a method for detecting a wave of a robot, including:
S1制作手掌训练样本;S1 produces a palm training sample;
S2提取所述手掌训练样本的LBP纹理特征向量,得到提取处理后的手掌训练样本;S2 extracts an LBP texture feature vector of the palm training sample, and obtains a palm training sample after the extraction process;
S3通过提取处理后的手掌训练样本训练级联分类器;S3 trains the cascade classifier by extracting the processed palm training samples;
S4通过级联分类器在视频流中检测处于标准位置的手掌;S4 detects the palm in the standard position in the video stream through the cascade classifier;
S5提取所述处于标准位置的手掌的角点,得到角点集;S5 extracts a corner point of the palm in the standard position to obtain a corner point set;
S6在视频流中对所述角点集内每个角点进行跟踪检测,得到每个角点对应的运动轨迹;S6 performs tracking detection on each corner point in the corner point set in the video stream to obtain a motion track corresponding to each corner point;
S7根据所述角点集内每个角点的运动轨迹判断手掌是否在挥手。S7 determines whether the palm is waving according to the motion trajectory of each corner point in the corner point set.
优选的,制作手掌训练样本具体包括:S11采集不同用户在不同背景下的手掌样本,所述手掌样本包括手掌相对于标准位置在预设角度范围内旋转的样本。Preferably, the preparing the palm training sample comprises: S11 collecting palm samples of different users in different backgrounds, wherein the palm samples comprise samples in which the palm rotates within a preset angle range with respect to the standard position.
优选的,提取所述手掌训练样本的LBP纹理特征向量的过程具体包括:Preferably, the process of extracting the LBP texture feature vector of the palm training sample specifically includes:
S21将检测窗口划分为N×N的像素区域,将所述像素区域中的一个中心像素点与相邻的8个相邻像素点的灰度值进行比较,其中N∈{64,32,16,8};S21 divides the detection window into N×N pixel regions, and compares a central pixel point in the pixel region with gray values of adjacent 8 adjacent pixel points, where N∈{64, 32, 16 ,8};
S22若所述相邻像素点的像素值大于中心像素点的像素值,则该相邻像素点被标记为1,否则为0,由此产生8位二进制数,作为所述中心像 素点的LBP值,由此可以计算得到所述像素区域内每个像素点的LBP值;S22, if the pixel value of the adjacent pixel is greater than the pixel value of the central pixel, the adjacent pixel is marked as 1, otherwise 0, thereby generating an 8-bit binary number as the central image The LBP value of the prime point, whereby the LBP value of each pixel in the pixel region can be calculated;
S23根据所述像素区域内每个像素点得LBP值计算所述像素区域的统计直方图,并对所述统计直方图进行归一化处理;S23: calculating a statistical histogram of the pixel region according to an LBP value of each pixel in the pixel region, and performing normalization processing on the statistical histogram;
S24将所述手掌训练样本每个像素区域的统计直方图进行连接,形成所述手掌训练样本的LBP纹理特征向量。S24 connects the statistical histogram of each pixel region of the palm training sample to form an LBP texture feature vector of the palm training sample.
具体的,在使用级联分类器在视频流中检测处于标准位置的手掌之前需要训练级联分类器,本实施例具体阐述了级联分类器的样本制作过程,以及如何训练级联分类器的过程。Specifically, before the cascading classifier is used to detect the palm of the standard position in the video stream, the cascading classifier needs to be trained. This embodiment specifically describes the sample making process of the cascading classifier, and how to train the cascading classifier. process.
如图3所示,用户在挥手过程中手掌在①、②、③位置间来回运动。本实施例采用Adaboost算法结合LBP特征对视频帧中的手掌进行检测。由于该算法不具有旋转不变性,仅能识别手掌在某一标准位置旋转角度在±15°范围内的手掌。本实施例选择手掌处在②位置的手势为标准手掌,其他位置的手势则不能识别。As shown in FIG. 3, the user moves back and forth between the 1, 2, and 3 positions during the swinging process. In this embodiment, the Adaboost algorithm is combined with the LBP feature to detect the palm of the video frame. Since the algorithm does not have rotational invariance, it can only recognize the palm of the hand whose rotation angle is within ±15° at a certain standard position. In this embodiment, the gesture of selecting the palm at the 2 position is the standard palm, and the gestures at other positions are not recognized.
级联分类器的训练过程可以分为:1、制作手掌训练样本;2、手掌训练样本LBP特征的提取;3、训练级联分类器。The training process of the cascade classifier can be divided into: 1. Making a palm training sample; 2. Extracting the LBP feature of the palm training sample; 3. Training the cascade classifier.
在采集手掌训练样本的时候,为了便于提取LBP特征值,因此选择的手掌样本为手掌相对于标准位置在预设角度范围内手掌样本,以便更好地提升级联分类器在标准位置附近的手势识别成功率,手掌预设角度范围可以是±15°的范围,即样本包括相对标准位置旋转角度在±15°范围内的手势样本,以更好的提升算法在标准位置附近的手势识别率。采集不同用户在不同背景下的手掌样本时为了提高了样本的多样性,当采集的手掌训练样本之间具有一定程度的形状及光照上的差异,获得的检测效果会非常好,能够更大程度地提高了级联分类器对手势识别的成功率。In the process of collecting the palm training samples, in order to facilitate the extraction of the LBP feature values, the selected palm sample is the palm sample of the palm relative to the standard position within the preset angle range, so as to better enhance the gesture of the cascade classifier near the standard position. The recognition success rate, the palm preset angle range may be a range of ±15°, that is, the sample includes a gesture sample with a relative standard position rotation angle within a range of ±15° to better improve the gesture recognition rate of the algorithm near the standard position. In order to improve the diversity of samples when collecting palm samples of different users in different backgrounds, when the collected palm training samples have a certain degree of shape and illumination difference, the detection results obtained will be very good and can be more The success rate of the cascading classifier for gesture recognition is improved.
手掌训练样本LBP特征的提取过程为:a.将检测窗口划分为16×16的小区域(cell),对于每个cell中的一个像素,将相邻的8个像素的灰度值与其进行比较,若周围像素值大于中心像素值,则该像素点的位置被标记为1,否则为0。这样,3*3邻域内的8个点经比较可产生8位二进制数,即得到该窗口中心像素点的LBP值;b.计算每个cell的直方图,即每个数字 (假定是十进制数LBP值)出现的频率;对该直方图进行归一化处理;c.最后将得到的每个cell的统计直方图进行连接成为一个特征向量,也就是整幅图的LBP纹理特征向量。The extraction process of the LBP feature of the palm training sample is as follows: a. The detection window is divided into 16×16 small cells, and the gray values of the adjacent 8 pixels are compared with one pixel in each cell. If the surrounding pixel value is greater than the center pixel value, the position of the pixel is marked as 1, otherwise 0. Thus, 8 points in the 3*3 neighborhood are compared to produce an 8-bit binary number, that is, an LBP value of the center pixel of the window is obtained; b. a histogram of each cell is calculated, that is, each number (assuming the decimal number LBP value) appears; normalize the histogram; c. Finally, connect the resulting statistical histogram of each cell into a feature vector, that is, the LBP texture of the entire image. Feature vector.
训练级联分类器所使用的AdaBoost算法是一种迭代算法,其核心思想是针对同一个训练集训练不同的分类器,即弱分类器,然后把这些弱分类器集合起来,构造一个更强的最终分类器,算法分为以下3步:The AdaBoost algorithm used in the training cascade classifier is an iterative algorithm. The core idea is to train different classifiers, ie weak classifiers, for the same training set, and then combine these weak classifiers to construct a stronger one. The final classifier, the algorithm is divided into the following three steps:
a.初始化训练数据的权值分布。如果有N个样本,则每一个训练样本最开始时都被赋予相同的权值:1/N;a. Initialize the weight distribution of the training data. If there are N samples, each training sample is given the same weight at the beginning: 1/N;
Figure PCTCN2017112211-appb-000001
Figure PCTCN2017112211-appb-000001
b.训练弱分类器。如果某个样本点已经被准确地分类,那么在构造下一个训练集中,它的权值就被降低;相反,如果某个样本点没有被准确地分类,那么它的权值就得到提高。然后,权值更新过的样本集被用于训练下一个分类器,整个训练过程如此迭代地进行下去。使用具有权值分布的训练数据集学习,得到基本分类器(选取让误差率最低的阈值来设计基本分类器):b. Train the weak classifier. If a sample point has been accurately classified, its weight is reduced in constructing the next training set; conversely, if a sample point is not accurately classified, its weight is increased. The weighted updated sample set is then used to train the next classifier, and the entire training process proceeds so iteratively. Using the training dataset with weight distribution to learn, get the basic classifier (choose the threshold with the lowest error rate to design the basic classifier):
Gm(x):x→{-1,+1}G m (x): x→{-1, +1}
计算在训练数据集上的分类误差率:Calculate the classification error rate on the training data set:
Figure PCTCN2017112211-appb-000002
Figure PCTCN2017112211-appb-000002
由上述式子可知,在训练数据集上的误差率就是被误分类样本的权值之和。It can be seen from the above formula that the error rate on the training data set is the sum of the weights of the misclassified samples.
计算的系数,表示在最终分类器中的重要程度(目的:得到基本分类器在最终分类器中所占的权重):The calculated coefficient, indicating the degree of importance in the final classifier (purpose: to get the weight of the basic classifier in the final classifier):
Figure PCTCN2017112211-appb-000003
Figure PCTCN2017112211-appb-000003
由上述式子可知,当
Figure PCTCN2017112211-appb-000004
时,αm≥0,且αm随着em的减小而增大,意味着分类误差率越小的基本分类器在最终分类器中的作用越大。
As can be seen from the above formula, when
Figure PCTCN2017112211-appb-000004
When α m ≥ 0, and α m increases as e m decreases, it means that the smaller the classification error rate, the greater the role of the basic classifier in the final classifier.
更新训练数据集的权值分布(目的:得到样本的新的权值分布),用于下一轮迭代: Update the weight distribution of the training data set (purpose: get the new weight distribution of the sample) for the next iteration:
Dm+1=(wm+1,1,wm+1,2,...,wm+1,N)D m+1 =(w m+1,1 ,w m+1,2 ,...,w m+1,N )
Figure PCTCN2017112211-appb-000005
Figure PCTCN2017112211-appb-000005
使得被基本分类器误分类样本的权值增大,而被正确分类样本的权值减小。就这样,通过这样的方式,Adaboost方法能“重点关注”或“聚焦于”那些较难分的样本上。The weights that are misclassified by the basic classifier are increased, while the weights of the correctly classified samples are reduced. In this way, in this way, the Adaboost method can "focus" or "focus" on those samples that are more difficult to distinguish.
c.将各个训练得到的弱分类器组合成强分类器。各个弱分类器的训练过程结束后,加大分类误差率小的弱分类器的权重,使其在最终的分类函数中起着较大的决定作用,而降低分类误差率大的弱分类器的权重,使其在最终的分类函数中起着较小的决定作用。换言之,误差率低的弱分类器在最终分类器中占的权重较大,否则较小。c. Combine the weak classifiers obtained from each training into a strong classifier. After the training process of each weak classifier is finished, the weight of the weak classifier with small classification error rate is increased, which plays a greater role in determining the final classification function, and reduces the weak classifier with large classification error rate. The weights make it play a smaller role in the final classification function. In other words, a weak classifier with a low error rate has a larger weight in the final classifier, otherwise it is smaller.
组合各个弱分类器,从而得到最终分类器,如下:Combine each weak classifier to get the final classifier, as follows:
Figure PCTCN2017112211-appb-000006
Figure PCTCN2017112211-appb-000006
由于采用了改良过的手掌检测算法,具有以下优点:Thanks to the improved palm detection algorithm, it has the following advantages:
1、该手势检测算法是在单独的视频帧上执行手掌检测,不需要结合前后视频帧的历史数据。1. The gesture detection algorithm performs palm detection on a separate video frame, and does not need to combine historical data of front and rear video frames.
2、该检测算法是通过手掌图像的LBP特征进行检测,计算速度比较快,且能够准确定位到手掌在图像上的位置。2. The detection algorithm is detected by the LBP feature of the palm image, the calculation speed is relatively fast, and the position of the palm on the image can be accurately located.
3、当采集的手掌训练样本之间具一定程度的形状及光照上的差异,获得的检测效果会非常好,识别率高。3. When the collected palm training samples have a certain degree of shape and difference in illumination, the obtained detection effect will be very good and the recognition rate is high.
如图4所示,本发明还提供了一种机器人的挥手检测方法的另一个实施例,包括:As shown in FIG. 4, the present invention further provides another embodiment of a method for detecting a wave of a robot, including:
S11采集不同用户在不同背景下的手掌样本,所述手掌样本包括手掌相对于标准位置在预设角度范围内旋转的样本;S11 collects a palm sample of different users in different backgrounds, wherein the palm sample includes a sample in which the palm rotates within a preset angle range with respect to a standard position;
S21将检测窗口划分为N×N的像素区域,将所述像素区域中的一个中心像素点与相邻的8个相邻像素点的灰度值进行比较,其中N∈{64,32,16,8};S21 divides the detection window into N×N pixel regions, and compares a central pixel point in the pixel region with gray values of adjacent 8 adjacent pixel points, where N∈{64, 32, 16 ,8};
S22若所述相邻像素点的像素值大于中心像素点的像素值,则该相邻像素点被标记为1,否则为0,由此产生8位二进制数,作为所述中心像 素点的LBP值,由此可以计算得到所述像素区域内每个像素点的LBP值;S22, if the pixel value of the adjacent pixel is greater than the pixel value of the central pixel, the adjacent pixel is marked as 1, otherwise 0, thereby generating an 8-bit binary number as the central image The LBP value of the prime point, whereby the LBP value of each pixel in the pixel region can be calculated;
S23根据所述像素区域内每个像素点得LBP值计算所述像素区域的统计直方图,并对所述统计直方图进行归一化处理;S23: calculating a statistical histogram of the pixel region according to an LBP value of each pixel in the pixel region, and performing normalization processing on the statistical histogram;
S24将所述手掌训练样本每个像素区域的统计直方图进行连接,形成所述手掌训练样本的LBP纹理特征向量;S24, connecting the statistical histogram of each pixel area of the palm training sample to form an LBP texture feature vector of the palm training sample;
S3通过提取处理后的手掌训练样本训练级联分类器;S3 trains the cascade classifier by extracting the processed palm training samples;
S4通过级联分类器在视频流中检测处于标准位置的手掌;S4 detects the palm in the standard position in the video stream through the cascade classifier;
S51通过角点检测算法提取所述处于标准位置的手掌的角点,得到角点集;S51 extracts a corner point of the palm in the standard position by a corner detection algorithm to obtain a corner point set;
S61在视频流中对所述角点集内所有角点进行光流跟踪,根据光流跟踪算法检测所述角点集内所有角点运动后的位置,根据稀疏光流算法计算得到每个角点对应的运动轨迹;S61 performs optical flow tracking on all the corner points in the corner point set in the video stream, detects the position of all the corner points in the corner point set according to the optical flow tracking algorithm, and calculates each corner according to the sparse optical flow algorithm. Point corresponding motion trajectory;
S71根据所述角点集内每个角点在视频流中相邻两帧之间的运动轨迹以及预设像素距离,分析得到所述角点集内有效运动角点的数量;S71: analyzing, according to the motion trajectory between two adjacent frames in the video stream and the preset pixel distance of each corner point in the corner point set, analyzing the number of effective motion corner points in the corner point set;
S72当所述有效运动角点的数量大于第一预设数量时,继续对所述角点集内的所有角点进行跟踪检测;S72, when the number of the effective motion corner points is greater than the first preset number, continue to perform tracking detection on all corner points in the corner point set;
S73根据所述有效运动角点的运动轨迹,分析得到所述有效运动角点内的有效挥手角点数量;S73 analyzes, according to the motion trajectory of the effective motion corner point, the number of effective wave corner points in the effective motion corner point;
S74当所述有效挥手角点数量大于第二预设数量,判断用户在挥手。S74 determines that the user is waving when the number of valid wave corner points is greater than the second preset number.
本实施例具体阐述了手掌角点的检测、跟踪,以及根据角点的运动轨迹如何检测挥手的过程。This embodiment specifically describes the detection, tracking of the palm corner points, and how to detect the waved motion according to the motion trajectory of the corner points.
具体的,如图5所示,手掌运动的检测、跟踪的过程。①为在视频帧中检测到处于标准位置的手掌;②为通过角点检测算法提取到手掌区域内的角点,该提取出来的角点有多个,在图中示意性的给出了一部分,标黑的点即为检测到的角点;③为手掌在视频帧中处于标准位置时检测到的角点初始位置,以该点作为初始位置对视频帧进行光流跟踪;④、⑤为在接下来视频帧中通过光流跟踪算法检测到的角点的运动后的位置;L1、L2为在手掌挥动过程中通过稀疏光流算法跟踪到手角点的运动路径。 Specifically, as shown in FIG. 5, the process of detecting and tracking the movement of the palm. 1 is the palm in the video frame detected in the standard position; 2 is the corner point extracted into the palm area by the corner detection algorithm, and the extracted corner points are multiple, and a part of the figure is schematically shown in the figure. The black point is the detected corner point; 3 is the initial position of the corner detected when the palm is in the standard position in the video frame, and the optical frame is tracked by using the point as the initial position; 4, 5 are The position of the corner point detected by the optical flow tracking algorithm in the next video frame; L1, L2 are the motion paths tracked to the hand corner point by the sparse optical flow algorithm during the palm waving process.
本实施例中,对角点的提取方法采用角点检测算法,能够有效地提取手掌区域的角点,除此以外,还可以用其他特征点的提取方法,如FAST特征点提取方法等等,此处不再赘述。对角点在视频流中的跟踪采用的是光流跟踪算法,能够在视频流中对每个角点进行有效的跟踪,提高了跟踪的有效程度,通过稀疏光流算法可以更好地检测角点的运动轨迹,便于之后对挥手的检测过程。In this embodiment, the corner point extraction method adopts a corner point detection algorithm, which can effectively extract the corner points of the palm area, and in addition, other feature point extraction methods, such as the FAST feature point extraction method, etc., can be used. I will not repeat them here. The tracking of diagonal points in the video stream uses an optical flow tracking algorithm, which can effectively track each corner point in the video stream, which improves the effective degree of tracking, and can better detect the angle by the sparse optical flow algorithm. The trajectory of the point is convenient for the subsequent detection process of the wave.
检测视频流中相邻两帧之间各个角点的运动轨迹,可以得到各个角点的运动距离,当相邻两帧中角点的运动距离大于预设像素距离时,将所述角点作为有效运动角点,同时统计有效运动角点的数量。The motion trajectory of each corner point between two adjacent frames in the video stream is detected, and the motion distance of each corner point can be obtained. When the motion distance of the corner point in the adjacent two frames is greater than the preset pixel distance, the corner point is used as Effectively move the corner points while counting the number of effective motion corner points.
根据所述有效运动角点的数量以及第一预设数量,分析得到所述角点集内的所有角点的检测情况,具体的检测情况为:一种是有效运动角点的数量小于第一预设数量,所述第一预设数量的值比较小,可以设为5~10个,由于提取到的手掌角点数量远远超过5~10个,当有效运动角点的数量小于第一预设数量,即大多数角点都没有进行有效运动,此时可以判断手掌没有进行挥手。According to the number of the effective motion corner points and the first preset number, the detection situation of all the corner points in the corner point set is analyzed, and the specific detection condition is: one is that the number of effective motion corner points is smaller than the first The preset number, the value of the first preset number is relatively small, and can be set to 5 to 10, because the number of extracted palm corner points is far more than 5 to 10, when the number of effective motion corner points is smaller than the first The preset number, that is, most of the corner points are not effectively exercised, and it can be judged that the palm is not waved.
当有效运动角点的数量大于第一预设数量时,即所述检测情况满足预设要求时,根据所述有效运动角点的运动轨迹,分析得到所述有效运动角点内的有效挥手角点数量,在挥手时,手掌肯定会向左向右进行运动,手掌上的角点也会做同样的运动,由此会形成相应的运动轨迹,根据角点的运动轨迹即可以判断手掌挥手。在对有效运动角点进行跟踪检测的时候,不可避免的会丢失目标,因此跟踪得到的有效运动角点数量不会有原始有效运动角点数量这么多,当有效运动角点向左向右都做了有效运动之后,将所述的有效运动角点记为有效挥手角点。当所述有效挥手角点数量大于第二预设数量,则可以判断用户在挥手。When the number of effective motion corner points is greater than the first preset number, that is, when the detection condition satisfies the preset requirement, the effective wave angle in the effective motion corner point is obtained according to the motion trajectory of the effective motion corner point. The number of points, when waving, the palm will definitely move to the left and right, the corners of the palm will also do the same movement, which will form a corresponding movement trajectory, according to the movement trajectory of the corner point can judge the palm of the hand. When tracking and detecting the effective motion corner point, the target will be lost inevitably, so the number of effective motion corner points obtained by tracking will not have so many original effective motion corner points, when the effective motion corner point is left to right. After the effective exercise is performed, the effective motion corner point is recorded as an effective wave corner point. When the number of valid wave corner points is greater than the second preset number, it can be determined that the user is waving.
如图6所示,本发明还提供了一种机器人的挥手检测方法的另一个实施例,包括:As shown in FIG. 6, the present invention further provides another embodiment of a method for detecting a wave of a robot, including:
S11采集不同用户在不同背景下的手掌样本,所述手掌样本包括手掌相对于标准位置在预设角度范围内旋转的样本; S11 collects a palm sample of different users in different backgrounds, wherein the palm sample includes a sample in which the palm rotates within a preset angle range with respect to a standard position;
S21将检测窗口划分为N×N的像素区域,将所述像素区域中的一个中心像素点与相邻的8个相邻像素点的灰度值进行比较,其中N∈{64,32,16,8};S21 divides the detection window into N×N pixel regions, and compares a central pixel point in the pixel region with gray values of adjacent 8 adjacent pixel points, where N∈{64, 32, 16 ,8};
S22若所述相邻像素点的像素值大于中心像素点的像素值,则该相邻像素点被标记为1,否则为0,由此产生8位二进制数,作为所述中心像素点的LBP值,由此可以计算得到所述像素区域内每个像素点的LBP值;S22, if the pixel value of the adjacent pixel is greater than the pixel value of the central pixel, the adjacent pixel is marked as 1, otherwise 0, thereby generating an 8-bit binary number as the LBP of the central pixel a value, whereby an LBP value of each pixel in the pixel region can be calculated;
S23根据所述像素区域内每个像素点得LBP值计算所述像素区域的统计直方图,并对所述统计直方图进行归一化处理;S23: calculating a statistical histogram of the pixel region according to an LBP value of each pixel in the pixel region, and performing normalization processing on the statistical histogram;
S24将所述手掌训练样本每个像素区域的统计直方图进行连接,形成所述手掌训练样本的LBP纹理特征向量;S24, connecting the statistical histogram of each pixel area of the palm training sample to form an LBP texture feature vector of the palm training sample;
S3通过提取处理后的手掌训练样本训练级联分类器;S3 trains the cascade classifier by extracting the processed palm training samples;
S4通过级联分类器在视频流中检测处于标准位置的手掌;S4 detects the palm in the standard position in the video stream through the cascade classifier;
S51通过角点检测算法提取所述处于标准位置的手掌的角点,得到角点集;S51 extracts a corner point of the palm in the standard position by a corner detection algorithm to obtain a corner point set;
S61在视频流中对所述角点集内所有角点进行光流跟踪,根据光流跟踪算法检测所述角点集内所有角点运动后的位置,根据稀疏光流算法计算得到每个角点对应的运动轨迹;S61 performs optical flow tracking on all the corner points in the corner point set in the video stream, detects the position of all the corner points in the corner point set according to the optical flow tracking algorithm, and calculates each corner according to the sparse optical flow algorithm. Point corresponding motion trajectory;
S711根据所述角点集内每个角点在所述视频流中相邻两帧之间的运动轨迹计算所述视频流中相邻两帧之间同一角点的运动距离;S711: calculating a motion distance of the same corner point between two adjacent frames in the video stream according to a motion trajectory between two adjacent frames in the video stream according to each corner point in the corner point set;
S712判断所述运动距离是否大于预设像素距离;S712 determines whether the moving distance is greater than a preset pixel distance;
S713当所述运动距离大于预设像素距离时,判断所述角点进行有效运动,并将所述角点作为所述有效运动角点;S713: when the moving distance is greater than a preset pixel distance, determining that the corner point performs effective motion, and using the corner point as the effective motion corner point;
S714当所述运动距离小于所述预设像素距离时,判定所述角点进行无效运动,并将所述有效运动角点的数量Ntrack减1,最终计算得到的Ntrack即为所述角点集内有效运动角点的数量,Ntrack的初始值为所述角点集中的角点总数量N;S714, when the movement distance is less than the predetermined pixel distance, the corner point determined lost motion, and the motion of the effective corner point N track number minus 1, the final calculated the angle is the N track The number of effective motion corner points in the point set, the initial value of N track is the total number of corner points in the corner point set;
S721判断所述有效运动角点的数量Ntrack是否大于第一预设数量;S721 determines whether the number N Track of the effective motion corner points is greater than the first preset number;
S722当所述有效运动角点的数量Ntrack小于所述第一预设数量时,停 止检测所述有效运动角点的运动轨迹,并判断用户没有挥手;S722 stops detecting the motion track of the effective motion corner point when the number N track of the effective motion corner points is smaller than the first preset number, and determines that the user does not wave;
S723当所述有效运动角点的数量Ntrack大于所述第一预设数量时,继续检测所述有效运动角点的运动轨迹;S723: when the number of effective motion corner points N track is greater than the first preset number, continue to detect a motion trajectory of the effective motion corner point;
S731当所述有效运动角点的数量Ntrack大于所述第一预设数量时,检测所述视频流中相邻两帧之间所述有效运动角点向左运动距离以及向右运动距离;S731: when the number N track of the effective motion corner points is greater than the first preset number, detecting a left moving distance and a right moving distance between the adjacent two moving frames in the video stream;
S732判断视频流中相邻两帧之间所述有效运动角点向左运动距离以及向右运动距离是否都大于预设距离;S732 determines whether the left moving distance and the right moving distance of the effective moving corner between two adjacent frames in the video stream are greater than a preset distance;
S733当视频流中相邻两帧之间所述有效运动角点向左运动距离以及向右运动距离都大于预设距离时,将所述有效运动角点记为有效挥手角点,并将有效挥手角点数量Nmove加1,最终计算得到的Nmove即为所述角点集内有效挥手角点的数量,所述有效挥手角点数量Nmove的初始值为0;S733, when the effective moving corner point leftward moving distance and the rightward moving distance between the adjacent two frames in the video stream are greater than a preset distance, the effective moving corner point is recorded as an effective wave corner point, and is effective The number of wave corner points N move plus 1, the final calculated N move is the number of effective wave corner points in the corner point set, the initial value of the number of effective wave corner points N move is 0;
S741判断所述有效挥手角点数量Nmove是否大于第二预设数量;S741 determines whether the number of valid wave corner points N move is greater than a second preset number;
S742当所述有效挥手角点数量Nmove大于所述第二预设数量时,判断手掌正在挥手;S742: when the number of effective wave corner points N move is greater than the second preset number, determining that the palm is waving;
S743否则,判断手掌没有挥手。S743 Otherwise, judge that the palm does not wave.
具体的,本实施例对如何根据所述角点集内每个角点的运动轨迹判断手掌是否在挥手进行了更加详细地说明。Specifically, the present embodiment describes how to determine whether the palm is waving or not according to the motion trajectory of each corner point in the corner point set.
挥手检测过程具体为:The wave detection process is specifically as follows:
①从视频帧中检测到标准手势开始对手掌进行跟踪,统计手掌区域所有跟踪角点Ai{i=1,2,...N}的运动路径Li{i=1,2,...N},N为手掌区域内的角点总数。规定当Li>0表示该角点运动到标准手势的右方,当Li<0表示该角点运动到标准手势的左边。1 Starting from the detection of the standard gesture in the video frame, the opponent's palm is tracked, and the motion path of all tracking corner points A i {i=1, 2, ..., N} in the palm area is counted as L i {i=1, 2,.. .N}, N is the total number of corner points in the palm area. It is specified that when L i >0 indicates that the corner point moves to the right of the standard gesture, when L i <0 indicates that the corner point moves to the left of the standard gesture.
②当Li<-Dleft表示该角点向左进行了有效运动,该角点的相应标志位Mi,left=true,其中Dleft为向左运动距离的阈值,可以设为两个像素距离;当Li>Dright表示该角点向右进行了有效运动,该角点的相应标志位Mi,right=true,其中Dright为向右运动距离的阈值,可以设为两个像素距离。2 When L i <-D left indicates that the corner point has been effectively moved to the left, the corresponding flag of the corner point is M i,left =true, where D left is the threshold of the leftward moving distance, which can be set to two pixels. Distance; when L i >D right indicates that the corner point has been effectively moved to the right, the corresponding flag of the corner point is M i,right =true, where D right is the threshold of the rightward moving distance, which can be set to two pixels distance.
③当视频流中两帧之间角点Ai的运动路径Li小于两个像素距离,视 为该角点跟踪失效,跟踪有效的角点数量Ntrack减去1,Ntrack的初始值为所述角点集中的角点总数量N。③ When the video stream path of motion between two corner points A i L i is smaller than the distance of two pixels, depending on the failure point for the angle tracking, tracking the number of active corners subtracting N track 1, the initial value of N track The total number of corner points in the corner points is N.
④当跟踪有效的角点总数Ntrack<5时停止跟踪,当跟踪有效的角点总数Ntrack≥5时,继续判断视频流中所述有效运动角点是否向左及向右都进行了有效运动。4 When the total number of corner points that are valid is tracked, N track <5, the tracking is stopped. When the total number of effective corner points is tracked, N track ≥ 5, it is determined whether the effective motion corner point in the video stream is valid both left and right. motion.
⑤当某一角点Ai向左及向右都进行了的有效运动,即运动标识Mi,left=true,Mi,right=true,则有效挥手角点数量Nmove加1。所述有效挥手角点数量Nmove的初始值为0。5 When a certain corner point A i has been effectively moved to the left and to the right, that is, the motion flag M i,left =true, M i,right =true, the number of valid wave corner points N move is increased by one. The initial value of the number of valid wave corner points N move is zero.
⑥实时统计有效挥手角点数量Nmove,当
Figure PCTCN2017112211-appb-000007
时可判断用户正在进行挥手,同时停止角点跟踪并开始新一轮的手掌检测。
6 real-time statistics of the number of effective wave corners N move , when
Figure PCTCN2017112211-appb-000007
It can be judged that the user is waving, while stopping the corner tracking and starting a new round of palm detection.
⑦若果挥手检测有效运动角点总数
Figure PCTCN2017112211-appb-000008
则本次检测无效,开始新一轮的检测。
7 If you wave the total number of effective sports corners
Figure PCTCN2017112211-appb-000008
Then this test is invalid and a new round of testing is started.
本实施例提出一种能够在动态背景下准确识别人手挥动的方法,摄像头能够通过连续的视频帧检测有没有人在挥手。本发明本质上不同于基于帧差法的识别,首先通过手掌检测器在每一帧的图片上检测手掌,一旦检测到手掌即对手掌进行跟踪,通过手掌的运动轨迹进行挥手判断。由于手掌检测是在单帧图片上进行检测而并不需要结合上下的历史图像帧,所以不会受到复杂背景及动态背景的干扰。即该检测方法准确稳定,能够不受复杂背景的影响,即使背景有人或者其他物体的运动干扰,也能准确识别是否在挥手。This embodiment proposes a method for accurately recognizing a human hand waving in a dynamic background, and the camera can detect whether a person is waving through a continuous video frame. The invention is essentially different from the recognition based on the frame difference method. Firstly, the palm is detected on the picture of each frame by the palm detector. Once the palm is detected, the palm is tracked, and the motion trajectory of the palm is used for the wave judgment. Since the palm detection is performed on a single frame picture and does not need to combine the upper and lower historical image frames, it is not interfered by the complex background and the dynamic background. That is to say, the detection method is accurate and stable, and can be free from the influence of complex backgrounds, and can accurately identify whether it is waving even if the motion of the background or other objects interferes.
如图7所示,本发明提供了一种机器人的挥手检测系统的一个实施例,包括:As shown in FIG. 7, the present invention provides an embodiment of a robot's wave detection system, including:
检测模块4,用于通过级联分类器在视频流中检测处于标准位置的手掌;a detecting module 4, configured to detect a palm in a standard position in the video stream by using a cascade classifier;
角点提取模块5,与所述检测模块4电连接,用于提取所述处于标准位置的手掌的角点,得到角点集;a corner point extraction module 5, electrically connected to the detection module 4, for extracting a corner point of the palm in a standard position, to obtain a corner point set;
角点跟踪模块6,与所述角点提取模块5电连接,用于在视频流中对所述角点集内每个角点进行跟踪检测,得到每个角点对应的运动轨迹; The corner tracking module 6 is electrically connected to the corner point extraction module 5 for performing tracking detection on each corner point in the corner point set in the video stream to obtain a motion track corresponding to each corner point;
判断模块7,与所述角点跟踪模块6电连接,用于根据所述角点集内每个角点的运动轨迹判断手掌是否在挥手。The judging module 7 is electrically connected to the corner tracking module 6 for judging whether the palm is waving according to the motion trajectory of each corner point in the corner point set.
首先,机器人调用检测模块通过级联分类器在视频流中检测处于标准位置的手掌;其次,调用角点提取模块提取所述处于标准位置的手掌的角点,得到角点集;再次,调用角点跟踪模块在视频流中对所述角点集内每个角点进行跟踪检测,得到每个角点对应的运动轨迹;最后调用判断模块,根据所述角点集内每个角点的运动轨迹判断手掌是否在挥手。First, the robot call detection module detects the palm in the standard position in the video stream through the cascade classifier; secondly, the corner point extraction module is called to extract the corner point of the palm in the standard position to obtain the corner point set; again, the call angle is The point tracking module performs tracking detection on each corner point in the corner point set in the video stream to obtain a motion track corresponding to each corner point; finally, the judgment module is called, according to the motion of each corner point in the corner point set. The trajectory determines whether the palm is waving.
本实施例中,机器人在采集视频流的时候能够同步检测手掌以及手掌上角点的运动轨迹,不用基于历史图像来进行挥手检测,运用Adaboost级联分类器对手掌的识别率比较高,相对于现有技术,本实施例在复杂背景下、动态背景下也可以准确地在视频流中检测到处于标准位置的手掌,便于后续对手掌角点的跟踪检测。In this embodiment, the robot can synchronously detect the motion trajectory of the palm and the corner of the palm when collecting the video stream, and does not perform the wave detection based on the historical image. The recognition rate of the palm of the hand using the Adaboost cascade classifier is relatively high, compared with In the prior art, in the complex background and the dynamic background, the palm of the standard position can be accurately detected in the video stream, which facilitates the tracking detection of the subsequent palm corner points.
如图8所示,本发明提供了一种机器人的挥手检测系统的一个实施例,在上一个实施例的基础上,还包括:As shown in FIG. 8, the present invention provides an embodiment of a wave detection system for a robot. Based on the previous embodiment, the present invention further includes:
样本制作模块1,用于制作手掌训练样本;Sample production module 1 for making a palm training sample;
特征提取模块2,提取所述手掌训练样本的LBP纹理特征向量,得到提取处理后的手掌训练样本;The feature extraction module 2 extracts an LBP texture feature vector of the palm training sample, and obtains a palm training sample after the extraction process;
分类器训练模块3,与所述特征提取模块2电连接,用于通过提取处理后的手掌训练样本训练级联分类器。The classifier training module 3 is electrically connected to the feature extraction module 2 for training the cascade classifier by extracting the processed palm training samples.
优选的,所述特征提取模块2包括:Preferably, the feature extraction module 2 includes:
处理子模块21,用于将检测窗口划分为N×N的像素区域,将所述像素区域中的一个中心像素点与相邻的8个相邻像素点的灰度值进行比较,其中N∈{64,32,16,8};The processing sub-module 21 is configured to divide the detection window into N×N pixel regions, and compare one central pixel point in the pixel region with gray values of adjacent eight adjacent pixel points, where N∈ {64,32,16,8};
特征值计算子模块22,与所述处理子模块21电连接,若所述相邻像素点的像素值大于中心像素点的像素值,则该相邻像素点被标记为1,否则为0,由此产生8位二进制数,作为所述中心像素点的LBP值,由此可以计算得到所述像素区域内每个像素点的LBP值;The feature value calculation sub-module 22 is electrically connected to the processing sub-module 21, and if the pixel value of the adjacent pixel point is greater than the pixel value of the central pixel point, the adjacent pixel point is marked as 1, otherwise 0. Thereby generating an 8-bit binary number as the LBP value of the central pixel point, whereby the LBP value of each pixel in the pixel region can be calculated;
所述处理子模块21还用于根据所述像素区域内每个像素点得LBP值 计算所述像素区域的统计直方图,并对所述统计直方图进行归一化处理;The processing sub-module 21 is further configured to obtain an LBP value according to each pixel in the pixel region. Calculating a statistical histogram of the pixel region, and normalizing the statistical histogram;
所述处理子模块21还用于将所述手掌训练样本每个像素区域的统计直方图进行连接,形成所述手掌训练样本的LBP纹理特征向量;The processing sub-module 21 is further configured to connect a statistical histogram of each pixel region of the palm training sample to form an LBP texture feature vector of the palm training sample;
所述角点跟踪模块6还用于通过角点检测算法提取所述处于标准位置的手掌的角点,得到角点集,并在视频流中对所述角点集内所有角点进行光流跟踪,根据光流跟踪算法检测所述角点集内所有角点运动后的位置,根据稀疏光流算法计算得到每个角点对应的运动轨迹。The corner tracking module 6 is further configured to extract a corner point of the palm in a standard position by a corner detection algorithm, obtain a corner point set, and perform optical flow on all corner points in the corner point set in the video stream. Tracking, detecting the position of all the corner points in the corner point set according to the optical flow tracking algorithm, and calculating the motion trajectory corresponding to each corner point according to the sparse optical flow algorithm.
如图3所示,用户在挥手过程中手掌在①、②、③位置间来回运动,本实施例采用Adaboost算法结合LBP特征对视频帧中的手掌进行检测。由于该算法不具有旋转不变性,仅能识别手掌在某一标准位置旋转角度在±15°范围内的手掌。本实施例选择手掌处在②位置的手势为标准手掌,其他位置的手势则不能识别。As shown in FIG. 3, the user moves back and forth between the 1, 2, and 3 positions during the waving process. In this embodiment, the Adaboost algorithm is combined with the LBP feature to detect the palm of the video frame. Since the algorithm does not have rotational invariance, it can only recognize the palm of the hand whose rotation angle is within ±15° at a certain standard position. In this embodiment, the gesture of selecting the palm at the 2 position is the standard palm, and the gestures at other positions are not recognized.
级联分类器的训练过程可以分为:1、制作手掌训练样本;2、手掌训练样本LBP特征的提取;3、训练级联分类器。The training process of the cascade classifier can be divided into: 1. Making a palm training sample; 2. Extracting the LBP feature of the palm training sample; 3. Training the cascade classifier.
在采集手掌训练样本的时候,为了便于提取LBP特征值,因此选择的手掌样本为手掌相对于标准位置在预设角度范围内手掌样本,以便更好地提升级联分类器在标准位置附近的手势识别成功率,手掌预设角度范围可以是±15°的范围,即样本包括相对标准位置旋转角度在±15°范围内的手势样本,以更好的提升算法在标准位置附近的手势识别率。采集不同用户在不同背景下的手掌样本时为了提高了样本的多样性,当采集的手掌训练样本之间具一定程度的形状及光照上的差异,获得的检测效果会非常好,能够更大程度地提高了级联分类器对手势识别的成功率。In the process of collecting the palm training samples, in order to facilitate the extraction of the LBP feature values, the selected palm sample is the palm sample of the palm relative to the standard position within the preset angle range, so as to better enhance the gesture of the cascade classifier near the standard position. The recognition success rate, the palm preset angle range may be a range of ±15°, that is, the sample includes a gesture sample with a relative standard position rotation angle within a range of ±15° to better improve the gesture recognition rate of the algorithm near the standard position. In order to improve the diversity of the sample when collecting the palm samples of different users in different backgrounds, when the collected palm training samples have a certain degree of shape and illumination difference, the obtained detection effect will be very good and can be more The success rate of the cascading classifier for gesture recognition is improved.
特征提取模块提取手掌训练样本LBP特征的过程为:a.将检测窗口划分为16×16的小区域(cell),对于每个cell中的一个像素,将相邻的8个像素的灰度值与其进行比较,若周围像素值大于中心像素值,则该像素点的位置被标记为1,否则为0。这样,3*3邻域内的8个点经比较可产生8位二进制数,即得到该窗口中心像素点的LBP值;b.计算每个cell的直方图,即每个数字(假定是十进制数LBP值)出现的频率;对该直方图进行归一 化处理;c.最后将得到的每个cell的统计直方图进行连接成为一个特征向量,也就是整幅图的LBP纹理特征向量。The process of extracting the LBP feature of the palm training sample by the feature extraction module is: a. dividing the detection window into 16×16 small cells, and for each pixel in each cell, the gray value of the adjacent 8 pixels In contrast, if the surrounding pixel value is greater than the center pixel value, the position of the pixel is marked as 1, otherwise 0. Thus, 8 points in the 3*3 neighborhood are compared to produce an 8-bit binary number, that is, the LBP value of the center pixel of the window is obtained; b. The histogram of each cell is calculated, that is, each number (assumed to be a decimal number) The frequency at which the LBP value appears; normalize the histogram Finally, c. Finally, the obtained statistical histogram of each cell is connected into a feature vector, that is, an LBP texture feature vector of the entire image.
训练级联分类器所使用的AdaBoost算法是一种迭代算法,其核心思想是针对同一个训练集训练不同的分类器,即弱分类器,然后把这些弱分类器集合起来,构造一个更强的最终分类器,算法分为以下3步:The AdaBoost algorithm used in the training cascade classifier is an iterative algorithm. The core idea is to train different classifiers, ie weak classifiers, for the same training set, and then combine these weak classifiers to construct a stronger one. The final classifier, the algorithm is divided into the following three steps:
a.初始化训练数据的权值分布。如果有N个样本,则每一个训练样本最开始时都被赋予相同的权值:1/N;a. Initialize the weight distribution of the training data. If there are N samples, each training sample is given the same weight at the beginning: 1/N;
Figure PCTCN2017112211-appb-000009
Figure PCTCN2017112211-appb-000009
b.训练弱分类器。如果某个样本点已经被准确地分类,那么在构造下一个训练集中,它的权值就被降低;相反,如果某个样本点没有被准确地分类,那么它的权值就得到提高。然后,权值更新过的样本集被用于训练下一个分类器,整个训练过程如此迭代地进行下去。使用具有权值分布的训练数据集学习,得到基本分类器(选取让误差率最低的阈值来设计基本分类器):b. Train the weak classifier. If a sample point has been accurately classified, its weight is reduced in constructing the next training set; conversely, if a sample point is not accurately classified, its weight is increased. The weighted updated sample set is then used to train the next classifier, and the entire training process proceeds so iteratively. Using the training dataset with weight distribution to learn, get the basic classifier (choose the threshold with the lowest error rate to design the basic classifier):
Gm(x):x→{-1,+1}G m (x): x→{-1, +1}
计算在训练数据集上的分类误差率:Calculate the classification error rate on the training data set:
Figure PCTCN2017112211-appb-000010
Figure PCTCN2017112211-appb-000010
由上述式子可知,在训练数据集上的误差率就是被误分类样本的权值之和。It can be seen from the above formula that the error rate on the training data set is the sum of the weights of the misclassified samples.
计算的系数,表示在最终分类器中的重要程度(目的:得到基本分类器在最终分类器中所占的权重):The calculated coefficient, indicating the degree of importance in the final classifier (purpose: to get the weight of the basic classifier in the final classifier):
Figure PCTCN2017112211-appb-000011
Figure PCTCN2017112211-appb-000011
由上述式子可知,当
Figure PCTCN2017112211-appb-000012
时,αm≥0,且αm随着em的减小而增大,意味着分类误差率越小的基本分类器在最终分类器中的作用越大。
As can be seen from the above formula, when
Figure PCTCN2017112211-appb-000012
When α m ≥ 0, and α m increases as e m decreases, it means that the smaller the classification error rate, the greater the role of the basic classifier in the final classifier.
更新训练数据集的权值分布(目的:得到样本的新的权值分布),用于下一轮迭代:Update the weight distribution of the training data set (purpose: get the new weight distribution of the sample) for the next iteration:
Dm+1=(wm+1,1,wm+1,2,...,wm+1,N)D m+1 =(w m+1,1 ,w m+1,2 ,...,w m+1,N )
Figure PCTCN2017112211-appb-000013
Figure PCTCN2017112211-appb-000013
使得被基本分类器误分类样本的权值增大,而被正确分类样本的权值减小。就这样,通过这样的方式,Adaboost方法能“重点关注”或“聚焦于”那些较难分的样本上。The weights that are misclassified by the basic classifier are increased, while the weights of the correctly classified samples are reduced. In this way, in this way, the Adaboost method can "focus" or "focus" on those samples that are more difficult to distinguish.
c.将各个训练得到的弱分类器组合成强分类器。各个弱分类器的训练过程结束后,加大分类误差率小的弱分类器的权重,使其在最终的分类函数中起着较大的决定作用,而降低分类误差率大的弱分类器的权重,使其在最终的分类函数中起着较小的决定作用。换言之,误差率低的弱分类器在最终分类器中占的权重较大,否则较小。c. Combine the weak classifiers obtained from each training into a strong classifier. After the training process of each weak classifier is finished, the weight of the weak classifier with small classification error rate is increased, which plays a greater role in determining the final classification function, and reduces the weak classifier with large classification error rate. The weights make it play a smaller role in the final classification function. In other words, a weak classifier with a low error rate has a larger weight in the final classifier, otherwise it is smaller.
组合各个弱分类器,从而得到最终分类器,如下:Combine each weak classifier to get the final classifier, as follows:
Figure PCTCN2017112211-appb-000014
Figure PCTCN2017112211-appb-000014
由于采用了改良过的手掌检测算法,具有以下优点:Thanks to the improved palm detection algorithm, it has the following advantages:
1、该手势检测算法是在单独的视频帧上执行手掌检测,不需要结合前后视频帧的历史数据。1. The gesture detection algorithm performs palm detection on a separate video frame, and does not need to combine historical data of front and rear video frames.
2、该检测算法是通过手掌图像的LBP特征进行检测,计算速度比较快,且能够准确定位到手掌在图像上的位置。2. The detection algorithm is detected by the LBP feature of the palm image, the calculation speed is relatively fast, and the position of the palm on the image can be accurately located.
3、当采集的手掌训练样本之间具一定程度的形状及光照上的差异,获得的检测效果会非常好,识别率高。3. When the collected palm training samples have a certain degree of shape and difference in illumination, the obtained detection effect will be very good and the recognition rate is high.
如图9所示,本发明提供了一种机器人的挥手检测系统的一个实施例,包括:As shown in FIG. 9, the present invention provides an embodiment of a robot's wave detection system, including:
检测模块4,用于通过级联分类器在视频流中检测处于标准位置的手掌;a detecting module 4, configured to detect a palm in a standard position in the video stream by using a cascade classifier;
角点提取模块5,与所述检测模块4电连接,用于提取所述处于标准位置的手掌的角点,得到角点集;a corner point extraction module 5, electrically connected to the detection module 4, for extracting a corner point of the palm in a standard position, to obtain a corner point set;
角点跟踪模块6,与所述角点提取模块5电连接,用于在视频流中对所述角点集内每个角点进行跟踪检测,得到每个角点对应的运动轨迹;The corner tracking module 6 is electrically connected to the corner point extraction module 5 for performing tracking detection on each corner point in the corner point set in the video stream to obtain a motion track corresponding to each corner point;
判断模块7,与所述角点跟踪模块6电连接,用于根据所述角点集内每个角点的运动轨迹判断手掌是否在挥手;The judging module 7 is electrically connected to the corner tracking module 6 for judging whether the palm is waving according to the motion trajectory of each corner point in the corner point set;
所述判断模块7包括: The determining module 7 includes:
分析子模块71,根据所述角点集内每个角点在视频流中相邻两帧之间的运动轨迹以及预设像素距离,分析得到所述角点集内有效运动角点的数量;The analyzing sub-module 71 analyzes, according to the motion trajectory between two adjacent frames in the video stream and the preset pixel distance, the number of effective motion corner points in the corner point set is obtained;
所述分析子模块71还用于根据所述有效运动角点的数量以及第一预设数量,分析得到所述角点集内的所有角点的检测情况;The analysis sub-module 71 is further configured to analyze, according to the number of the effective motion corner points and the first preset number, the detection status of all the corner points in the corner point set;
所述分析子模块71还用于在所述检测情况满足预设要求时,根据所述有效运动角点的运动轨迹,分析得到所述有效运动角点内的有效挥手角点数量;The analysis sub-module 71 is further configured to analyze, according to the motion trajectory of the effective motion corner point, the number of effective wave corner points in the effective motion corner point when the detection condition satisfies a preset requirement;
判断子模块72,与所述分析子模块71电连接,用于根据所述有效挥手角点数量以及第二预设数量,判断用户是否在挥手;The determining sub-module 72 is electrically connected to the analyzing sub-module 71, and is configured to determine whether the user is waving according to the number of valid wave corner points and the second preset number;
所述判断模块7还包括:The determining module 7 further includes:
计算子模块73,用于根据所述角点集内每个角点在所述视频流中相邻两帧之间的运动轨迹计算所述视频流中相邻两帧之间同一角点的运动距离;a calculation sub-module 73, configured to calculate, according to a motion trajectory between two adjacent frames in the video stream, the motion of the same corner between the adjacent two frames in the video stream distance;
所述判断子模块72,还与所述计算子模块73电连接,用于判断所述运动距离是否大于预设像素距离;The determining sub-module 72 is further electrically connected to the calculating sub-module 73, and configured to determine whether the moving distance is greater than a preset pixel distance;
所述判断子模块72还用于当所述运动距离大于预设像素距离时,判断所述角点进行有效运动,并将所述角点作为所述有效运动角点;The determining sub-module 72 is further configured to: when the moving distance is greater than a preset pixel distance, determine that the corner point performs effective motion, and use the corner point as the effective motion corner point;
判断子模块72还用于当所述运动距离小于所述预设像素距离时,判定所述角点进行无效运动,并将所述有效运动角点的数量Ntrack减1,最终计算得到的Ntrack即为所述角点集内有效运动角点的数量,Ntrack的初始值为所述角点集中的角点总数量N;Determining sub-module 72 is further configured, when the movement distance is less than the predetermined pixel distance, the corner point determined lost motion, and the motion of the effective number of corners Track N minus 1, finally calculated N Track is the number of effective motion corner points in the corner set, and the initial value of N track is the total number N of corner points in the corner set;
所述判断子模块72还用于判断所述有效运动角点的数量Ntrack是否大于第一预设数量;The determining sub-module 72 is further configured to determine whether the number N Track of the effective motion corner points is greater than the first preset number;
所述判断子模块72还用于当所述有效运动角点的数量Ntrack小于所述第一预设数量时,停止检测所述有效运动角点的运动轨迹,并判断用户没有挥手;The determining sub-module 72 is further configured to stop detecting the motion track of the effective motion corner point when the number N track of the effective motion corner points is less than the first preset number, and determine that the user does not wave;
所述判断子模块72还用于当所述有效运动角点的数量Ntrack大于所述 第一预设数量时,继续检测所述有效运动角点的运动轨迹。The determining sub-module 72 is further configured to continue to detect a motion trajectory of the effective motion corner point when the number N track of the effective motion corner points is greater than the first preset number.
所述判断模块7还包括检测子模块74,用于当所述有效运动角点的数量Ntrack大于所述第一预设数量时,检测所述视频流中相邻两帧之间所述有效运动角点向左运动距离以及向右运动距离;The determining module 7 further comprising detecting sub-module 74, configured to, when moving the active corners N track number is greater than the first predetermined number, the video stream is detected in between two adjacent ones of said active The moving angle of the moving corner to the left and the distance to the right;
所述判断子模块72还用于判断视频流中相邻两帧之间所述有效运动角点向左运动距离以及向右运动距离是否都大于预设距离;The determining sub-module 72 is further configured to determine whether the left moving distance and the right moving distance of the effective moving corner point between the adjacent two frames in the video stream are greater than a preset distance;
所述判断子模块72还用于当视频流中相邻两帧之间所述有效运动角点向左运动距离以及向右运动距离都大于预设距离时,将所述有效运动角点记为有效挥手角点,并将有效挥手角点数量Nmove加1,最终计算得到的Nmove即为所述角点集内有效挥手角点的数量,所述有效挥手角点数量Nmove的初始值为0;The determining sub-module 72 is further configured to: when the effective moving corner point leftward moving distance and the rightward moving distance between the adjacent two frames in the video stream are greater than a preset distance, the effective moving corner point is recorded as Effectively wave the corner point and increase the number of effective wave corner points N move by 1. The final calculated N move is the number of effective wave corner points in the corner point set, and the initial value of the number of valid wave corner points N move Is 0;
所述判断子模块72还用于判断所述有效挥手角点数量Nmove是否大于第二预设数量;The determining sub-module 72 is further configured to determine whether the number of valid wave corner points N move is greater than a second preset number;
所述判断子模块72还用于当所述有效挥手角点数量Nmove大于所述第二预设数量时,判断手掌正在挥手;否则,判断手掌没有挥手;The determining sub-module 72 is further configured to: when the number of valid wave corner points N move is greater than the second preset number, determine that the palm is waving; otherwise, determine that the palm has not waved;
样本制作模块,用于制作手掌训练样本;a sample making module for making a palm training sample;
特征提取模块1,提取所述手掌训练样本的LBP纹理特征向量,得到提取处理后的手掌训练样本;The feature extraction module 1 extracts an LBP texture feature vector of the palm training sample, and obtains a palm training sample after the extraction process;
分类器训练模块3,与所述特征提取模块2电连接,用于通过提取处理后的手掌训练样本训练级联分类器;a classifier training module 3, electrically connected to the feature extraction module 2, for training the cascade classifier by extracting the processed palm training samples;
所述特征提取模块2包括:The feature extraction module 2 includes:
处理子模块21,用于将检测窗口划分为N×N的像素区域,将所述像素区域中的一个中心像素点与相邻的8个相邻像素点的灰度值进行比较,其中N∈{64,32,16,8};The processing sub-module 21 is configured to divide the detection window into N×N pixel regions, and compare one central pixel point in the pixel region with gray values of adjacent eight adjacent pixel points, where N∈ {64,32,16,8};
特征值计算子模块22,与所述处理子模块21电连接,若所述相邻像素点的像素值大于中心像素点的像素值,则该相邻像素点被标记为1,否则为0,由此产生8位二进制数,作为所述中心像素点的LBP值,由此可以计算得到所述像素区域内每个像素点的LBP值; The feature value calculation sub-module 22 is electrically connected to the processing sub-module 21, and if the pixel value of the adjacent pixel point is greater than the pixel value of the central pixel point, the adjacent pixel point is marked as 1, otherwise 0. Thereby generating an 8-bit binary number as the LBP value of the central pixel point, whereby the LBP value of each pixel in the pixel region can be calculated;
所述处理子模块21还用于根据所述像素区域内每个像素点得LBP值计算所述像素区域的统计直方图,并对所述统计直方图进行归一化处理;The processing sub-module 21 is further configured to calculate a statistical histogram of the pixel region according to an LBP value of each pixel in the pixel region, and perform normalization processing on the statistical histogram;
所述处理子模块21还用于将所述手掌训练样本每个像素区域的统计直方图进行连接,形成所述手掌训练样本的LBP纹理特征向量;The processing sub-module 21 is further configured to connect a statistical histogram of each pixel region of the palm training sample to form an LBP texture feature vector of the palm training sample;
所述角点跟踪模块6还用于通过角点检测算法提取所述处于标准位置的手掌的角点,得到角点集,并在视频流中对所述角点集内所有角点进行光流跟踪,根据光流跟踪算法检测所述角点集内所有角点运动后的位置,根据稀疏光流算法计算得到每个角点对应的运动轨迹。The corner tracking module 6 is further configured to extract a corner point of the palm in a standard position by a corner detection algorithm, obtain a corner point set, and perform optical flow on all corner points in the corner point set in the video stream. Tracking, detecting the position of all the corner points in the corner point set according to the optical flow tracking algorithm, and calculating the motion trajectory corresponding to each corner point according to the sparse optical flow algorithm.
本实施例具体阐述了手掌角点的检测、跟踪,以及根据角点的运动轨迹如何检测挥手的过程。This embodiment specifically describes the detection, tracking of the palm corner points, and how to detect the waved motion according to the motion trajectory of the corner points.
具体的,如图5所示,手掌运动的检测、跟踪的过程。①为在视频帧中检测到处于标准位置的手掌;②为通过角点检测算法提取到手掌区域内的角点,该提取出来的角点有多个,在图中示意性的给出了一部分,标黑的点即为检测到的角点;③为手掌在视频帧中处于标准位置时检测到的角点初始位置,以该点作为初始位置对视频帧进行光流跟踪;④、⑤为在接下来视频帧中通过光流跟踪算法检测到的角点的运动后的位置;L1、L2为在手掌挥动过程中通过稀疏光流算法跟踪到手角点的运动路径。Specifically, as shown in FIG. 5, the process of detecting and tracking the movement of the palm. 1 is the palm in the video frame detected in the standard position; 2 is the corner point extracted into the palm area by the corner detection algorithm, and the extracted corner points are multiple, and a part of the figure is schematically shown in the figure. The black point is the detected corner point; 3 is the initial position of the corner detected when the palm is in the standard position in the video frame, and the optical frame is tracked by using the point as the initial position; 4, 5 are The position of the corner point detected by the optical flow tracking algorithm in the next video frame; L1, L2 are the motion paths tracked to the hand corner point by the sparse optical flow algorithm during the palm waving process.
本实施例中,对角点的提取方法采用角点检测算法,能够有效地提取手掌区域的角点,除此以外,还可以用其他特征点的提取方法,如FAST特征点提取方法等等,此处不再赘述。对角点在视频流中的跟踪采用的是光流跟踪算法,能够在视频流中对每个角点进行有效的跟踪,提高了跟踪的有效程度,通过稀疏光流算法可以更好地检测角点的运动轨迹,便于之后对挥手的检测过程。In this embodiment, the corner point extraction method adopts a corner point detection algorithm, which can effectively extract the corner points of the palm area, and in addition, other feature point extraction methods, such as the FAST feature point extraction method, etc., can be used. I will not repeat them here. The tracking of diagonal points in the video stream uses an optical flow tracking algorithm, which can effectively track each corner point in the video stream, which improves the effective degree of tracking, and can better detect the angle by the sparse optical flow algorithm. The trajectory of the point is convenient for the subsequent detection process of the wave.
检测视频流中相邻两帧之间各个角点的运动轨迹,可以得到各个角点的运动距离,当相邻两帧中角点的运动距离大于预设像素距离时,将所述角点作为有效运动角点,同时统计有效运动角点的数量。The motion trajectory of each corner point between two adjacent frames in the video stream is detected, and the motion distance of each corner point can be obtained. When the motion distance of the corner point in the adjacent two frames is greater than the preset pixel distance, the corner point is used as Effectively move the corner points while counting the number of effective motion corner points.
根据所述有效运动角点的数量以及第一预设数量,分析得到所述角点集内的所有角点的检测情况,具体的检测情况为:一种是有效运动角点的 数量小于第一预设数量,所述第一预设数量的值比较小,可以设为5~10个,由于提取到的手掌角点数量远远超过5~10个,当有效运动角点的数量小于第一预设数量,即大多数角点都没有进行有效运动,此时可以判断手掌没有进行挥手。According to the number of the effective motion corner points and the first preset number, the detection situation of all the corner points in the corner point set is obtained, and the specific detection condition is: one is the effective motion corner point The quantity is smaller than the first preset quantity, and the value of the first preset quantity is relatively small, and can be set to 5 to 10, because the number of extracted palm corner points is far more than 5-10, when the effective movement corner point The number is smaller than the first preset number, that is, most of the corner points are not effectively moved, and it can be judged that the palm is not waved.
当有效运动角点的数量大于第一预设数量时,即所述检测情况满足预设要求时,根据所述有效运动角点的运动轨迹,分析得到所述有效运动角点内的有效挥手角点数量,在挥手时,手掌肯定会向左向右进行运动,手掌上的角点也会做同样的运动,由此会形成相应的运动轨迹,根据角点的运动轨迹即可以判断手掌挥手。在对有效运动角点进行跟踪检测的时候,不可避免的会丢失目标,因此跟踪得到的有效运动角点数量不会有原始有效运动角点数量这么多,当有效运动角点向左向右都做了有效运动之后,将所述的有效运动角点记为有效挥手角点。当所述有效挥手角点数量大于第二预设数量,则可以判断用户在挥手。When the number of effective motion corner points is greater than the first preset number, that is, when the detection condition satisfies the preset requirement, the effective wave angle in the effective motion corner point is obtained according to the motion trajectory of the effective motion corner point. The number of points, when waving, the palm will definitely move to the left and right, the corners of the palm will also do the same movement, which will form a corresponding movement trajectory, according to the movement trajectory of the corner point can judge the palm of the hand. When tracking and detecting the effective motion corner point, the target will be lost inevitably, so the number of effective motion corner points obtained by tracking will not have so many original effective motion corner points, when the effective motion corner point is left to right. After the effective exercise is performed, the effective motion corner point is recorded as an effective wave corner point. When the number of valid wave corner points is greater than the second preset number, it can be determined that the user is waving.
具体的,本实施例对如何根据所述角点集内每个角点的运动轨迹判断手掌是否在挥手进行了更加详细地说明,挥手检测过程具体为:Specifically, in this embodiment, how to determine whether the palm is waved according to the motion track of each corner point in the corner point set is described in more detail. The wave detection process is specifically:
①从视频帧中检测到标准手势开始对手掌进行跟踪,统计手掌区域所有跟踪角点Ai{i=1,2,...N}的运动路径Li{i=1,2,...N},N为手掌区域内的角点总数。规定当Li>0表示该角点运动到标准手势的右方,当Li<0表示该角点运动到标准手势的左边。1 Starting from the detection of the standard gesture in the video frame, the opponent's palm is tracked, and the motion path of all tracking corner points A i {i=1, 2, ..., N} in the palm area is counted as L i {i=1, 2,.. .N}, N is the total number of corner points in the palm area. It is specified that when L i >0 indicates that the corner point moves to the right of the standard gesture, when L i <0 indicates that the corner point moves to the left of the standard gesture.
②当Li<-Dleft表示该角点向左进行了有效运动,该角点的相应标志位Mi,left=true,其中Dleft为向左运动距离的阈值,可以设为两个像素距离;当Li>Dright表示该角点向右进行了有效运动,该角点的相应标志位Mi,right=true,其中Dright为向右运动距离的阈值,可以设为两个像素距离;2 When L i <-D left indicates that the corner point has been effectively moved to the left, the corresponding flag of the corner point is M i,left =true, where D left is the threshold of the leftward moving distance, which can be set to two pixels. Distance; when L i >D right indicates that the corner point has been effectively moved to the right, the corresponding flag of the corner point is M i,right =true, where D right is the threshold of the rightward moving distance, which can be set to two pixels distance;
③当视频流中两帧之间角点Ai的运动路径Li小于两个像素距离,视为该角点跟踪失效,跟踪有效的角点数量Ntrack减去1,Ntrack的初始值为所述角点集中的角点总数量N;③ When the video stream path of movement of the corner points A i L i between two pixel distance is less than two, considered the failure point tracking angle, the tracking number of corners effectively subtracting N track 1, the initial value of N track The total number of corner points in the corner points is N;
④当跟踪有效的角点总数Ntrack<5时停止跟踪,当跟踪有效的角点总数Ntrack≥5时,继续判断视频流中所述有效运动角点是否向左及向右都进行 了有效运动,4 When the total number of corner points that are valid is tracked, N track <5, the tracking is stopped. When the total number of effective corner points is tracked, N track ≥ 5, it is determined whether the effective motion corner point in the video stream is valid both left and right. motion,
⑤当某一角点Ai向左及向右都进行了的有效运动,即运动标识Mi,left=true,Mi,right=true,则有效挥手角点数量Nmove加1。所述有效挥手角点数量Nmove的初始值为0;5 When a certain corner point A i has been effectively moved to the left and to the right, that is, the motion flag M i,left =true, M i,right =true, the number of valid wave corner points N move is increased by one. The initial value of the number of effective wave corner points N move is 0;
⑥实时统计有效挥手角点数量Nmove,当
Figure PCTCN2017112211-appb-000015
时可判断用户正在进行挥手,同时停止角点跟踪并开始新一轮的手掌检测。
6 real-time statistics of the number of effective wave corners N move , when
Figure PCTCN2017112211-appb-000015
It can be judged that the user is waving, while stopping the corner tracking and starting a new round of palm detection.
⑦若果挥手检测有效运动角点总数
Figure PCTCN2017112211-appb-000016
则本次检测无效,开始新一轮的检测。
7 If you wave the total number of effective sports corners
Figure PCTCN2017112211-appb-000016
Then this test is invalid and a new round of testing is started.
本实施例提出一种能够在动态背景下准确识别人手挥动的方法,摄像头能够通过连续的视频帧检测有没有人在挥手。本发明本质上不同于基于帧差法的识别,首先通过手掌检测器在每一帧的图片上检测手掌,一旦检测到手掌即对手掌进行跟踪,通过手掌的运动轨迹进行挥手判断。由于手掌检测是在单帧图片上进行检测而并不需要结合上下的历史图像帧,所以不会受到复杂背景及动态背景的干扰。即该检测方法准确稳定,能够不受复杂背景的影响,即使背景有人或者其他物体的运动干扰,也能准确识别是否在挥手。This embodiment proposes a method for accurately recognizing a human hand waving in a dynamic background, and the camera can detect whether a person is waving through a continuous video frame. The invention is essentially different from the recognition based on the frame difference method. Firstly, the palm is detected on the picture of each frame by the palm detector. Once the palm is detected, the palm is tracked, and the motion trajectory of the palm is used for the wave judgment. Since the palm detection is performed on a single frame picture and does not need to combine the upper and lower historical image frames, it is not interfered by the complex background and the dynamic background. That is to say, the detection method is accurate and stable, and can be free from the influence of complex backgrounds, and can accurately identify whether it is waving even if the motion of the background or other objects interferes.
应当说明的是,上述实施例均可根据需要自由组合。以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。 It should be noted that the above embodiments can be freely combined as needed. The above description is only a preferred embodiment of the present invention, and it should be noted that those skilled in the art can also make several improvements and retouchings without departing from the principles of the present invention. It should be considered as the scope of protection of the present invention.

Claims (14)

  1. 一种机器人的挥手检测方法,其特征在于,包括:A method for detecting a wave of a robot, comprising:
    通过级联分类器在视频流中检测处于标准位置的手掌;The palm of the standard position is detected in the video stream by the cascade classifier;
    提取所述处于标准位置的手掌的角点,得到角点集;Extracting a corner point of the palm in the standard position to obtain a corner point set;
    在视频流中对所述角点集内每个角点进行跟踪检测,得到每个角点对应的运动轨迹;Tracking and detecting each corner point in the corner point set in the video stream, and obtaining a motion track corresponding to each corner point;
    根据所述角点集内每个角点的运动轨迹判断手掌是否在挥手。Whether the palm is waving or not is determined according to the motion trajectory of each corner point in the corner point set.
  2. 如权利要求1所述的一种机器人的挥手检测方法,其特征在于,根据所述角点集内每个角点的运动轨迹判断用户是否在挥手具体包括:The method for detecting a wave of a robot according to claim 1, wherein determining whether the user is waving according to the motion trajectory of each corner point in the corner point set comprises:
    根据所述角点集内每个角点在视频流中相邻两帧之间的运动轨迹以及预设像素距离,分析得到所述角点集内有效运动角点的数量;Obtaining, according to the motion trajectory between adjacent two frames in the video stream and the preset pixel distance of each corner point in the corner point set, the number of effective motion corner points in the corner point set is obtained;
    当所述有效运动角点的数量大于第一预设数量时,继续对所述角点集内的所有角点进行跟踪检测;When the number of the effective motion corner points is greater than the first preset number, tracking detection is continued for all corner points in the corner point set;
    根据所述有效运动角点的运动轨迹,分析得到所述有效运动角点内的有效挥手角点数量;Obtaining, according to the motion trajectory of the effective motion corner point, the number of effective wave corner points in the effective motion corner point;
    当所述有效挥手角点数量大于第二预设数量,判断用户在挥手。When the number of valid wave corner points is greater than the second preset number, it is determined that the user is waving.
  3. 如权利要求2所述的一种机器人的挥手检测方法,其特征在于,根据所述角点集内每个角点在视频流相邻两帧之间的运动轨迹以及预设像素距离,分析得到所述角点集内有效运动角点的数量具体包括:The method for detecting a wave of a robot according to claim 2, wherein the trajectory of each corner point in the corner point set between two adjacent frames of the video stream and the preset pixel distance are analyzed. The number of effective motion corner points in the set of corner points specifically includes:
    根据所述角点集内每个角点在所述视频流中相邻两帧之间的运动轨迹,计算所述视频流中相邻两帧之间同一角点的运动距离;Calculating a motion distance of the same corner point between adjacent two frames in the video stream according to a motion trajectory between adjacent two frames in the video stream in each corner point of the video point set;
    判断所述运动距离是否大于预设像素距离;Determining whether the moving distance is greater than a preset pixel distance;
    当所述运动距离大于预设像素距离时,判定所述角点进行有效运动,并将所述角点作为所述有效运动角点;When the moving distance is greater than a preset pixel distance, determining that the corner point performs effective motion, and using the corner point as the effective motion corner point;
    当所述运动距离小于所述预设像素距离时,判定所述角点进行无效运动,并将所述有效运动角点的数量Ntrack减1,最终计算得到的Ntrack即 为所述角点集内有效运动角点的数量,Ntrack的初始值为所述角点集中的角点总数量N。When the movement distance is less than the predetermined pixel distance, the corner point determined lost motion, and said effective amount of N track motion corner point minus 1, the final calculated the corner point is the N track The number of effective motion corner points in the set, and the initial value of N track is the total number N of corner points in the corner point set.
  4. 如权利要求1~3中任一项所述的一种机器人的挥手检测方法,其特征在于,通过级联分类器在视频流中检测处于标准位置的手掌之前包括:The method for detecting a wave of a robot according to any one of claims 1 to 3, wherein before the palm of the standard position is detected in the video stream by the cascade classifier, the method comprises:
    制作手掌训练样本;Make a palm training sample;
    提取所述手掌训练样本的LBP纹理特征向量,得到提取处理后的手掌训练样本;Extracting an LBP texture feature vector of the palm training sample, and obtaining a palm training sample after the extraction process;
    通过提取处理后的手掌训练样本训练级联分类器。The cascade classifier is trained by extracting the processed palm training samples.
  5. 如权利要求4所述的一种机器人的挥手检测方法,其特征在于,制作手掌训练样本具体包括:The method for detecting a wave of a robot according to claim 4, wherein the preparing the palm training sample comprises:
    采集不同用户在不同背景下的手掌样本,所述手掌样本包括手掌相对于标准位置在预设角度范围内旋转的样本。A sample of the palm of a different user in a different background is captured, the sample of the palm including a sample of the palm that rotates within a predetermined range of angles relative to the standard position.
  6. 如权利要求4所述的一种机器人的挥手检测方法,其特征在于,提取所述手掌训练样本的LBP纹理特征向量的过程具体包括:The method of claim 4, wherein the process of extracting the LBP texture feature vector of the palm training sample comprises:
    将检测窗口划分为N×N的像素区域,将所述像素区域中的一个中心像素点与相邻的8个相邻像素点的灰度值进行比较,其中N∈{64,32,16,8};Dividing the detection window into N×N pixel regions, comparing a central pixel point in the pixel region with gray values of adjacent 8 adjacent pixel points, where N∈{64, 32, 16, 8};
    若所述相邻像素点的像素值大于中心像素点的像素值,则该相邻像素点被标记为1,否则为0,由此产生8位二进制数,作为所述中心像素点的LBP值,由此可以计算得到所述像素区域内每个像素点的LBP值;If the pixel value of the adjacent pixel is greater than the pixel value of the central pixel, the adjacent pixel is marked as 1, otherwise 0, thereby generating an 8-bit binary number as the LBP value of the central pixel Thereby, the LBP value of each pixel in the pixel region can be calculated;
    根据所述像素区域内每个像素点得LBP值计算所述像素区域的统计直方图,并对所述统计直方图进行归一化处理;Calculating a statistical histogram of the pixel region according to an LBP value of each pixel in the pixel region, and normalizing the statistical histogram;
    将所述手掌训练样本每个像素区域的统计直方图进行连接,形成所述手掌训练样本的LBP纹理特征向量。 A statistical histogram of each pixel region of the palm training sample is connected to form an LBP texture feature vector of the palm training sample.
  7. 如权利要求1~3中任一项所述的一种机器人的挥手检测方法,其特征在于,提取处于标准位置的手掌的角点,得到角点集,以及在视频流中对所述角点集内每个角点进行跟踪检测,得到每个角点对应的运动轨迹具体为:A method for detecting a wave of a robot according to any one of claims 1 to 3, wherein a corner point of a palm at a standard position is extracted, a corner point set is obtained, and the corner point is obtained in the video stream. Each corner point in the set is tracked and detected, and the motion track corresponding to each corner point is obtained as follows:
    通过角点检测算法提取所述处于标准位置的手掌的角点,得到角点集,并在视频流中对所述角点集内每个角点进行光流跟踪,根据光流跟踪算法检测所述角点集内每个角点运动后的位置,根据稀疏光流算法计算得到每个角点对应的运动轨迹。Extracting a corner point of the palm in the standard position by a corner detection algorithm to obtain a corner point set, and performing optical flow tracking on each corner point in the corner point set in the video stream, and detecting the optical flow tracking algorithm according to the optical flow tracking algorithm The position of each corner point in the corner point set is calculated, and the motion trajectory corresponding to each corner point is calculated according to the sparse optical flow algorithm.
  8. 一种机器人的挥手检测系统,其特征在于,包括:A wave detection system for a robot, comprising:
    检测模块,用于通过级联分类器在视频流中检测处于标准位置的手掌;a detecting module, configured to detect a palm in a standard position in the video stream by using a cascade classifier;
    角点提取模块,与所述检测模块电连接,用于提取所述处于标准位置的手掌的角点,得到角点集;a corner point extraction module, electrically connected to the detection module, for extracting a corner point of the palm in a standard position, to obtain a corner point set;
    角点跟踪模块,与所述角点提取模块电连接,用于在视频流中对所述角点集内每个角点进行跟踪检测,得到每个角点对应的运动轨迹;The corner tracking module is electrically connected to the corner point extraction module, and is configured to perform tracking detection on each corner point in the corner point set in the video stream to obtain a motion track corresponding to each corner point;
    判断模块,与所述角点跟踪模块电连接,用于根据所述角点集内每个角点的运动轨迹判断手掌是否在挥手。The judging module is electrically connected to the corner tracking module for determining whether the palm is waving according to the motion trajectory of each corner point in the corner point set.
  9. 如权利要求8所述的一种机器人的挥手检测系统,其特征在于,所述判断模块包括:The wave detection system of a robot according to claim 8, wherein the determining module comprises:
    分析子模块,根据所述角点集内每个角点在视频流中相邻两帧之间的运动轨迹以及预设像素距离,分析得到所述角点集内有效运动角点的数量;The analysis sub-module analyzes the number of effective motion corner points in the corner point set according to the motion track between the adjacent two frames in the video stream and the preset pixel distance of each corner point in the corner point set;
    所述分析子模块还用于当所述有效运动角点的数量大于第一预设数量时,继续对所述角点集内的所有角点进行跟踪检测;The analysis sub-module is further configured to continue tracking detection of all corner points in the corner point set when the number of the effective motion corner points is greater than the first preset number;
    所述分析子模块还用于根据所述有效运动角点的运动轨迹,分析得 到所述有效运动角点内的有效挥手角点数量;The analysis sub-module is further configured to analyze according to the motion trajectory of the effective motion corner point The number of effective wave corners within the effective motion corner;
    判断子模块,与所述分析子模块电连接,用于当所述有效挥手角点数量大于第二预设数量,判断用户在挥手。The determining sub-module is electrically connected to the analyzing sub-module, and is configured to determine that the user is waving when the number of valid waving corner points is greater than the second preset number.
  10. 如权利要求9所述的一种机器人的挥手检测系统,其特征在于,所述判断模块还包括:The wave detection system of the robot according to claim 9, wherein the determining module further comprises:
    计算子模块,用于根据所述角点集内每个角点在所述视频流中相邻两帧之间的运动轨迹计算所述视频流中相邻两帧之间同一角点的运动距离;a calculation submodule, configured to calculate a moving distance of the same corner point between adjacent two frames in the video stream according to a motion trajectory between two adjacent frames in the video stream according to each corner point in the corner point set ;
    所述判断子模块,还与所述计算子模块电连接,用于判断所述运动距离是否大于预设像素距离;The determining sub-module is further electrically connected to the computing sub-module, and configured to determine whether the moving distance is greater than a preset pixel distance;
    所述判断子模块还用于当所述运动距离大于预设像素距离时,判断所述角点进行有效运动,并将所述角点作为所述有效运动角点;The determining sub-module is further configured to: when the moving distance is greater than a preset pixel distance, determine that the corner point performs effective motion, and use the corner point as the effective motion corner point;
    所述判断子模块还用于当所述运动距离小于所述预设像素距离时,判定所述角点进行无效运动,并将所述有效运动角点的数量Ntrack减1,最终计算得到的Ntrack即为所述角点集内有效运动角点的数量,Ntrack的初始值为所述角点集中的角点总数量N。The determining sub-module is further configured to: when the moving distance is less than the preset pixel distance, determine that the corner point performs an invalid motion, and decrement the number N Track of the effective motion corner point by a final calculation. N track is the number of effective motion corner points in the corner point set, and the initial value of N track is the total number N of corner points in the corner point set.
  11. 如权利要求8~10中任一项所述的一种机器人的挥手检测方法,其特征在于,还包括:The method for detecting a wave of a robot according to any one of claims 8 to 10, further comprising:
    样本制作模块,用于制作手掌训练样本;a sample making module for making a palm training sample;
    特征提取模块,提取所述手掌训练样本的LBP纹理特征向量,得到提取处理后的手掌训练样本;a feature extraction module, extracting an LBP texture feature vector of the palm training sample, and obtaining a palm training sample after the extraction process;
    分类器训练模块,与所述特征提取模块电连接,用于通过提取处理后的手掌训练样本训练级联分类器。The classifier training module is electrically connected to the feature extraction module for training the cascade classifier by extracting the processed palm training samples.
  12. 如权利要求11所述的一种机器人的挥手检测系统,其特征在于,所述特征提取模块包括: A wave detection system for a robot according to claim 11, wherein the feature extraction module comprises:
    处理子模块,用于将检测窗口划分为N×N的像素区域,将所述像素区域中的一个中心像素点与相邻的8个相邻像素点的灰度值进行比较,其中N∈{64,32,16,8};a processing sub-module, configured to divide the detection window into N×N pixel regions, and compare one central pixel point in the pixel region with gray values of adjacent eight adjacent pixel points, where N∈{ 64,32,16,8};
    特征值计算子模块,与所述处理子模块电连接,若所述相邻像素点的像素值大于中心像素点的像素值,则该相邻像素点被标记为1,否则为0,由此产生8位二进制数,作为所述中心像素点的LBP值,由此可以计算得到所述像素区域内每个像素点的LBP值;The feature value calculation sub-module is electrically connected to the processing sub-module. If the pixel value of the adjacent pixel point is greater than the pixel value of the central pixel point, the adjacent pixel point is marked as 1, otherwise 0. Generating an 8-bit binary number as the LBP value of the central pixel point, thereby calculating an LBP value of each pixel in the pixel region;
    所述处理子模块还用于根据所述像素区域内每个像素点得LBP值计算所述像素区域的统计直方图,并对所述统计直方图进行归一化处理;The processing sub-module is further configured to calculate a statistical histogram of the pixel region according to an LBP value of each pixel in the pixel region, and perform normalization processing on the statistical histogram;
    所述处理子模块还用于将所述手掌训练样本每个像素区域的统计直方图进行连接,形成所述手掌训练样本的LBP纹理特征向量。The processing sub-module is further configured to connect a statistical histogram of each pixel region of the palm training sample to form an LBP texture feature vector of the palm training sample.
  13. 如权利要求8~10中任一项所述的一种机器人的挥手检测系统,其特征在于:A wave detection system for a robot according to any one of claims 8 to 10, characterized in that:
    所述角点跟踪模块还用于通过角点检测算法提取所述处于标准位置的手掌的角点,得到角点集,并在视频流中对所述角点集内每个角点进行光流跟踪,根据光流跟踪算法检测所述角点集内所有角点运动后的位置,根据稀疏光流算法计算得到每个角点对应的运动轨迹。The corner tracking module is further configured to extract a corner point of the palm in a standard position by a corner detection algorithm, obtain a corner point set, and perform optical flow on each corner point in the corner point set in the video stream. Tracking, detecting the position of all the corner points in the corner point set according to the optical flow tracking algorithm, and calculating the motion trajectory corresponding to each corner point according to the sparse optical flow algorithm.
  14. 一种机器人,其特征在于,集成有如权利要求8~13中任一项所述的一种机器人的挥手检测系统。 A robot characterized by integrating a wave detecting system of a robot according to any one of claims 8 to 13.
PCT/CN2017/112211 2017-10-30 2017-11-21 Method and system for detecting waving of robot, and robot WO2019085060A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711042859.9A CN107886057B (en) 2017-10-30 2017-10-30 Robot hand waving detection method and system and robot
CN201711042859.9 2017-10-30

Publications (1)

Publication Number Publication Date
WO2019085060A1 true WO2019085060A1 (en) 2019-05-09

Family

ID=61782978

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/112211 WO2019085060A1 (en) 2017-10-30 2017-11-21 Method and system for detecting waving of robot, and robot

Country Status (2)

Country Link
CN (1) CN107886057B (en)
WO (1) WO2019085060A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110852216A (en) * 2019-10-30 2020-02-28 平安科技(深圳)有限公司 Palm print verification method and device, computer equipment and readable storage medium
CN111950588A (en) * 2020-07-03 2020-11-17 国网冀北电力有限公司 Distributed power supply island detection method based on improved Adaboost algorithm
CN116612119A (en) * 2023-07-20 2023-08-18 山东行创科技有限公司 Machine vision-based method for detecting working state image of drill bit for machine tool

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111680671A (en) * 2020-08-13 2020-09-18 北京理工大学 Automatic generation method of camera shooting scheme based on optical flow

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102426480A (en) * 2011-11-03 2012-04-25 康佳集团股份有限公司 Man-machine interactive system and real-time gesture tracking processing method for same
CN105469043A (en) * 2015-11-20 2016-04-06 苏州铭冠软件科技有限公司 Gesture recognition system
CN105869166A (en) * 2016-03-29 2016-08-17 北方工业大学 Human body action identification method and system based on binocular vision
US20160307057A1 (en) * 2015-04-20 2016-10-20 3M Innovative Properties Company Fully Automatic Tattoo Image Processing And Retrieval
US9524445B2 (en) * 2015-02-27 2016-12-20 Sharp Laboratories Of America, Inc. Methods and systems for suppressing non-document-boundary contours in an image
CN107175660A (en) * 2017-05-08 2017-09-19 同济大学 A kind of six-freedom degree robot kinematics scaling method based on monocular vision

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5454043A (en) * 1993-07-30 1995-09-26 Mitsubishi Electric Research Laboratories, Inc. Dynamic and static hand gesture recognition through low-level image analysis
CN103179359A (en) * 2011-12-21 2013-06-26 北京新岸线移动多媒体技术有限公司 Method and device for controlling video terminal and video terminal
CN103593679A (en) * 2012-08-16 2014-02-19 北京大学深圳研究生院 Visual human-hand tracking method based on online machine learning
CN104571482B (en) * 2013-10-22 2018-05-29 中国传媒大学 A kind of digital device control method based on somatosensory recognition
CN107292295B (en) * 2017-08-03 2019-12-24 华中师范大学 Gesture segmentation method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102426480A (en) * 2011-11-03 2012-04-25 康佳集团股份有限公司 Man-machine interactive system and real-time gesture tracking processing method for same
US9524445B2 (en) * 2015-02-27 2016-12-20 Sharp Laboratories Of America, Inc. Methods and systems for suppressing non-document-boundary contours in an image
US20160307057A1 (en) * 2015-04-20 2016-10-20 3M Innovative Properties Company Fully Automatic Tattoo Image Processing And Retrieval
CN105469043A (en) * 2015-11-20 2016-04-06 苏州铭冠软件科技有限公司 Gesture recognition system
CN105869166A (en) * 2016-03-29 2016-08-17 北方工业大学 Human body action identification method and system based on binocular vision
CN107175660A (en) * 2017-05-08 2017-09-19 同济大学 A kind of six-freedom degree robot kinematics scaling method based on monocular vision

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110852216A (en) * 2019-10-30 2020-02-28 平安科技(深圳)有限公司 Palm print verification method and device, computer equipment and readable storage medium
CN111950588A (en) * 2020-07-03 2020-11-17 国网冀北电力有限公司 Distributed power supply island detection method based on improved Adaboost algorithm
CN111950588B (en) * 2020-07-03 2023-10-17 国网冀北电力有限公司 Distributed power island detection method based on improved Adaboost algorithm
CN116612119A (en) * 2023-07-20 2023-08-18 山东行创科技有限公司 Machine vision-based method for detecting working state image of drill bit for machine tool
CN116612119B (en) * 2023-07-20 2023-09-19 山东行创科技有限公司 Machine vision-based method for detecting working state image of drill bit for machine tool

Also Published As

Publication number Publication date
CN107886057A (en) 2018-04-06
CN107886057B (en) 2021-03-30

Similar Documents

Publication Publication Date Title
WO2020108362A1 (en) Body posture detection method, apparatus and device, and storage medium
WO2019085060A1 (en) Method and system for detecting waving of robot, and robot
CN110688965B (en) IPT simulation training gesture recognition method based on binocular vision
CN110232308A (en) Robot gesture track recognizing method is followed based on what hand speed and track were distributed
CN104821010A (en) Binocular-vision-based real-time extraction method and system for three-dimensional hand information
Thongtawee et al. A novel feature extraction for American sign language recognition using webcam
Zhou et al. A study on attention-based LSTM for abnormal behavior recognition with variable pooling
KR20120089948A (en) Real-time gesture recognition using mhi shape information
CN108985375B (en) Multi-feature fusion tracking method considering particle weight spatial distribution
Zhang et al. View-invariant action recognition in surveillance videos
Guo et al. Small aerial target detection using trajectory hypothesis and verification
Hoque et al. Computer vision based gesture recognition for desktop object manipulation
Holte et al. View invariant gesture recognition using the CSEM SwissRanger SR-2 camera
Enikeev et al. Recognition of sign language using leap motion controller data
Singh et al. Some contemporary approaches for human activity recognition: A survey
Su et al. Human action recognition method based on hierarchical framework via Kinect skeleton data
CN111160179A (en) Tumble detection method based on head segmentation and convolutional neural network
CN114038011A (en) Method for detecting abnormal behaviors of human body in indoor scene
Shitole et al. Dynamic hand gesture recognition using PCA, Pruning and ANN
Yu et al. Research on video face detection based on AdaBoost algorithm training classifier
Liu et al. Neural network for intelligent and efficient volleyball passing training
Tan A Method for Identifying Sports Behaviors in Sports Adversarial Project Training Based on Image Block Classification under the Internet of Things
Xu et al. Real-time hand gesture recognition system based on associative processors
Wang et al. Finger-fist detection in first-person view based on monocular vision using Haar-like features
Le et al. Fast fingertips positioning based on distance-based feature pixels

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17930701

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17930701

Country of ref document: EP

Kind code of ref document: A1