1. Field of the Invention
The present invention relates to a method employing bumping algorithm for estimation of signal frequency, and relates also to a displacement estimation device and a method for the same.
2. Description of the Related Art
As background, the conventional bumping algorithm will first be explained referring to
The bumping algorithm may be applied to, for example, the following application. If one observes a speckle signal on an object from an observation window at a fixed location, the frequency of the signal varies in accordance with the relative movement speed between the surface of the object and the surface of the window. The higher the relative speed is, the higher the frequency of the speckle signal will be; the lower the relative speed is, the lower the frequency of the speckle signal will be. Thus, by sensing the frequency of the speckle signal with a proper optical device, the relative speed may be obtained. The above mentioned bumping algorithm may be used to convert an analog signal to a digital signal, so that the calculation of the relative speed may be easier. Furthermore, by providing two optical signal receivers at two nearby locations along an one-dimensional axis, referring to as the first channel and the second channel, the phase difference between the signals received by the two channels may be used to determine the movement direction of the object in the dimension.
Referring to
The above mentioned conventional device has a drawback in that, the detected signal intensity and phase may vary due to intensity variation of external light source, noise, and error of the optical device components and the signal may even disappear for a short while. Therefore, to estimate the displacement more precisely, a more sophisticated device is required.
In view of the foregoing, it is an object of the present invention to provide a method employing an improved bumping algorithm which includes any or a combination of two or more of: consistency check step, period prediction and compensation step, or adaptive threshold update step.
Another object of the present invention is to provide a displacement estimation method based on the above mentioned improved bumping algorithm, which achieves more accurate displacement estimation by adding a step of filtering and enhancing the signals or a step of correcting unreasonable displacement calculation result.
A further object of the present invention is to provide a displacement estimation device based on the above mentioned improved bumping algorithm and displacement estimation method. The device may be used in any apparatus that requires displacement estimation, including but not limited to: mouse, navigation device, speeding detection device, etc.
To achieve the foregoing and other objects, according to an embodiment of the present invention, a method for estimation of signal frequency based on bumping algorithm comprises: receiving a signal; determining an amplitude value as a bumping threshold; counting the number of state changes, wherein a state change occurs when the signal reaches the bumping threshold from a peak, or from a valley; characterized by further comprising one or more of the steps of: (A) consistency check to determine whether the state change of the signal is consistent with the waveform of the signal; (B) period prediction and compensation to count in the present period according to a proportional length of a previous period; and (C) adaptive threshold update to adjust the definition of the state change corresponding to the amplitude of the signal.
In addition, according to another embodiment of the present invention, a displacement estimation method comprises: a signal capturing step for capturing a signal; a displacement estimation step for calculating a displacement based on a state change of the signal; and an output step for outputting the displacement, wherein the displacement estimation step includes one or more of the steps of: (A) consistency check to determine whether the state change of the signal is consistent with the waveform of the signal; (B) period prediction and compensation to count in the present period according to a proportional length of a previous period; and (C) adaptive threshold update to adjust the definition of the state change corresponding to the amplitude of the signal.
In the above embodiment, a signal enhancement step to enhance the signal by filtering may be added after the signal capturing step. According to another embodiment of the present invention, an error displacement correction step may be added before the output step to correct the estimation result from the displacement estimation step.
In addition, according to a further other embodiment of the present invention, a displacement estimation device comprises: a signal capturing unit for capturing a signal external to said device; a displacement estimation unit electrically connected with said signal capturing unit, wherein said displacement estimation unit calculates a displacement based on a state change of said signal captured by said signal capturing unit; and a displacement output unit for outputting said displacement, wherein said displacement estimation unit performs one or more of the steps of: (A) consistency check to determine whether said state change of said signal is consistent with the waveform of said signal; (B) period prediction and compensation to count in the present period according to a proportional length of a previous period; and (C) adaptive threshold update to adjust the definition of said state change corresponding to the amplitude of said signal.
In the above embodiment, a signal enhancement unit to enhance the signal by filtering may be added between the signal capturing unit and the displacement estimation unit. According to another embodiment of the present invention, an error displacement correction unit may be added between the displacement estimation unit and the displacement output unit to correct the estimation result from the displacement estimation unit.
For better understanding the objects, characteristics, and effects of the present invention, the present invention will be described below in detail by illustrative embodiments with reference to the attached drawings.
The present invention relates to a method employing bumping algorithm for estimation of signal frequency, and relates also to a displacement estimation method and device employing the bumping algorithm. The displacement estimation method and device may be applied to an indexing apparatus such as an optical mouse, or other apparatuses that require tracking of locations or variations of images, such as a navigation device, a speeding detection device, etc. For convenience in illustrating the spirit of the present invention, in the following context, optical mouse is shown as the primary embodiment according to the present invention, but it should be understood that the application of the present invention is not limited to optical mouse.
Please refer to
Before further explaining the details of the foregoing steps, it should be emphasized that, although it is most preferred that all of the foregoing steps are included to embody the present invention, not all of the steps are not necessary, in the most basic concept of the present invention. For example, either or both of the step S2 and S3 may be omitted; as another example, it requires only one of the steps S31-S33 to provide an estimation result better than prior art.
I. Signal Enhancement
The purpose of the signal enhancement step S2 is to filter noises from the signal, so that the signal may be more accurate. Band-pass filtering may be used to filter high-frequency or low-frequency noises, or, adaptive filtering may be used to adaptively enhance the signal.
As a more detailed example, one may use a band-pass filter with a system function in z-domain as below:
in which f(x) may be, e.g., x; x2; x3 . . .
and in which β is a dominant coefficient which may be used to control the cut-off frequency of the high-pass filter HP(z) or the low-pass filter LP1(z).
Where adaptive filtering is used, an adaptive filter may be built by the Least-Mean-Square (LMS) method, as below:
û(n+Δ)=ŵT(n)u(n)u(n)=[u(n),u(n−1), . . . , u(n−M+1)]T
in which
ŵ(n)=[ŵ0(n),ŵ1(n), . . . , ŵM-1(n)]T
ŵ(n+1)=ŵ(n)+μ[u(n+Δ)−û(n+Δ)u](n)
and in which û(n+Δ) is the filtered signal at the time point (n+Δ); ŵ(n) and ŵ(n+1) are, respectively, the filter coefficients at the time points n and n+1; u(n), u(n−1), and u(n+Δ) are, respectively, the signal value at the time points n, n−1, and n+Δ; u(n) is an M×1 matrix including the signal value u(n) from the time point n . . . , to the signal value u(n−M+1) from the time point (n−M+1); μ is a ratio (0≦μ≦1); and [ ]T is a symbol for transposition.
Or, an adaptive filter may be built by the normalized Least-Mean-Square (normalized LMS) method, as below:
and in which a is a constant, etc.
In addition to the above mentioned filtering methods, other filtering methods may be used such as the Kalman adaptive filtering, etc. The choice of the filtering method depends on the application of the device; the key point is to select meaningful portion(s) in the signal to be subject to following calculation based on bumping algorithm.
II. Consistency Check
Please refer to
Hence, according to the present invention, a consistency check step is provided to prevent from such possible errors. The step includes the sub-steps of: first recording the peak or valley time points of the two channels; and at the time when a channel is in the lead to change state, checking whether the previous peak or valley of the same channel has lead the other channel. Referring to
When a state change does not pass through the consistency check, there are many possible follow-up actions to be taken. For example, one may simply neglect the error, or estimate the time point of the current state change by extrapolation according to the state changes of several previous periods, etc. The physical meaning of such actions are: stopping generating displacement output, or determining the displacement amount according to previous displacement speed, etc.
III. Period Prediction and Compensation
Please refer to
The reason for such long period to occur may be due to signal attenuation that no signal reaches the threshold. If there is no displacement output in a long period until the next state change, in displacement estimation, this means that there is no movement for a long time and next there is a big jump. If the displacement estimation device is used in a mouse, it results in a cursor movement as thus: the mouse is continuously moving but the cursor stays still for a while, and next jumps to a far-away position. This is obviously not preferred. Hence, it is desired to provide compensation to counter such error caused by signal attenuation.
According to the present invention, the solution is to provide a period prediction and compensation step for the present displacement output, based on a previous period. The step includes the sub-steps of: proportionally projecting the length of the previous period in the present period; calculating a count of the proportionally projected length in the present period; and using the count as a basis for displacement estimation before the next state change. The physical meaning of this is: if the present period is longer than the previous period, the device keeps outputting the displacement behavior of the previous period until the next state change, and at the state change it supplements the difference between the “predictive compensation” and the “actual displacement”. In one embodiment, the mathematical formula for this may be:
Count=Countprev+int[(Period2/Period1)/Ratio]+1
wherein Count is the state change count thus far, the displacement amount being a function of and may be obtained from the count; Countprev is the previous count; int[ ] is to take the integer part of the number in the bracket; Period1 is the length of the previous period; Period2 is the length of the present period thus far; Ratio is a ratio number arbitrarily given by a designer, which maybe, e.g., 1.0, 1.2, . . . .
The physical meaning of the mathematical formula is thus: by counting every once, the present period has passed through a time length that is equal to the whole length of the previous period (if Ratio is 1) or a multiple/proportion of the previous period (if Ratio is another value). Every time the number of count changes, the displacement estimation device outputs the same (or a multiple/proportion of) displacement behavior (moving direction and amount) according to what it did in the previous period.
To prevent from keeping outputting displacement amounts in a period when there is indeed no actual displacement (for example, when a mouse is still), according to the present invention, preferably an upper limit is given:
Count□Count_max
That is, when the number Count exceeds an upper limit Count_max, the device stops performing period prediction and compensation. The number of Count_max may be, e.g., 6.
IV. Adaptive Threshold Update
As seen from the previous
Referring to
Th1=(Max—1−Min—1)/C
wherein C is a constant such as 1.95, 1.90, 1.85, . . . , or a function dependent on the peak value or valley value, such as
C=1.95 when Max—1−Min—1□K
C=1.85 when Max—1−Min—1<K
etc.
Furthermore, to prevent from updating the bumping threshold due to minor vibrations, or updating the bumping threshold due to an abnormally huge vibration caused by a noise, preferably, an upper limit and a lower limit may be given:
Th—LB□Th1□Th—UB
Thus, the complete definition of the bumping threshold may be defined as follows:
Th1=Th—LB when Th1□Th—LB
Th1=(Max—1−Min—1)/C when Th—LB□Th1□Th—UB
Th1=Th—UB when Th1□Th—UB
In
Likely, the bumping threshold Th2 of the second channel may be updated according to the peak amplitude Max_2 at the time point T2 and the valley amplitude Min_2 at the time point T4, as follows:
Th2=Th—LB when Th2≦Th—LB
Th2=(Max—2−Min—2)/C when Th—LB≦Th2<Th—UB
Th2=Th—UB when Th2≦Th—UB
V. Error Displacement Correction
Referring to
In the error displacement correction step, according to one embodiment of the present invention, a determination as to whether the displacement is reasonable or not may be made based on acceleration. When the displacement is not reasonable, the displacement may be neglected, or instead, the displacement estimation device may output a displacement behavior according to that in a previous period (period prediction and compensation).
In detail, in an application where the displacement estimation device and method according to the present invention is employed, there must be a limitation to the variation of the speed (the acceleration). To explain it, assuming the application is an optical mouse, when one holds a mouse and moves it very fast along one direction, it is impossible for the mouse to suddenly change its direction in an instant. Similarly, it is impossible for it to accelerate beyond a limit. Thus, when the calculation result in the previous steps includes such impossible movements, the error displacement correction step may help to filter them out.
The error displacement correction step is more detailedly explained below. According to Newton's law,
v=v0+a×t
and assuming v0 is 0, then t=v/a. If a is defined as the acceleration limit such as 8 g according to mouse sensitivity, then the sampling time interval may be determined: tsample=v/8 g; during the interval, the moving direction can not be changed. The sampling number in a given time period T is T/tsample.
As stated in the foregoing, the displacement amount may be calculated from the state change count (Count), and therefore the displacement amount is a function of Count; Count is a function of time. By moving average, the average velocity at a time point t may be calculated by:
wherein
More specifically, the weightings may be assigned as:
That is, C1=w/N, while C2=(N−w)/N, wherein w is the assigned weighting, and N is a number given by the designer.
After the average velocity is obtained, when the average velocity
When the average velocity
As a preferred embodiment, the error displacement correction step described above may be summarized as the flowchart shown in
In the step S40, a calculation result of displacement is obtained from previous steps.
In the step S41, the average velocity
In the step S42, determination is made as to whether the average velocity
If the determination result is “no” in the step S42, the process goes to the step S44, wherein determination is made as to whether the average velocity
If the determination result is “no” in the step S44, the process goes to the step S46, wherein the displacement direction is not changed and no period prediction and compensation is made; the calculation result obtained in the step S40 is outputted directly.
In the foregoing description, “outputting displacement amounts based on period prediction and compensation” is to proportionally output displacement amounts in the present time period according to that in the previous time period; please refer to III. PERIOD PREDICTION AND COMPENSATION for the details thereof.
What is shown in
The bumping algorithm and the displacement estimation method according to the present invention have been explained above. An embodiment of the displacement estimation device employing the method according to the present invention is shown in
Furthermore, another embodiment of the displacement estimation device is shown in
Moreover, another embodiment of the displacement estimation device is shown in
Of course, the embodiment shown in
As a practical application, the displacement estimation device according to the present invention may be electrically connected with an image capturing device (not shown) in an optical mouse, to calculate the movement speed and direction of the mouse relative to the surface of a desk, and to control the movement of a cursor on a computer screen based on the speed and direction.
It should be noted that in addition to the optical mouse, the displacement estimation device according to the present invention may be applied to other optical pointing devices for controlling the movement of a cursor on the screen, or even applied to any apparatuses that requires tracing the positional changes of images. For example, the displacement estimation device according to the present invention may be installed in an automobile having the capability of capturing images, for determining whether the automobile deflects from a driving lane. Or, the displacement estimation device according to the present invention may be applied to a navigation system, or to a speeding detector, wherein the displacement of an automobile calculated by the displacement estimation device is divided by the time difference between two images to obtain the speed of the automobile.
The features, characteristics and effects of the present invention have been described with reference to its preferred embodiments, which are illustrative of the invention rather than limiting of the invention. Various other substitutions and modifications will occur to those skilled in the art, without departing from the spirit of the present invention. For example, what is shown in the figures as an independent circuit block may be combined with one or more other circuit blocks; a circuit block needs not necessarily stand alone. And, two circuit blocks that are shown directly connected with one another may be interposed with a third circuit block that does not affect the basic purpose of the original circuit structure, such as a delay gate. As another example, the filtering to be performed in the signal enhancement unit is not limited to the methods described in the above. As another example, it is easier to perform the consistency check based on the peak and/or the valley, but the same purpose may be achieved by using a signal point that is within a distance from the peak and/or the valley. As another example, to determine whether a calculated displacement is reasonable by moving average is only one preferred example; there are other equivalent alternatives. Therefore, all such substitutions and modifications are intended to be embraced within the scope of the invention as defined in the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
95122851 A | Jun 2006 | TW | national |
Number | Name | Date | Kind |
---|---|---|---|
5367153 | Suda et al. | Nov 1994 | A |
5737239 | Horiuchi et al. | Apr 1998 | A |
5973752 | Matsunaga | Oct 1999 | A |
7501811 | Ono | Mar 2009 | B2 |
Number | Date | Country | |
---|---|---|---|
20070297545 A1 | Dec 2007 | US |