CN102457674A - Method for simulating gravity sensor with camera - Google Patents
Method for simulating gravity sensor with camera Download PDFInfo
- Publication number
- CN102457674A CN102457674A CN201010526326XA CN201010526326A CN102457674A CN 102457674 A CN102457674 A CN 102457674A CN 201010526326X A CN201010526326X A CN 201010526326XA CN 201010526326 A CN201010526326 A CN 201010526326A CN 102457674 A CN102457674 A CN 102457674A
- Authority
- CN
- China
- Prior art keywords
- data
- camera
- frame
- frame data
- displacement
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
Images
Landscapes
- Image Analysis (AREA)
Abstract
The invention discloses a method for simulating a gravity sensor with a camera. The method comprises the following steps of: capturing an image by the camera; compressing the captured image to form a compressed sub-image, searching a matching block with minimum SAD of a component Y in YUV data from the compressed sub-image, and recording the coordinates of the matching block in the compressed sub-frame, determining a corresponding region in the captured image according to obtained coordinate position; searching a matching region with minimum SAD in the region, and recording displacement relative to a previous frame of the image matching region; repeating the steps to get displacement data of the previous n frames of the current frame; and judging corresponding movements according to the gotten displacement data. The method implements the function of the gravity sensor in products comprising the camera.
Description
Technical field
The present invention relates to a kind of method of camera simulated gravity inductor.
Background technology
Gravity sensor (G-sensor); Have another name called acceleration transducer; It can perceive the variation of accelerative force, and accelerative force is exactly in accelerator, to act on the power on the object when object, such as rocking, fall, rise, descend the various mobile variations of degradation to be converted into the signal of telecommunication by gravity sensor; Through after the computational analysis of microprocessor, just can accomplish the good function of programming then.Can be such as mobile phone according to user's whipping direction, song is switched in front and back, also can calculate user's pace of progress when putting pocket into.
The application of gravity sensor more and more widely, but because of its cost higher, limited its promoting the use of in some low-end products such as mobile phone, MP3; And camera simulated gravity inductor must mate based on image; And at present the employing mated based on the image pixel gray value more, perhaps image carried out preliminary treatment earlier, and extracting image feature value afterwards again matees; The former needs the information processed amount big; Calculation of complex, speed is slow, and the latter can't adapt to the situation that scene constantly changes.
Summary of the invention
The technical problem that the present invention will solve is to overcome the deficiency that above-mentioned prior art exists, and a kind of method of camera simulated gravity inductor is provided, and makes the product that possesses camera also possess the function of gravity sensor simultaneously, has enriched the product application; Adopted fast matching method, improved the precision and the speed of camera simulated gravity inductor, reduced power consumption based on image compression.
For solving the problems of the technologies described above, the present invention provides a kind of method of camera simulated gravity inductor, it is characterized in that, may further comprise the steps:
One camera is caught image;
The compression captured images forms a compression subgraph, in the compression subgraph, searches the minimum match block of SAD of Y component in the yuv data, and is recorded in the coordinate position in the compression subgraph, according to the coordinate position that obtains, confirms zone corresponding in the captured images;
In said zone, search the minimum matching area of SAD, and record is with respect to the relative displacement in former frame images match zone;
Repeat above step and obtain the displacement data of the preceding n two field picture of present frame;
Carry out the judgement of corresponding actions according to the displacement data that obtains.
Useful technique effect of the present invention is: owing to adopted above scheme, can in possessing the product of camera, realize the function of gravity sensor; And every two field picture of catching at camera travels through in the process of coupling, has adopted the fast matching method based on image compression, has improved the precision and the speed of camera simulated gravity inductor, has reduced power consumption.
Description of drawings
Fig. 1 is the Organization Chart of camera simulated gravity inductor method of the present invention.
Fig. 2 is the structure chart of gravity sensor analog module among the present invention.
Fig. 3 is the structure chart of data acquisition module among the present invention.
Fig. 4 is the structure chart of data processing module among the present invention.
Fig. 5 is the structure chart of action judge module among the present invention.
Fig. 6 is the flow chart of camera simulated gravity inductor method of the present invention.
Embodiment
Below through concrete execution mode and combine accompanying drawing that the present invention is done to describe in further detail.
Present embodiment is through mobile phone cam simulated gravity inductor; Through compressing the image that camera is caught; Calculate the minimum match block origin coordinates position of Y component sad value in the every two field picture yuv data in compression back; In compressing original image,, do not write down the relative displacement regional of this matching area, set up the Mathematical Modeling of mobile phone left and right sides whipping according to this with respect to the former frame images match to searching the minimum matching area of sad value once more in the corresponding zone of coordinate position; Make corresponding action and judge, switch the front and back of triggering mobile phone MP3 song.
See also Fig. 1, the present invention uses the mobile phone of camera simulated gravity inductor to comprise camera, microprocessor and multimedia playing module.One gravity sensor analog module is carried out through microprocessor.
Please consult Fig. 2 to Fig. 5 simultaneously, the gravity sensor analog module comprises data acquisition module, data processing module and action judge module.Data acquisition module is used for after camera is opened, catching image.Data processing module compression captured images forms a compression subgraph, in the compression subgraph, searches the minimum match block of SAD (Sum of Absolute Differences, absolute error with) of Y component in the yuv data, and is recorded in the coordinate position in the compression subgraph; Said data processing module is confirmed zone corresponding in the captured images according to the coordinate position that obtains; Said data processing module is searched the minimum matching area of SAD in said zone, and record is with respect to the relative displacement in former frame images match zone.
The action judge module carries out the judgement of corresponding actions according to the displacement data that obtains.Said action judge module forms array according to the displacement data that obtains, and sets up the criterion that left whipping is done and right whipping is done.Said action judge module is judged as left whipping and does, and then triggers switching to last first song; Said action judge module is judged as right whipping and does, and then triggers to switch to back one first song.Said action judge module is connected with a multimedia playing module, and said multimedia playing module is switched played songs according to the triggering of said action judge module.
See also Fig. 6, according to above-mentioned design, present embodiment realizes that through camera simulated gravity inductor the flow process of left and right sides whipping mobile phone switching MP3 song is as shown in Figure 6, and its step is described below:
1) step 101 is opened camera;
2) step 102 is caught image, and the image size is QCIF (176*144), is pixel with the hypograph size unit;
3) step 103 is original image 1/16 size (44*36) with the image compression of being caught in the step 102, and the Y component mean value of the individual pixel of original image 16 (4*4) in the step 102 is corresponding to the Y component value of 1 pixel of compressed images;
4) step 104 adopts complete matching process in the subimage of compressed images (44*36) in step 103, find the minimum match block of SAD of Y component in its yuv data, and write down its origin coordinates position, the upper left corner in compressed images;
5) step 105 according to the origin coordinates position of having found in the step 104, the upper left corner of match block in compressed images, is confirmed pairing (4*4) zone in the original image (176*144);
6) step 106 in (4*4) zone of correspondence, is searched the minimum matching area of SAD, and is preserved the relative displacement regional with respect to the former frame images match of this matching area in original image;
7) repeating step 102 is to step 106, and camera is constantly caught view data, obtains the continuous dislocation data of current frame image with respect to the former frame image, and step 107 is got the displacement data of preceding 10 frames (containing present frame) image at every turn;
8) definition done of left whipping: be moved to the left earlier or be with certain angle to be rotated counterclockwise, return according to original path basically then;
Get the mobile phone formed array of X axial displacement data in whipping and the return course left at random:
Array 1:{23,27,28,32 ,-4,21,27,15,3 ,-5,4 ,-7 ,-16 ,-16,8 ,-35 ,-30}
Array 2:{11,15 ,-14,17,20,22,10 ,-5,3 ,-6 ,-12 ,-11,6 ,-9 ,-11,4 ,-12}
Through analyzing above 2 arrays, we find that in the process that get rid of on a mobile phone left side, more continuous positive number appearred in displacement data before this, was one section more continuous negative then, wherein have few data and disturb;
Respectively array 1 and array 2 per three continuous displacement datas are averaged, it is following to form new array:
Array 3:{26,29,19,16,15,21,15,4,1 ,-3 ,-6 ,-13 ,-8 ,-14 ,-19}
Array 4:{4,6,8,20,17,9,3 ,-3 ,-5 ,-10 ,-6 ,-5 ,-5 ,-5 ,-6}
Draw a left side from array 3 and array 4 and get rid of rule: displacement data changes continuous negative into gradually by continuous positive number;
9) definition done of right whipping: move right earlier or be with certain angle to turn clockwise, return according to original path basically then;
Get the mobile phone formed array of X axial displacement data in whipping and the return course to the right at random:
Array 5:{-22 ,-14 ,-10,4 ,-21 ,-14 ,-19 ,-10,6 ,-4,12,10,22,19,20,3,16}
Array 6:{-10 ,-16 ,-10,7 ,-20 ,-15 ,-12 ,-22 ,-14,6,13,19,24,12 ,-6,8,12}
Through analyzing above 2 arrays, we find that in the process that get rid of on the mobile phone right side, more continuous negative appearred in displacement data before this, was one section more continuous positive number then, wherein have few data and disturb;
Respectively array 5 and array 6 per three continuous displacement datas are averaged, it is following to form new array:
Array 7:{-15 ,-7 ,-9 ,-10 ,-18 ,-14 ,-8 ,-3,5,6,15,17,20,14,13}
Array 8:{-12 ,-6 ,-8 ,-9 ,-16 ,-16 ,-16 ,-10,2,13,19,18,10,5,5}
Draw the right side from array 7 and array 8 and get rid of rule: displacement data changes continuous positive number into gradually by continuous negative;
10) step 108 is confirmed the criterion that mobile phone left side whipping is done and right whipping is done;
Get the displacement data of preceding 10 frames of present frame (containing present frame) image at every turn, wherein:
Have in preceding 5 frame data above (the containing 4 frames) data of 4 frames be positive number and average greater than certain positive empirical value (for example; Positive empirical value is 1); Meanwhile the back have in 5 frame data above (the containing 4 frames) data of 4 frames be negative and average less than certain negative empirical value (for example; Negative empirical value is-1), if satisfy above 2 conditions simultaneously, then the decidable mobile phone is being made left whipping work;
Have in preceding 5 frame data above (the containing 4 frames) data of 4 frames be negative and average less than certain negative empirical value (for example; Negative empirical value is-1); Meanwhile the back have in 5 frame data above (the containing 4 frames) data of 4 frames be positive number and average greater than certain positive empirical value (for example; Positive empirical value is 1), if satisfy above 2 conditions simultaneously, then the decidable mobile phone is being made right whipping work;
11) step 109 is got rid of or right whipping work according to a mobile phone left side of being judged, triggers the MP3 song and switches broadcast forward or backward;
Wherein, in the above-mentioned steps, gather many group displacement datas, it is following to set up Mathematical Modeling:
A. get the displacement data of preceding n frame (the containing present frame) image of present frame, wherein n is the positive even numbers more than or equal to 10 at every turn;
It is that positive number and average are greater than certain positive empirical value that above (the containing 80% frame) data of 80% frame are arranged in the b. preceding n/2 frame data; Meanwhile; Have in the back n/2 frame data above (the containing 80% frame) data of 80% frame be negative and average less than certain negative empirical value, then can judgment object in relative motion or the similar a kind of stable motion trend done left;
It is that negative and average are less than certain negative empirical value that above (the containing 80% frame) data of 80% frame are arranged in the c. preceding n/2 frame data; Meanwhile; Have in the back n/2 frame data above (the containing 80% frame) data of 80% frame be positive number and average greater than certain positive empirical value, then can judgment object do to the right relative motion or similarly with above-mentioned b in opposite another kind of stable motion trend;
D. according to the Mathematical Modeling of setting up, make corresponding action and judge, trigger application corresponding.
The above is merely preferable possible embodiments of the present invention, and unrestricted protection scope of the present invention, and the equivalent structure that all utilizations specification of the present invention and accompanying drawing content are made changes, and all is included in protection scope of the present invention.
Claims (6)
1. the method for a camera simulated gravity inductor is characterized in that, may further comprise the steps:
One camera is caught image;
The compression captured images forms a compression subgraph, in the compression subgraph, searches the minimum match block of SAD of Y component in the yuv data, and is recorded in the coordinate position in the compression subgraph, according to the coordinate position that obtains, confirms zone corresponding in the captured images;
In said zone, search the minimum matching area of SAD, and record is with respect to the relative displacement in former frame images match zone;
Repeat above step and obtain the displacement data of the preceding n two field picture of present frame;
Carry out the judgement of corresponding actions according to the displacement data that obtains.
2. the method for claim 1 is characterized in that, n is the positive even numbers more than or equal to 10.
3. the method for claim 1 is characterized in that, forms array according to the displacement data that obtains, and sets up the criterion of action.
4. method as claimed in claim 3; It is characterized in that; It is that positive number and average are greater than certain positive empirical value that most frame data are arranged in the n/2 frame data before the array; Meanwhile, have in the back n/2 frame data most frame data be negative and average less than certain negative empirical value, then judge and doing first kind of motion.
5. method as claimed in claim 3; It is characterized in that; It is that negative and average are less than certain negative empirical value that most frame data are arranged in the n/2 frame data before the array; Meanwhile, have in the back n/2 frame data most frame data be positive number and average greater than certain positive empirical value, then judge and doing and above-mentioned first kind of second kind of motion that motion is relative.
6. the method for claim 1 is characterized in that, said camera is arranged on the electronic installation, and said electronic installation comprises one in order to handle the microprocessor of displacement data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201010526326XA CN102457674A (en) | 2010-10-27 | 2010-10-27 | Method for simulating gravity sensor with camera |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201010526326XA CN102457674A (en) | 2010-10-27 | 2010-10-27 | Method for simulating gravity sensor with camera |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102457674A true CN102457674A (en) | 2012-05-16 |
Family
ID=46040288
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201010526326XA Pending CN102457674A (en) | 2010-10-27 | 2010-10-27 | Method for simulating gravity sensor with camera |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102457674A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2013189279A1 (en) * | 2012-06-19 | 2013-12-27 | 中兴通讯股份有限公司 | Determination method and device for movement information about terminal |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1926496A (en) * | 2004-03-01 | 2007-03-07 | 苹果电脑有限公司 | Methods and apparatuses for operating a portable device based on an accelerometer |
WO2010045498A1 (en) * | 2008-10-15 | 2010-04-22 | Invensense Inc. | Mobile devices with motion gesture recognition |
CN101706677A (en) * | 2009-12-22 | 2010-05-12 | 聂清永 | Input device based on body feeling and input method thereof |
US20100214211A1 (en) * | 2009-02-24 | 2010-08-26 | Research In Motion Limited | Handheld electronic device having gesture-based control and a method of using same |
-
2010
- 2010-10-27 CN CN201010526326XA patent/CN102457674A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1926496A (en) * | 2004-03-01 | 2007-03-07 | 苹果电脑有限公司 | Methods and apparatuses for operating a portable device based on an accelerometer |
WO2010045498A1 (en) * | 2008-10-15 | 2010-04-22 | Invensense Inc. | Mobile devices with motion gesture recognition |
US20100214211A1 (en) * | 2009-02-24 | 2010-08-26 | Research In Motion Limited | Handheld electronic device having gesture-based control and a method of using same |
CN101706677A (en) * | 2009-12-22 | 2010-05-12 | 聂清永 | Input device based on body feeling and input method thereof |
Non-Patent Citations (2)
Title |
---|
《UIST'06》 20061018 Jingtao Wang et al Camera Phone Based Motion Sensing: Interaction Techniques, Applications and Performance Study 摘要、1-10页 1-6 , * |
JINGTAO WANG ET AL: "Camera Phone Based Motion Sensing: Interaction Techniques, Applications and Performance Study", 《UIST’06》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2013189279A1 (en) * | 2012-06-19 | 2013-12-27 | 中兴通讯股份有限公司 | Determination method and device for movement information about terminal |
CN103516866A (en) * | 2012-06-19 | 2014-01-15 | 中兴通讯股份有限公司 | Method and device for determining movement information of terminal |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11605214B2 (en) | Method, device and storage medium for determining camera posture information | |
US9690388B2 (en) | Identification of a gesture | |
JP2023162233A (en) | Virtual object control method and apparatus, terminal, and storage medium | |
US9973722B2 (en) | Systems, devices and methods for displaying pictures in a picture | |
CN103973969B (en) | Electronic installation and its image system of selection | |
CN104731307B (en) | A kind of body-sensing action identification method and human-computer interaction device | |
CN104243791B (en) | A kind of information processing method and electronic equipment | |
WO2017107192A1 (en) | Depth map generation apparatus, method and non-transitory computer-readable medium therefor | |
CN106792147A (en) | A kind of image replacement method and device | |
CN106582005A (en) | Data synchronous interaction method and device in virtual games | |
CN109743438B (en) | Method and device for sending multimedia information | |
CN103795931A (en) | Information processing method and electronic equipment | |
CN106776449A (en) | A kind of plant KePu Electronics book reads methods of exhibiting and device | |
CN111882674A (en) | Virtual object adjusting method and device, electronic equipment and storage medium | |
TWI630505B (en) | Interactive augmented reality system and portable communication device and interaction method thereof | |
CN102457674A (en) | Method for simulating gravity sensor with camera | |
CN206214708U (en) | A set of portable auxiliary training system with dual camera, wireless video transmission, time delay broadcasting and recording function | |
CN105468249A (en) | Intelligent interaction system and control method therefor | |
CN108174112A (en) | A kind of processing method and processing device in camera shooting | |
CN107333025B (en) | Image data processing method and device, electronic equipment and storage medium | |
WO2022040846A1 (en) | Method for optimizing motion vector and related device | |
CN205507800U (en) | 3D space simulation motion capture system | |
CN112957732B (en) | Searching method, device, terminal and storage medium | |
CN104035560A (en) | Human-computer real-time interaction method based on camera | |
CN103731698A (en) | Television system capable of being controlled through gestures based on camera |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20120516 |