Summary of the invention
One embodiment of the present of invention provide a kind of motion detection apparatus, comprising:
Image-generating unit, be configured to continuous imaging one reference planes to obtain a series of images frame;
Processing unit, a series of images frame be configured to being obtained by described image-generating unit is processed, to determine the motion of described pick-up unit with respect to described reference planes.
In addition, described processing unit also comprises the ratio-dependent unit, is configured to:
Detect the distance between described image-generating unit and described reference planes, thus the ratio of the size of the unit picture element of definite described picture frame and described reference planes.
In addition, described processing unit also comprises displacement and angle calculation unit, is configured to:
The first two field picture in described a series of images frame and the second two field picture are compared, determine that the position of pixel changes, and, according to described ratio, determine displacement and the anglec of rotation of described pick-up unit with respect to described reference planes.
In addition, described displacement and angle calculation unit are further configured to:
Described the first two field picture and described the second two field picture are carried out to the binarization processing, wherein gray-scale value is made as to 0 lower than the pixel value of threshold value, the pixel value that gray-scale value is more than or equal to described threshold value is made as 1,
The first two field picture and the second two field picture after described binarization is processed are processed, and determine that the position of pixel changes, and, according to described ratio, determine displacement and the anglec of rotation of described pick-up unit with respect to described reference planes.
In addition, described displacement and angle calculation unit also are configured to:
By detecting the position that forms the pixel of specific pattern in the first two field picture after described binarization is processed and the second two field picture, change, and, according to described ratio, determine that described pick-up unit is with respect to the sense of displacement of described reference planes and the displacement on abscissa axis directions X and ordinate axle Y-direction.
In addition, described displacement and angle calculation unit also are configured to:
Form the pixel of specific pattern in the first two field picture after processing for described binarization and the second two field picture, deduct the displacement on directions X and Y-direction from the second two field picture, thereby calculate the anglec of rotation of the pixel of the described formation specific pattern in the second two field picture with respect to the pixel of the described formation specific pattern in the first two field picture.
In addition, described processing unit also comprises speed and angular speed calculation unit, is configured to:
The a series of images frame obtained by described image-generating unit is processed, determined that the position of pixel changes, and, according to described ratio and elapsed time, determine speed and the angular velocity of described pick-up unit with respect to described reference planes.
According to another embodiment of the present invention, a kind of method for testing motion is provided, be applied to comprise that in the electronic equipment of image-generating unit, described method comprises:
Utilize described image-generating unit continuous imaging one reference planes to obtain a series of images frame;
The a series of images frame obtained is processed, to determine the motion of described electronic equipment with respect to described reference planes.
In addition, described method for testing motion also comprises:
Detect the distance between described image-generating unit and described reference planes, thus the ratio of the size of the unit picture element of definite described picture frame and described reference planes.
In addition, described method for testing motion also comprises:
The first two field picture in described a series of images frame and the second two field picture are compared, determine that the position of pixel changes, and, according to described ratio, determine displacement and the anglec of rotation of described electronic equipment with respect to described reference planes.
In addition, described method for testing motion also comprises:
Described the first two field picture and described the second two field picture are carried out to the binarization processing, wherein gray-scale value is made as to 0 lower than the pixel value of threshold value, the pixel value that gray-scale value is more than or equal to described threshold value is made as 1,
The first two field picture and the second two field picture after described binarization is processed are processed, and determine that the position of pixel changes, and, according to described ratio, determine displacement and the anglec of rotation of described electronic equipment with respect to described reference planes.
In addition, described method for testing motion also comprises:
By detecting the position that forms the pixel of specific pattern in the first two field picture after described binarization is processed and the second two field picture, change, and, according to described ratio, determine that described method for testing motion is with respect to the sense of displacement of described reference planes and the displacement on abscissa axis directions X and ordinate axle Y-direction.
In addition, described method for testing motion also comprises:
Form the pixel of specific pattern in the first two field picture after processing for described binarization and the second two field picture, deduct the displacement on directions X and Y-direction from the second two field picture, thereby calculate the anglec of rotation of the pixel of the described formation specific pattern in the second two field picture with respect to the pixel of the described formation specific pattern in the first two field picture.
In addition, described method for testing motion also comprises:
The a series of images frame obtained by described image-generating unit is processed, determined that the position of pixel changes, and, according to described ratio and elapsed time, determine speed and the angular velocity of described pick-up unit with respect to described reference planes.
According to another embodiment of the present invention, a kind of electronic equipment is provided, comprise above-mentioned motion detection apparatus.
Utilize motion detection apparatus, detection method and the electronic equipment of the embodiment of the present invention, it is the motion of pick-up unit accurately, especially not only can accurately detect displacement, but also can detection angles change.
Embodiment
Below, describe the preferred embodiments of the present invention in detail with reference to accompanying drawing.
The present invention will describe according to the motion detection apparatus of the embodiment of the present invention and the application example of detection method as an example with optical mouse.Before describing the embodiment of the present invention, will the principle of optical mouse of the prior art simply be described.
As shown in Figure 1, in the optical mouse of prior art, provide light source, camera and processor.During work, illuminate the surface of mouse bottom as the light emitting diode emission of light of light source, the camera consisted of lens subassembly and optical sensor constantly carries out image taking at a certain time interval simultaneously.The different images that mouse produces in moving process sends processor to and processes.Because always there is identical feature in two adjacent width images, by contrasting the change in location information of these unique points, just can judge moving direction and the distance of mouse, this analysis result finally is converted into the location that the coordinate offset amount realizes cursor.
Yet, in common mouse is processed, usually rotating part has been ignored, so optical mouse being while rotating in original place, the cursor on screen can not move.And at optical mouse while moving while rotating, rotating part also is left in the basket, and only has movable part to retain, and only exports the relative movement distance up and down of relative mouse itself, and is indifferent to the attitude of mouse itself.Yet such mouse is inconvenient under a lot of use scenes.Such as being played, when CAD design, shopping at network etc., expectation is by the rotation mouse, and what can't reach the object that makes in screen is rotated the purpose of operation simultaneously with equidirectional with mouse.
At first, with reference to Fig. 2, the display packing according to first embodiment of the invention is described.Fig. 2 is the process flow diagram of describing according to the method for testing motion 100 of first embodiment of the invention.According to the method for testing motion 100 of the present embodiment, can be applicable in electronic equipment, this electronic equipment comprises image-generating unit, processor etc.The method 100 comprises the following steps:
Step S101: utilize described image-generating unit continuous imaging one reference planes to obtain a series of images frame.
In this step, use image-generating unit continuous imaging as first-class as shooting with reference to screen (as placed the plane of mouse), and obtain a series of images frame.For example, this camera is with predetermined time interval (as 30 frames/second) continuous imaging reference planes, thus acquisition a series of images frame.
Step S102: a series of images frame obtained is processed, to determine the motion of described electronic equipment with respect to described reference planes.
In this step, a series of images frame obtained is carried out to predetermined process, thereby determine the motion of described electronic equipment with respect to described reference planes, comprise that displacement and angle change.
Then, the method also comprises: detect the distance between described image-generating unit and described reference planes, thus the ratio of the size of the unit picture element of definite described picture frame and described reference planes.
Specifically, the height on image-generating unit distance reference plane is higher, and the area of the reference planes of imaging is larger, and, in the object after imaging, the area of the reference planes that each pixel is corresponding is larger.On the contrary, the height on image-generating unit distance reference plane is lower, and the area of the reference planes of imaging is less, and, in the object after imaging, the area of the reference planes that each pixel is corresponding is less.For instance, the pixel quantity of supposing image-generating unit is fixed value, be 100,000 pixels, when the height on imaging cell distance ground is 1 centimetre, the area of the reference planes of imaging is 1 plane centimetre, and the area of reference planes corresponding to each pixel is 1,/10 ten thousand plane centimetre, therefore, while in image, moving a pixel, be equivalent at X, or Y-direction has moved 1/,100,000 centimetres.When the height on imaging cell distance ground is 2 centimetres, the area of the reference planes of imaging is 4 planes centimetre, and the size of reference planes corresponding to each pixel is 4,/10 ten thousand plane centimetre.Therefore, while in image, moving a pixel, be equivalent at X, or Y-direction has moved 2/,100,000 centimetres.
Therefore, need to determine in advance the distance between image-generating unit and described reference planes, thereby the ratio of the unit picture element of definite described picture frame and the area of described reference planes, in order to calculate the motion of this pick-up unit with respect to reference planes, comprise that actual physics relative displacement and actual physics relative angle change.
Specifically, the first two field picture in described a series of images frame and the second two field picture can be compared, the position of determining pixel changes, and, according to described ratio, determines actual physics displacement and the actual anglec of rotation of described electronic equipment with respect to described reference planes.
For example, the first two field picture arbitrarily and the second two field picture in described a series of images frame can be compared, determine that the position of the pixel of corresponding special object in this two two field picture changes.Preferably, the first continuous two field picture and the second two field picture in described a series of images frame are compared, determine that the position of the pixel of corresponding special object in this two two field picture changes.Perhaps, the first two field picture of the close together in described a series of images frame and the second two field picture are compared, determine that the position of the pixel of corresponding special object in this two two field picture changes.
Then, according to the position of the pixel of the corresponding special object of determining, change and the ratio of the size of definite unit picture element and reference planes, can determine the displacement of described electronic equipment with respect to described reference planes.Further, then, according to the first two field picture detected and the time interval between the second two field picture, can calculate the speed of described electronic equipment with respect to described reference planes.
In addition, according to the position of the pixel of the corresponding special object of determining, change, after the side-play amount that removes the XY direction, can determine the anglec of rotation of described electronic equipment with respect to described reference planes.Further, then, according to the first two field picture detected and the time interval between the second two field picture, can calculate the angular velocity of described electronic equipment with respect to described reference planes.
To Fig. 6, a kind of mode for displacement calculating and angle variation is described below with reference to Fig. 3.With reference to figure 3, show the enlarged diagram of the trickle object photographed in 16 * 16 picture element matrixs.Suppose that Fig. 4 is the first two field picture while starting movement.Note that concrete image has more pixels, simple in order to describe, show 16 * 16 picture element matrixs at this.Fig. 4 carries out to the image in Fig. 3 the black and white lattice image obtained after the binarization processing, wherein gray-scale value in image is made as to 0 lower than the pixel value of default threshold value, the pixel value that gray-scale value is more than or equal to described threshold value is made as 1, thereby is black and white lattice by the image transitions of Fig. 3.
Fig. 5 is the second two field picture after moving, and Fig. 6 is the black and white lattice image after the image binarization of Fig. 2 is processed.
Then, the first two field picture and the second two field picture after described binarization is processed are processed, and determine that the position of pixel changes, and, according to described ratio, determine displacement and the anglec of rotation of described electronic equipment with respect to described reference planes.
For example, by detecting the position that forms the pixel of specific pattern in the first two field picture after described binarization is processed and the second two field picture, change, and, according to described ratio, determine that described method for testing motion is with respect to the sense of displacement of described reference planes and the displacement on abscissa axis directions X and ordinate axle Y-direction.
In addition, form the pixel of specific pattern in the first two field picture after processing for described binarization and the second two field picture, deduct the displacement on directions X and Y-direction from the second two field picture, thereby calculate the anglec of rotation of the pixel of the described formation specific pattern in the second two field picture with respect to the pixel of the described formation specific pattern in the first two field picture.
Specifically, in Fig. 4, drawn the pixel that forms specific pattern with dotted line.In Fig. 6, detect the change in location of the pixel of the specific pattern shown in this dotted line, thereby determine that position and angle that this specific pattern is present change, as shown in the dotted line in Fig. 6.
More known according to two two field pictures in Fig. 4 and Fig. 6, pixel is changed to level three pixels that moved right, and a pixel has moved up.Definite ratio before the combination, can calculate horizontal shift and the perpendicular displacement size of this pick-up unit with respect to reference planes again.
In addition, from the dotted line of Fig. 6, directions X is 13 lattice, and Y-direction is 6 lattice, so can calculate the angle of rotation: A=argtan(6/13).
Certainly, from the method for relatively calculating ohject displacement and angle variation of image, be not limited to this, can also utilize alternate manner to carry out.For example, detect the change in location of specific one group of pixel or the change in location of the pixel that detection forms a plurality of specific patterns etc.
In addition, certainly can also be according to the displacement obtained and angle change calculations speed and angular velocity and acceleration and the angular acceleration etc. with respect to the unit interval.
Therefore, utilize the method for testing motion of the embodiment of the present invention, the accurately motion of pick-up unit, especially not only can accurately detect displacement, but also can detection angles change.
Below with reference to Fig. 7, the configuration block diagram according to the motion detection apparatus of the embodiment of the present invention is described.With reference to figure 7, according to themotion detection apparatus 200 of the embodiment of the present invention, comprise:
Image-generatingunit 201, be configured to continuous imaging one reference planes to obtain a series of images frame;
Processing unit 202, a series of images frame be configured to being obtained by described image-generatingunit 201 is processed, to determine the motion of described pick-upunit 200 with respect to described reference planes.
In addition, describedprocessing unit 202 can also comprise ratio-dependent unit 203, is configured to:
Detect the distance between described image-generatingunit 201 and described reference planes, thus the ratio of the size of the unit picture element of definite described picture frame and described reference planes.
In addition, describedprocessing unit 202 also comprises displacement andangle calculation unit 204, is configured to:
The first two field picture in described a series of images frame and the second two field picture are compared, determine that the position of pixel changes, and, according to described ratio, determine displacement and the anglec of rotation of described pick-upunit 200 with respect to described reference planes.
In addition, described displacement andangle calculation unit 204 are further configured to:
Described the first two field picture and described the second two field picture are carried out to the binarization processing, wherein gray-scale value is made as to 0 lower than the pixel value of threshold value, the pixel value that gray-scale value is more than or equal to described threshold value is made as 1,
The first two field picture and the second two field picture after described binarization is processed are processed, and determine that the position of pixel changes, and, according to described ratio, determine displacement and the anglec of rotation of described pick-upunit 200 with respect to described reference planes.
In addition, described displacement andangle calculation unit 204 also are configured to:
By detecting the position that forms the pixel of specific pattern in the first two field picture after described binarization is processed and the second two field picture, change, and, according to described ratio, determine that described pick-upunit 200 is with respect to the sense of displacement of described reference planes and the displacement on abscissa axis directions X and ordinate axle Y-direction.
In addition, described displacement andangle calculation unit 204 also are configured to:
Form the pixel of specific pattern in the first two field picture after processing for described binarization and the second two field picture, deduct the displacement on directions X and Y-direction from the second two field picture, thereby calculate the anglec of rotation of the pixel of the described formation specific pattern in the second two field picture with respect to the pixel of the described formation specific pattern in the first two field picture.
In addition, describedprocessing unit 202 also comprises speed and angularspeed calculation unit 205, is configured to:
The a series of images frame obtained by described image-generatingunit 201 is processed, determined that the position of pixel changes, and, according to described ratio and elapsed time, determine speed and the angular velocity of described pick-upunit 200 with respect to described reference planes.
Therefore, utilize the motion detection apparatus of the embodiment of the present invention, the accurately motion of pick-up unit, especially not only can accurately detect displacement, but also can detection angles change.
According to the motion detection apparatus of the embodiment of the present invention, can be included in various electronic equipments, as surperficial intelligent movable machine, optical mouse, positioning navigating device etc., be mainly used in the position of the machine moved at fixed surface and the direct-detection of angle, due to camera part technology various state-of-the-art technologies, such as the blue led lamp, Ear Mucosa Treated by He Ne Laser Irradiations etc., therefore be suitable for various surfaces, can not produce the phenomenon of skidding.The position under the Mobility Center of mobile apparatus can be arranged on according to the motion detection apparatus of the embodiment of the present invention, thereby relative actual displacement and relative rotation angle can be measured more accurately.
Therefore, utilize the electronic equipment of the embodiment of the present invention, the accurately motion of pick-up unit, especially not only can accurately detect displacement, but also can detection angles change.
It should be noted that, in this manual, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thereby make the process, method, article or the equipment that comprise a series of key elements not only comprise those key elements, but also comprise other key elements of clearly not listing, or also be included as the intrinsic key element of this process, method, article or equipment.In the situation that not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment that comprises described key element and also have other identical element.
Finally, also it should be noted that, above-mentioned a series of processing not only comprise the processing of carrying out by the time sequence with order described here, and comprise parallel or respectively rather than the processing of carrying out in chronological order.
Through the above description of the embodiments, those skilled in the art can be well understood to the mode that the present invention can add essential hardware platform by software and realize, can certainly all by hardware, implement.Understanding based on such, what technical scheme of the present invention contributed to background technology can embody with the form of software product in whole or in part, this computer software product can be stored in storage medium, as ROM/RAM, magnetic disc, CD etc., comprise that some instructions are with so that a computer equipment (can be personal computer, server, or the network equipment etc.) carry out the described method of some part of each embodiment of the present invention or embodiment.
Above the present invention is described in detail, has applied specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment is just for helping to understand method of the present invention and core concept thereof; , for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention simultaneously.