The content of the invention
The present invention provides a kind of data compression method and equipment applied to vector space, of the prior art to solve
The technical problem that the algorithm of Vector spatial data compression method is complicated, amount of calculation is larger.
A kind of data compression method applied to vector space provided in an embodiment of the present invention, methods described include:
Point to be determined is obtained, according to the latitude and longitude coordinates of the point to be determined, the pole that the point to be determined is calculated is sat
Mark;The point to be determined is the vector space point on vector space curve to be compressed;
According to the polar coordinates of the point to be determined and the polar coordinates of current signature point, polar coordinates difference is calculated;It is described current
Characteristic point is the vector retained on the vector space curve to be compressed after the compressed processing of point to be determined described in distance recently
Spatial point;
According to the polar coordinates difference and default characteristic function, characteristic value is calculated;
If it is determined that the characteristic value is more than predetermined threshold value, then using the point to be determined as the current signature point, otherwise
The point to be determined is removed from the vector space curve to be compressed.
Alternatively, it is characterised in that the acquisition point to be determined, including:
According to the bearing of trend of the vector space curve to be compressed, will be removed successively on the vector space curve to be compressed
Vector space point outside beginning and end is as the point to be determined;
After using the point to be determined as the current signature point, in addition to:
The step of obtaining at described to be determined is returned to, until having handled all points to be determined;
The vector space that the starting point of the vector space curve to be compressed, terminal and the vector space of reservation point are formed
Curve, as the vector space curve after compression.
Alternatively, the characteristic function is:
T=Δ ρ * sin Δs θ
Wherein, T is the characteristic value, and Δ ρ is between the polar diameter of the point to be determined and the polar diameter of current signature point
Difference, Δ θ refers to the difference between the polar angle of the point to be determined and the polar angle of current signature point.
Alternatively, the characteristic function is:
Wherein, T is the characteristic value, and Δ ρ ' is between the polar diameter of the point to be determined and the polar diameter of current signature point
Polar diameter difference be normalized after obtained numerical value, Δ θ ' refers to the polar angle of the point to be determined and the current signature
Point polar angle between polar angle difference be normalized after numerical value.
Based on same inventive concept, a kind of computing device provided by the invention, the computing device includes:
Acquisition module, for obtaining point to be determined;The point to be determined is that the vector on vector space curve to be compressed is empty
Between point;
Computing module, for the latitude and longitude coordinates according to the point to be determined, the pole that the point to be determined is calculated is sat
Mark;According to the polar coordinates of the point to be determined and the polar coordinates of current signature point, polar coordinates difference is calculated;And according to described
Polar coordinates difference and default characteristic function, calculate characteristic value;The current signature point is on the vector space curve to be compressed
The vector space point retained after the compressed processing nearest apart from the point to be determined;
Processing module, for if it is determined that the characteristic value is more than predetermined threshold value, then using the point to be determined be used as it is described ought
Preceding characteristic point, the point to be determined is otherwise removed from the vector space curve to be compressed.
Alternatively, the acquisition module is specifically used for:
According to the bearing of trend of the vector space curve to be compressed, will be removed successively on the vector space curve to be compressed
Vector space point outside beginning and end is as the point to be determined;
The processing module is additionally operable to:
The step of obtaining at described to be determined is returned to, until having handled all points to be determined;
The vector space that the starting point of the vector space curve to be compressed, terminal and the vector space of reservation point are formed
Curve, as the vector space curve after compression.
Alternatively, the characteristic function is:
T=Δ ρ * sin Δs θ
Wherein, T is the characteristic value, and Δ ρ is between the polar diameter of the point to be determined and the polar diameter of current signature point
Difference, Δ θ refers to the difference between the polar angle of the point to be determined and the polar angle of current signature point.
Alternatively, the characteristic function is:
Wherein, T is the characteristic value, and Δ ρ ' is between the polar diameter of the point to be determined and the polar diameter of current signature point
Polar diameter difference be normalized after obtained numerical value, Δ θ ' refers to the polar angle of the point to be determined and the current signature
Point polar angle between polar angle difference be normalized after numerical value.
Another embodiment of the present invention provides a kind of computing device, and it includes memory and processor, wherein, the storage
Device instructs for storage program, and the processor is used to call the programmed instruction stored in the memory, according to the journey of acquisition
Sequence performs any of the above-described kind of method.
Another embodiment of the present invention provides a kind of computer-readable storage medium, and the computer-readable recording medium storage has
Computer executable instructions, the computer executable instructions are used to make the computer perform any of the above-described kind of method.
It is applied to the data compression method of vector space in the embodiment of the present invention, including obtains point to be determined;According to described
The latitude and longitude coordinates of point to be determined, the polar coordinates of the point to be determined are calculated;According to the polar coordinates of the point to be determined and
The polar coordinates of current signature point, calculate polar coordinates difference;According to the polar coordinates difference and default characteristic function, feature is calculated
Value;If it is determined that the characteristic value is more than predetermined threshold value, then using the point to be determined as the current signature point, otherwise from described
The point to be determined is removed on vector space curve to be compressed.It can be seen that for each waiting to sentence on vector space curve to be compressed
Fixed point, only need to be according to the point to be determined and the polar coordinates between the closest current signature point of the point to be determined
The characteristic value that mathematic interpolation obtains, whether to judge the reservation of the judgement point to be determined, not only algorithm is simple, and with compared with
Low time complexity and spatial degrees complexity, so as to greatly reduce the amount of calculation during data compression process.In addition, by
It is bent that vector space to be compressed need not be related in the calculating process of any point to be determined on vector space curve to be compressed
Other vector space points on line in addition to current signature point, therefore, the data compression method provided in the embodiment of the present invention is not
It is only applicable to the non real-time computing handled again after the overall all vector space points obtained on vector space curve to be compressed
In scene, the real-time fortune for each vector space point that could be applicable to obtain and handle one by one on vector space point curve to be compressed
Calculate in scene.
Embodiment
In order that the object, technical solutions and advantages of the present invention are clearer, the present invention is made below in conjunction with accompanying drawing into
One step it is described in detail, it is clear that described embodiment, only part of the embodiment of the present invention, rather than whole implementation
Example.Based on the embodiment in the present invention, what those of ordinary skill in the art were obtained under the premise of creative work is not made
All other embodiment, belongs to the scope of protection of the invention.
The embodiment of the present invention is described in further detail with reference to Figure of description.
Fig. 1 shows the flow corresponding to the data compression method applied to vector space provided in the embodiment of the present invention
Schematic diagram, as shown in figure 1, methods described includes:
Step S101:Point to be determined is obtained, according to the latitude and longitude coordinates of the point to be determined, is calculated described to be determined
The polar coordinates of point;The point to be determined is the vector space point on vector space curve to be compressed;
Step S102:According to the polar coordinates of the point to be determined and the polar coordinates of current signature point, polar coordinates difference is calculated;
The current signature point is to be protected on the vector space curve to be compressed after the compressed processing of point to be determined described in distance recently
The vector space point stayed;
Step S103:According to the polar coordinates difference and default characteristic function, characteristic value is calculated;
Step S104:If it is determined that the characteristic value is more than predetermined threshold value, then using the point to be determined as described current special
Point is levied, the point to be determined is otherwise removed from the vector space curve to be compressed.
It can be seen that for each point to be determined on vector space curve to be compressed, only need to according to the point to be determined and away from
The characteristic value obtained from the polar coordinates mathematic interpolation between the closest current signature point of the point to be determined, to judge that this is sentenced
Whether the reservation of the disconnected point to be determined to be, and not only algorithm is simple, and has relatively low time complexity and spatial degrees complexity, from
And greatly reduce the amount of calculation during data compression process.Further, since any on vector space curve to be compressed
Other vectors in addition to current signature point on vector space curve to be compressed need not be related in the calculating process of point to be determined
Spatial point, therefore, the data compression method provided in the embodiment of the present invention are applicable not only to overall acquisition vector space to be compressed
In the non real-time computing scene handled again after all vector space points on curve, it could be applicable to obtain and handle one by one
In the real-time operation scene of each vector space point on vector space point curve to be compressed.
Data compression method in the embodiment of the present invention applied to vector space specifically can be by with a variety of of calculation function
The computing device of type performs, such as, can be server-class computers, desktop computer, notebook computer and each
Class intelligent terminal (i.e. mobile phone, tablet personal computer etc.), or can also be all kinds of embedded devices such as vehicle mounted guidance etc.,
It is not particularly limited herein.
In the embodiment of the present invention, the vector space curve to be compressed is made up of multiple continuous vector space points, wherein,
Any vector space point on curve is corresponding with a latitude and longitude coordinates.According to the difference of application scenarios, vector to be compressed is empty
After the data of each vector space point in half interval contour can be gathered by different types of collecting device, it is then forwarded to above-mentioned calculating and sets
It is standby.Therefore, after the data for all vector space points that computing device both can be on vector space curve to be compressed have been had been received by,
It is stored in the caching of computing device, then triggers and perform above method flow, can also receiving collecting device transmission
After the data of first vector space point (i.e. the starting point of curve) on vector space curve to be compressed, soon in triggering execution
Method flow is stated, is not particularly limited herein.
Specifically, in step S101, computing device obtains point to be determined first, and the point to be determined is that vector to be compressed is empty
Vector space point on half interval contour.And then according to the latitude and longitude coordinates of point to be determined, the pole that the point to be determined is calculated is sat
Mark.
Using the latitude and longitude coordinates of point to be determined as pn={ xn,ynExemplified by, then the polar coordinates of the point to be determined are:
In step s 102, computing device obtains current signature point first, and the current characteristic point is vector space to be compressed
The vector space point retained on curve after the nearest compressed processing of distance point to be determined, then according to the longitude and latitude of current signature point
Coordinate is spent, the polar coordinates of current signature point are calculated.
Similarly, if the latitude and longitude coordinates of current signature point are pm={ xm,ymExemplified by, then the polar coordinates of the point to be determined are:
And then calculate polar coordinates difference according to the polar coordinates of point to be determined and the polar coordinates of current signature point.It is if to be determined
The polar coordinates of point are p 'n(ρn,θn), the polar coordinates of current signature point are p 'm(ρm,θm), then polar coordinates difference is:
In step s 103, computing device by the polar coordinates difference drawn in above-mentioned steps S102 (i.e. polar diameter difference and
Polar angle difference) distinguish in the corresponding polar diameter and polar angle variable for substituting into and presetting in characteristic function, characteristic value is calculated.
It should be noted that in the embodiment of the present invention, different characteristic functions may make the convergence of different decision point become
Gesture is different with sensitivity, therefore, different compression effectiveness, and those skilled in the art can be realized from different characteristic functions
It can be not particularly limited herein according to the specific characteristic function of selection is actually needed.
The characteristic function being applicable in the embodiment of the present invention is including but not limited to following two:This feature function T=Δ ρ *
Sin Δs θ, characteristic function
, can be by the polar diameter difference in the polar coordinates difference and pole specifically, if characteristic function selects T=Δ ρ * sin Δ θ
Angular difference value substitutes into the Δ ρ in characteristic function and Δ θ variables respectively.If characteristic function is selected
Δ ρ ' and Δ are obtained after then carrying out dimensionless normalized processing respectively to the polar diameter difference in polar coordinates difference and polar angle difference
After θ ', then it is updated in corresponding variable.
In step S104, computing device is if it is determined that the characteristic value being calculated is more than predetermined threshold value Ttd, then this is waited to sentence
Fixed point is as current signature point and retains, to perform subsequent treatment.If it is determined that the characteristic value being calculated is less than predetermined threshold value Ttd,
The point to be determined is then deleted from vector space curve to be compressed.
In the embodiment of the present invention, for same characteristic function, different predetermined threshold values correspond to different compressions
Rate.Respective predetermined threshold value is corresponding with for different characteristic functions, and its each self-corresponding predetermined threshold value may be in numerical value
Or there is bigger difference in magnitude, and therefore, the characteristic function and required compression ratio pair that those skilled in the art are selected according to it
Predetermined threshold value is specifically set, and is not particularly limited herein.
In the embodiment of the present invention, that above-mentioned steps S101 to step S104 is specifically described is one on space curve to be compressed
The processing procedure of individual point to be determined (i.e. currently processed vector space point), i.e., it is to retain the point to be determined after overcompression is handled
Still it is deleted.If determining to retain the point to be determined by calculating characteristic value, using the point to be determined as new current spy
Point is levied, i.e., during a certain vector space point after to the decision-point is handled, if the vector space point is treated with this
Other vector spaces between other vector space points, or the vector space point and the point to be determined are not present between decision-point
Point has been deleted, then using the point to be determined as in step s 102 as the current signature point of benchmark.
Reality application scenarios in, computing device using on vector space curve to be compressed beginning and end acquiescence as
Need the characteristic point retained, and for other vector space points on vector space curve to be compressed in addition to beginning and end,
Then according to the bearing of trend of vector space curve to be compressed, successively using each vector space point as above-mentioned steps S101 to S104
In point to be determined, and perform above-mentioned steps, it is empty to determine whether to retain each vector on vector space curve upon compression
Between point.
That is, work as computing device by performing above-mentioned steps S101 to S104, after having handled a certain point to be determined,
Also by return to step S101, using continuous next vector space point after the point to be determined as point to be determined newly, and
Above-mentioned steps S101 to S104 is performed, until successively all having handled all vector space points on vector space curve to be compressed
Finish, and then, the vector that computing device forms the starting point of vector space curve to be compressed, terminal and the vector space of reservation point
Space curve, as the vector space curve after compression.
Because the data compression method in the embodiment of the present invention is insensitive to historical data, Compression Vector space song is being treated
When any vector space point on line is handled, the data of the characteristic point nearest with the vector space point, also nothing need to be only utilized
The data of other vector space points need to be related to, and only need to calculate and once just can determine that whether the vector space point is to need
The characteristic point to be retained, therefore there is very low time complexity and space complexity.
It is emphasized that the data compression method in the embodiment of the present invention both can be applicable in non real-time computing environment,
Also it can be applicable in real-time operation environment.For example, in the scene of real-time operation, such as in the application of automobile GPS navigation,
Each vector space point on the vector space curve to be compressed of traval trace is recorded, is calculated in real time simultaneously by gps satellite
Navigation equipment is sent to, therefore, navigation equipment one by one can also send out each data point during data point is obtained in real time
Give computing device, then by computing device to real-time reception to each data point carry out compression successively and handle.It is and existing
Various types of data compression method in technology, due to needing to be calculated according to all data of curve, therefore it can be only applied to
In non real-time computing environment, i.e., it could be triggered after all data only on vector space curve to be compressed is received compressed
Journey.
Table 1 is exemplarily given in the case of different compression ratios, and same vector space curve to be compressed is adopted respectively
Obtained by being compressed with the data compression method in general gram of algorithm of Douglas of the prior art and the embodiment of the present invention
Time-consuming data.
Compression ratio |
Time-consuming (s) of general gram of algorithm of Douglas |
Time-consuming (s) of data compression method in the embodiment of the present invention |
49% |
0.02 |
0.03 |
46% |
0.03 |
0.03 |
40% |
0.05 |
0.03 |
23% |
0.27 |
0.03 |
17% |
0.58 |
0.03 |
9% |
1.30 |
0.03 |
6% |
1.59 |
0.03 |
2% |
4.17 |
0.03 |
1.50% |
6.93 |
0.03 |
0.50% |
13.56 |
0.03 |
0.30% |
22.08 |
0.03 |
The time-consuming correction data of general gram of algorithm of the Douglas of table 1 and the data compression method in the present invention
It should be noted that the compression ratio in table 1 is inversely proportional with compression degree, that is to say, that compression ratio is higher, compresses journey
Degree is lower, and the quantity of the characteristic point retained on vector space curve to be compressed is also more, and vice versa.
Fig. 2 is data in above-mentioned table 1 using compression ratio as abscissa, to take be time-consuming pair of compression that ordinate is drawn
It is can be seen that than schematic diagram, such as table 1 and Fig. 2 when compression ratio is larger, in general gram of algorithm of Douglas and the embodiment of the present invention
The compression of data compression method is time-consuming to be also closer to, but as the gradual reduction of compression ratio, general gram of algorithm of Douglas are calculated
The compression of method is time-consuming to be significantly increased, and the data compression method compression in the embodiment of the present invention is time-consuming still smaller and keeps steady
It is fixed, under different compression ratios, there is identical compression speed.
In addition, there is very high flexibility and sensitivity due to various features function can be selected in the embodiment of the present invention.
Therefore, before treating compression stroke curve and being compressed processing, by the adjustment to characteristic function and threshold value, can be achieved to not
With application feature when, to characteristic point distribution sensitivity judgement, so as to improve compression accuracy.
Based on same inventive concept, the embodiment of the present invention also provides a kind of computing device, and Fig. 3 is in the embodiment of the present invention
The structural representation of a kind of computing device provided, as shown in figure 3, the computing device 300 includes:
Acquisition module 301, for obtaining point to be determined;The point to be determined is the vector on vector space curve to be compressed
Spatial point;
Computing module 302, for the latitude and longitude coordinates according to the point to be determined, the pole of the point to be determined is calculated
Coordinate;According to the polar coordinates of the point to be determined and the polar coordinates of current signature point, polar coordinates difference is calculated;And according to institute
Polar coordinates difference and default characteristic function are stated, calculates characteristic value;The current signature point is the vector space curve to be compressed
On the vector space point that retains after the compressed processing nearest apart from the point to be determined;
Processing module 303, for if it is determined that the characteristic value is more than predetermined threshold value, then using the point to be determined as described in
Current signature point, the point to be determined is otherwise removed from the vector space curve to be compressed.
Alternatively, the acquisition module 301 is specifically used for:
According to the bearing of trend of the vector space curve to be compressed, will be removed successively on the vector space curve to be compressed
Vector space point outside beginning and end is as the point to be determined;
The processing module 303 is additionally operable to:
The step of obtaining to be determined is returned to, until having handled all points to be determined;
The vector space that the starting point of the vector space curve to be compressed, terminal and the vector space of reservation point are formed
Curve, as the vector space curve after compression.
Alternatively, the characteristic function is:
T=Δ ρ * sin Δs θ
Wherein, T is the characteristic value, and Δ ρ is between the polar diameter of the point to be determined and the polar diameter of current signature point
Difference, Δ θ refers to the difference between the polar angle of the point to be determined and the polar angle of current signature point.
Alternatively, the characteristic function is:
Wherein, T is the characteristic value, and Δ ρ ' is between the polar diameter of the point to be determined and the polar diameter of current signature point
Polar diameter difference be normalized after obtained numerical value, Δ θ ' refers to the polar angle of the point to be determined and the current signature
Point polar angle between polar angle difference be normalized after numerical value.
Based on same inventive concept, the embodiment of the present invention also provides another computing device, and the computing device specifically may be used
Think desktop computer, portable computer, smart mobile phone, tablet personal computer, personal digital assistant (Personal Digital
Assistant, PDA) etc..The computing device can include central processing unit (Center Processing Unit, CPU), deposit
Reservoir, input-output apparatus etc., input equipment can include keyboard, mouse, touch-screen etc., and output equipment can include display
Equipment, as liquid crystal display (Liquid Crystal Display, LCD), cathode-ray tube (Cathode Ray Tube,
CRT) etc..
Memory can include read-only storage (ROM) and random access memory (RAM), and provide storage to processor
The programmed instruction and data stored in device.In embodiments of the present invention, memory, which can be used for storing, above-mentioned is based on vector space
Data compression method program.
By calling the programmed instruction of memory storage, processor is used to perform according to the programmed instruction of acquisition processor
State the data compression method based on vector space.
Based on same inventive concept, the embodiments of the invention provide a kind of computer-readable storage medium, for saving as
The computer program instructions used in computing device are stated, it, which is included, is used to perform the above-mentioned data compression method based on vector space
Program.
The computer-readable storage medium can be any usable medium or data storage device that computer can access, bag
Include but be not limited to magnetic storage (such as floppy disk, hard disk, tape, magneto-optic disk (MO) etc.), optical memory (such as CD, DVD,
BD, HVD etc.) and semiconductor memory (such as it is ROM, EPROM, EEPROM, nonvolatile memory (NAND FLASH), solid
State hard disk (SSD)) etc..
By the above it can be seen that:
It is applied to the data compression method of vector space in the embodiment of the present invention, including obtains point to be determined;According to described
The latitude and longitude coordinates of point to be determined, the polar coordinates of the point to be determined are calculated;According to the polar coordinates of the point to be determined and
The polar coordinates of current signature point, calculate polar coordinates difference;According to the polar coordinates difference and default characteristic function, feature is calculated
Value;If it is determined that the characteristic value is more than predetermined threshold value, then using the point to be determined as the current signature point, otherwise from described
The point to be determined is removed on vector space curve to be compressed.It can be seen that for each waiting to sentence on vector space curve to be compressed
Fixed point, only need to be according to the point to be determined and the polar coordinates between the closest current signature point of the point to be determined
The characteristic value that mathematic interpolation obtains, whether to judge the reservation of the judgement point to be determined, not only algorithm is simple, and with compared with
Low time complexity and spatial degrees complexity, so as to greatly reduce the amount of calculation during data compression process.In addition, by
It is bent that vector space to be compressed need not be related in the calculating process of any point to be determined on vector space curve to be compressed
Other vector space points on line in addition to current signature point, therefore, the data compression method provided in the embodiment of the present invention is not
It is only applicable to the non real-time computing handled again after the overall all vector space points obtained on vector space curve to be compressed
In scene, the real-time fortune for each vector space point that could be applicable to obtain and handle one by one on vector space point curve to be compressed
Calculate in scene.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method, system or computer program
Product.Therefore, the present invention can use the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware
Apply the form of example.Moreover, the present invention can use wherein includes the meter of computer usable program code at one or more
The computer journey that calculation machine usable storage medium is implemented on (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.)
The form of sequence product.
The present invention is the flow with reference to method according to embodiments of the present invention, equipment (system) and computer program product
Figure and/or block diagram describe.It should be understood that can be by every first-class in computer program instructions implementation process figure and/or block diagram
Journey and/or the flow in square frame and flow chart and/or block diagram and/or the combination of square frame.These computer programs can be provided
The processors of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce
A raw machine so that produced by the instruction of computer or the computing device of other programmable data processing devices for real
The function of being specified in present one flow of flow chart or one square frame of two or more flow and/or block diagram or two or more square frame
Device.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which produces, to be included referring to
The manufacture of device is made, the command device is realized in one flow of flow chart or two or more flow and/or one side of block diagram
The function of being specified in frame or two or more square frame.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted
Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, so as in computer or
The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or two or more flow and/or square frame
The step of function of being specified in one square frame of figure or two or more square frame.
Although preferred embodiments of the present invention have been described, but those skilled in the art once know basic creation
Property concept, then can make other change and modification to these embodiments.So appended claims be intended to be construed to include it is excellent
Select embodiment and fall into having altered and changing for the scope of the invention.
Obviously, those skilled in the art can carry out the essence of various changes and modification without departing from the present invention to the present invention
God and scope.So, if these modifications and variations of the present invention belong to the scope of the claims in the present invention and its equivalent technologies
Within, then the present invention is also intended to comprising including these changes and modification.