Summary of the invention
The object of the invention is to be to provide a kind of method and apparatus being controlled shooting by gesture, making shooting or the stopping that just can controlling video camera or camera only by gesture exactly.
For reaching this object, the present invention by the following technical solutions:
Gesture controls a method for shooting, comprises the steps:
100, incoming frame image;
101, color space conversion, is converted into gray-scale map by the two field picture of input;
103, image angle correction, carries out certain rotation by gray-scale map, to carry out next step identification;
104, judge whether stablize hand shape area identification be 1, reach judge to stablize hand shape to judge whether to be accumulated to enough numerical value in the identification of frame before, if so, then enter step 111, otherwise enter step 105, proceed the identification of stable hand shape;
105, the detection of hand shape is carried out to two field picture;
106, determine whether to detect shape in one's hands, if do not had, then enter next frame, again incoming frame image, if had, then enter step 107;
107, superposition matrix stability, make the matrix element value in matrix stability in corresponding hand shape region increase by 1, described matrix stability is the character matrix the same with two field picture resolution, and initial value is 0;
108, hand shape threshold determination, judges whether the mean value of the element in certain region exceedes hand shape threshold value, if so, then thinks that hand is stabilized in this region within the stabilization time that this sets, enters step 109, otherwise, enter next frame, again incoming frame image;
109, put stable hand shape area flag position=1;
110, turn back to stable hand shape region, and enter next frame, incoming frame image again, to carry out fist identification at next frame;
111, detect fist, fist is detected;
112, determine whether fist to be detected, if do not had, then enter next frame, again incoming frame image, if had, then enter step 113;
113, fist counter increases, to calculate the fist stable time;
114, fist threshold determination, judges whether fist count value reaches fist threshold value, if do not had, then enters next frame, again incoming frame image, if so, then illustrates that fist has lifted the regular hour, enters step 115;
115, putting gestures detection zone bit is 1, triggers the action starting to take or stop shooting.
Preferably, before step 103, also there are following steps,
102, Face Detection, detects the area of skin color in image in YUV color space.
Preferably, described hand shape threshold size is in step 108 adjustable, and hand shape threshold value is preferably 1.2.
Preferably, described fist threshold size is in step 114 adjustable.
The invention also discloses the device that a kind of gesture controls shooting, comprise as lower unit:
Input block, incoming frame image;
Color space converting unit, is converted into gray-scale map by the two field picture of input;
Image angle correction unit, carries out certain rotation by gray-scale map, to carry out next step identification;
Stablize hand shape regional determination unit, judge whether stablize hand shape area identification be 1, reach judgement stablize hand shape to judge whether to be accumulated to enough numerical value in the identification of frame before, if, then enter fist detecting unit, otherwise enter hand shape detecting unit, proceed stable hand shape and identify;
Hand shape detecting unit, carries out the detection of hand shape to two field picture;
Detect hand shape regional determination unit, determine whether to detect shape in one's hands, if do not had, then enter input block, again incoming frame image, if had, then enter superposition hand shape territory element;
Superposition hand shape territory element, superposition matrix stability, make the matrix element value in matrix stability in corresponding hand shape region increase by 1, described matrix stability is the character matrix the same with two field picture resolution, and initial value is 0;
Hand shape threshold determination unit, judges whether the mean value of the element in certain region exceedes hand shape threshold value, if, then think that hand is stabilized in this region within the stabilization time that this sets, enter stable hand shape area assignment unit, otherwise, enter input block, again incoming frame image;
Stablize hand shape area assignment unit, put stable hand shape area flag position=1;
Return unit, turn back to stable hand shape region, and enter input block, incoming frame image again, to carry out fist identification at next frame;
Fist detecting unit, detects fist;
Fist detects identifying unit, determines whether fist to be detected, if do not had, then enters input block, again incoming frame image, if had, then enter step 113;
Fist counting unit, fist counter increases, to calculate the fist stable time;
Fist threshold determination unit, fist threshold determination, judges whether fist count value reaches fist threshold value, if no, then enter input block, again incoming frame image, if so, then illustrate that fist has lifted the regular hour, enters gestures detection zone bit assignment unit;
Gestures detection zone bit assignment unit, putting gestures detection zone bit is 1, triggers the action starting to take or stop shooting.
Preferably, first entered as lower unit before entering image angle correction unit,
Face Detection unit, detects the area of skin color in image in YUV color space.
Preferably, the described hand shape threshold size in hand shape threshold determination unit is adjustable, and hand shape threshold value is preferably 1.2.
Preferably, the described fist threshold size in fist threshold determination unit is adjustable.
Therefore, utilize the method and device that gesture can be utilized to realize the shooting of contactless real-time control camera or camera, both can not affect the quality of camera or camera imaging, individual user can be facilitated again, improve the convenience used.
Embodiment
Below in conjunction with drawings and Examples, the present invention is described in further detail.Be understandable that, specific embodiment described herein is only for explaining the present invention, but not limitation of the invention.It also should be noted that, for convenience of description, illustrate only part related to the present invention in accompanying drawing but not entire infrastructure.
Embodiment 1:
See Fig. 1, the gesture disclosed according to a particular embodiment of the invention controls the method for shooting, first the method detects stable hand shape region to every two field picture, and carry out accumulation superposition stablize hand shape area identification, when being made the counting of stable hand shape area identification reach hand shape threshold value by multi frame detection, then think and stable hand shape detected, then fist is detected to ensuing every frame, and fist counting is accumulated, when being made fist technology reach threshold value by multi frame detection, then putting gestures detection zone bit is 1, trigger the action starting to take or stop shooting.Therefore, by the Detection of Stability of a large amount of frame, avoid because single frames is on the impact of result.Camera can be recognized exactly start the action taking or stop shooting.
Specifically, the method comprises the steps:
100, incoming frame image.
101, color space conversion, is converted into gray-scale map by the two field picture of input; Because the two field picture form obtained under X86, IOS, Android is not the same, therefore this step mainly realizes the conversion to gray scale such as RGB565, RGB888, YUV420SP.
102, Face Detection, uses algorithm to detect area of skin color in image in YUV color space.This step is mainly avoided there is certain False Rate when directly using feature detection, by Face Detection, in area of skin color, is carrying out feature detection, thus can eliminate the erroneous judgement situation of non-area of skin color.It will be appreciated by those skilled in the art that the algorithm of Face Detection is this area algorithms most in use.When a large amount of two field picture of use carries out Detection of Stability, single frames erroneous judgement is less on the impact of result.Therefore this step is preferred steps, omits this step, directly enters that next step is also passable, but uses this step can improve the effect of feature detection further.
103, image angle correction, such as, according to the angle imported into, and/or camera parameter, gray-scale map is carried out certain rotation, to carry out next step identification.
104, judge whether stablize hand shape area identification be 1, reach judgement stablize hand shape to judge whether to be accumulated to enough numerical value in the identification of frame before, if so, then enter step 111, otherwise enter step 105.
105, the detection of hand shape is carried out to two field picture.
106, determine whether to detect shape in one's hands, if do not had, then enter next frame, again incoming frame image, if had, then enter step 107.
107, superposition matrix stability, make the matrix element value in matrix stability in corresponding hand shape region increase by 1, described matrix stability is the character matrix the same with two field picture resolution, and initial value is 0.Can add up like this and detect hand shape several times in certain region within a certain period of time.
108, hand shape threshold determination, judge in certain region, such as current detection to hand shape region in the mean value of element whether exceed hand shape threshold value, if, then think that hand is stabilized in this region within the stabilization time that this sets, enter step 109, otherwise, enter next frame, incoming frame image again, carries out the frame identification continued.In a specific embodiment, hand shape threshold value is 1.2.By setting hand shape threshold value, make it possible to holding time of opponent's shape and set, avoid due to part user cannot adhere to the long time and according to None-identified hand shape, serve a fault-tolerant function.Therefore, preferably, hand shape threshold value is adjustable.The large I of hand shape threshold value determines that the number of times detecting palm shape in the same area is how many, and threshold value is larger, determines once to stablize the consuming time larger of the palm.
109, put stable hand shape area flag position=1, namely detect stable hand shape.
110, turn back to stable hand shape region, and enter next frame, incoming frame image again, to carry out fist identification at next frame.
111, detect fist, fist is detected.
112, determine whether fist to be detected, if do not had, then enter next frame, again incoming frame image, if had, then enter step 113.
113, fist counter increases, to calculate the fist stable time.
114, fist threshold determination, judges whether fist count value reaches fist threshold value, if do not had, then enters next frame, again incoming frame image, if so, then illustrates that fist has lifted the regular hour, enters step 115.The setting of fist threshold value can avoid the erroneous judgement to there is fist once in a while, also by the size of setting threshold value, how long can take, realize the function of a predetermined shooting time after fist is lifted in artificial setting.Therefore, preferably, fist threshold value is adjustable.
115, putting gestures detection zone bit is 1, triggers the action starting to take or stop shooting.
Simple, after method starts, by circulation captured image frame data, after capturing a two field picture, first color space conversion is carried out to it, rotate according to the angle imported into, camera parameter after conversion.Hand shape mark is stablized in following detection, if be FALSE, carry out the detection of hand shape, be superimposed upon on matrix stability by the position detected to two field picture, if mean value is greater than setting threshold value after superposition, stable hand shape mark is set to TRUE; If stablize hand shape to be masked as TRUE, carry out the detection of fist, detect that fist then increases progressively fist number counter, increase progressively rear detection counter numerical value and whether be greater than setting threshold value, if be greater than setting threshold value, think and fist detected, detecting stable hand-> on the whole to clench fist this action, is TRUE by gesture mark position.Gestures detection terminates.
Embodiment 2:
The invention also discloses the device that a kind of gesture controls shooting, comprise as lower unit:
Input block, incoming frame image;
Color space converting unit, is converted into gray-scale map by the two field picture of input;
Image angle correction unit, carries out certain rotation by gray-scale map, to carry out next step identification;
Stablize hand shape regional determination unit, judge whether stablize hand shape area identification be 1, reach judgement stablize hand shape to judge whether to be accumulated to enough numerical value in the identification of frame before, if, then enter fist detecting unit, otherwise enter hand shape detecting unit, proceed stable hand shape and identify;
Hand shape detecting unit, carries out the detection of hand shape to two field picture;
Detect hand shape regional determination unit, determine whether to detect shape in one's hands, if do not had, then enter input block, again incoming frame image, if had, then enter superposition hand shape territory element;
Superposition hand shape territory element, superposition matrix stability, make the matrix element value in matrix stability in corresponding hand shape region increase by 1, described matrix stability is the character matrix the same with two field picture resolution, and initial value is 0;
Hand shape threshold determination unit, judges whether the mean value of the element in certain region exceedes hand shape threshold value, if, then think that hand is stabilized in this region within the stabilization time that this sets, enter stable hand shape area assignment unit, otherwise, enter input block, again incoming frame image;
Stablize hand shape area assignment unit, put stable hand shape area flag position=1;
Return unit, turn back to stable hand shape region, and enter input block, incoming frame image again, to carry out fist identification at next frame;
Fist detecting unit, detects fist;
Fist detects identifying unit, determines whether fist to be detected, if do not had, then enters input block, again incoming frame image, if had, then enter step 113;
Fist counting unit, fist counter increases, to calculate the fist stable time;
Fist threshold determination unit, fist threshold determination, judges whether fist count value reaches fist threshold value, if no, then enter input block, again incoming frame image, if so, then illustrate that fist has lifted the regular hour, enters gestures detection zone bit assignment unit;
Gestures detection zone bit assignment unit, putting gestures detection zone bit is 1, triggers the action starting to take or stop shooting.
Preferably, first entered as lower unit before entering image angle correction unit,
Face Detection unit, detects the area of skin color in image in YUV color space.
Preferably, the described hand shape threshold size in hand shape threshold determination unit is adjustable, and further preferably, hand shape threshold value is 1.2.If mean value reaches threshold value 1.2, be stable palm shape region, the large I of threshold value determines that the number of times detecting palm shape in the same area is how many, and threshold value is larger, determines once to stablize the consuming time larger of the palm.
Preferably, the described fist threshold size in fist threshold determination unit is adjustable.
Utilize gesture of the present invention to control the method for shooting, user can realize following function:
The shooting good fortune of the whole family:
After starting mobile phone camera, mobile phone is placed on a fixed position, family circle stands in mobile phone camera opposite, and wherein a people stretches out and holds fist, and namely mobile phone starts shooting automatically, and again stretch out one's hand in shooting process and clench fist, shooting completes.So just efficiently solve the shortcoming that people does not disembark.
Dancer autodynes performance:
Start after mobile phone camera and mobile phone is placed on a fixed position, only need stand in mobile phone camera opposite and stretch out and hold fist, namely mobile phone starts shooting automatically, and again stretch out one's hand in shooting process and clench fist, shooting completes.
Obviously, those skilled in the art should be understood that, above-mentioned of the present invention each unit or each step can realize with general calculation element, they can concentrate on single calculation element, alternatively, they can realize with the executable program code of computer installation, thus they storages can be performed by calculation element in the storage device, or they are made into each integrated circuit modules respectively, or the multiple module in them or step are made into single integrated circuit module to realize.Like this, the present invention is not restricted to the combination of any specific hardware and software.
Above content is in conjunction with concrete preferred implementation further description made for the present invention; can not assert that the specific embodiment of the present invention is only limitted to this; for general technical staff of the technical field of the invention; without departing from the inventive concept of the premise; some simple deduction or replace can also be made, all should be considered as belonging to the present invention by submitted to claims determination protection domain.