Associating Thiessen polygon and the density map drafting method of inverse distance-weighting
This case is Chinese invention patent application 201210146965.2, applying date 2012-05-11, and title is " a kind of
Dot density thematic mapping method based on Voronoi diagram " divisional application
Technical field
What the present invention proposed is the manufacture method of a kind of dot density thematic maps, belongs to computational geometry, cartography
With Voronoi diagram in GIS-Geographic Information System (GIS) (Voronoi polygon is also referred to as " Thiessen polygon ")
The crossing domain of application technology.
Background technology
The calculating of dot density refers to according to any point position unit are in it of the distribution estimating of point in region
Count.In geoscience applications, the calculating of dot density is to calculate the calculating of residential area density, building density
Theoretical abstraction after concluding etc. problem and sum up, population density distribution, image procossing, cluster analysis,
There is important application in the fields such as discriminant analysis, independent component analysis (ICA), computer vision.Embody point
The most straightforward approach of Density Distribution is through graphical pointv density map.Dot-density plot is thematic map in cartography
One, it shows the border corresponding with data value or field object, a field object midpoint with point (number)
Total number represent the data value that territory is corresponding.
At present, calculate dot density at any point place and mainly have two kinds of common methods.One is that simple point is close
Degree computational methods, i.e. according to the amount of the some element factor calculation unit are fallen in each grid cell, raster cell surrounding neighbors
Level.In concept, it is with grid cell, raster cell as starting point, defines the surrounding at each grid cell, raster cell center
One neighborhood, the quantity will put in neighborhood is added, then divided by neighborhood area, finally gives a key element
Density.Another kind is the method for Density Estimator, and it is with a key element as starting point, calculates some key element in its week
Enclose the density in neighborhood.The method is thought and is covered by a smooth surface above each point.At a place
Position face value is the highest, along with the increase face value with the distance of point is gradually reduced, in the distance etc. with point
Position face value in search radius is zero.The search neighborhood of kernel density estimation method only allows to use
Circle, the density of each output pixel is the value sum on all core surfaces being superimposed upon grid cell, raster cell center.
Both approaches suffers from being widely applied in dot density calculates, but the size of search neighborhood is to knot
Fruit has certain impact: when search radius parameter value is the biggest, the density grids of generation is the most smooth and generalization degree more
High;When parameter value is the least, the information shown by the grid of generation is the most detailed.Additionally, simple dot density calculates
Method is to unify the number of the Neighborhood Statistics discrete point of size, but the difference of dot density in have ignored contiguous range;
And Density Estimator method is to unify the circle of size as search neighborhood, it is contemplated that the difference of dot density in neighborhood,
But have ignored the difference of different discrete point " coverage ".
Summary of the invention
The invention solves the problems that and technical problem is that: overcome the above-mentioned deficiency of prior art, by Thiessen polygon pair
The technical advantage divided in space, it is provided that a kind of density map drawing combining Thiessen polygon and inverse distance-weighting
Method, it, passes through as neighborhood with the Voronoi polygon (Thiessen polygon) corresponding to each discrete point
The method of anti-distance weighting distribution realizes the difference assignment of dot density in neighborhood, it is possible to quickly, rationally, accurately
Calculating dot density and output point density map.
In order to solve above technical problem, the one that the present invention provides combines Thiessen polygon and inverse distance-weighting
Density map drafting method, comprise the following steps:
The first step, discrete point read the discrete point set as initial data, and described discrete point has
Respective sequence number and coordinate data;
Second step, structure Voronoi diagram build Voronoi based on all discrete points in discrete point set
Figure;
3rd step, Voronoi diagram rasterizing according to the Voronoi diagram upper left corner and the coordinate in the lower right corner, with
And the given row, column number dividing grid cell, raster cell, rasterizing is drawn in whole Voronoi diagram region, if generating
Dry pixel also determines the center point coordinate of each pixel;
4th step, set up pixel and the polygonal membership of Voronoi and sit according to the central point of pixel
Mark and the polygonal topological relation of Voronoi, it is determined that pixel and the polygonal membership of Voronoi, when
The central point of pixel falls in certain Voronoi polygon, then judge that this pixel belongs to this Voronoi polygon;
5th step, the density value i-th Voronoi polygon V of calculating pixeliTotal density value be 1/Sg,
By this total density value 1/SgShare to Voronoi polygon ViEach pixel, make Voronoi polygon ViInterior institute
There is the density value summation of pixel equal to 1/Sg, wherein, SgFor the area of single pixel, 1≤i≤n, n are Voronoi
The polygonal number of Voronoi in figure;
6th step, grid smooth and use the method for spatial domain smothing filtering to recalculate each picture element density value;
The density value size of all pixels in 7th step, picture element density value reclassification statistical analysis grid map,
Accordingly all picture element density values are reclassified, give different gray value;
8th step, draw density map, according to the gray value of each pixel, grid rendered acquisition density map.
In the dot density thematic mapping method of the present invention, the Voronoi diagram built based on discrete point, use
Region is split by Voronoi polygon, has and only one of which discrete point in making each Voronoi polygon
(unit occurs), each Voronoi polygon can be considered that corresponding discrete point generates " coverage ";Voronoi
In polygon, the calculating of each picture element density value does not associates with other Voronoi polygons, therefore Voronoi
In polygon, to be disturbed degree low in the calculating of picture element density value, and in Voronoi polygon, local density calculates and ensures
The comparability of result of calculation and reliability between each Voronoi polygon;And Voronoi is polygonal
Total density value allocation way can select according to practical situation, optional equal point-score, it is possible to select instead away from
From Method for Weight Distribution, use more flexible;Based on the Voronoi diagram constructed by discrete point, there is uniqueness,
Therefore during the present invention program realizes, subjective factors is less, it is easy to operation.
The invention provides following three kinds of Voronoi polygon total density value pool schemes:
Scheme one:
In the second step of preceding method, that sets up between discrete point and its affiliated Voronoi polygon is right
Should be related to;In described 5th step, use each picture that anti-distance weighting distribution method is shared in Voronoi polygon
Unit's density value, in Voronoi polygon, the density value of pixel and this pixel central point are to this Voronoi polygon
The distance of corresponding discrete point is inversely proportional to;Voronoi polygon ViThe density value of interior jth pixel isWherein Rij、RikRepresent Voronoi polygon V respectivelyiMiddle jth and kth pixel
Central point to Voronoi polygon ViCorresponding discrete point PiDistance, j≤mi, k≤mi, miFor
Voronoi polygon ViInterior pixel number, i, j, k are natural number.
Scheme two:
In the second step of preceding method, that sets up between discrete point and its affiliated Voronoi polygon is right
Should be related to;In described 5th step, use each picture that anti-distance weighting distribution method is shared in Voronoi polygon
Unit's density value, in Voronoi polygon, the density value of pixel and this pixel central point are to this Voronoi polygon
Square being inversely proportional to of the distance of corresponding discrete point;Voronoi polygon ViThe density of interior jth pixel
Value isWherein RijRikRepresent Voronoi polygon V respectivelyiMiddle jth and kth
The central point of pixel is to Voronoi polygon ViCorresponding discrete point PiDistance, j≤mi, k≤mi, miFor
Voronoi polygon ViInterior pixel number, i, j, k are natural number.
Scheme three:
In the 5th step of preceding method, equal point-score is used to share each picture element density in Voronoi polygon
Value, Voronoi polygon ViThe density value B of interior jth pixelii=1/ (Sg*mi), miFor Voronoi polygon
ViInterior pixel number, j≤mi, and j is natural number.
In aforementioned three kinds of schemes, first two method uses anti-distance weighting distribution method, and the third uses
It it is equal point-score.All calculation of group dividings are simpler, and the spatial distribution of dot density can be polygonal greatly from Voronoi
Reflecting in little (quantity that Voronoi polygon comprises pixel), Voronoi area of a polygon is the biggest,
Then dot density value is the lowest;Anti-distance weighting distribution rule considers " coverage " (Voronoi polygon)
The difference of interior different pixel dot density, the Voronoi polygonal internal at each pixel place have employed based on distance
Density value distribution way, make result more rationally accurately.
Wherein, in anti-distance weighting distribution method, the spatial distribution of dot density can be from calculated Voronoi
Reflect in the size of area of a polygon, further contemplate distance factor at Voronoi polygonal internal,
The density value of pixel proportion as shared by the inverse (or inverse square) of distance is assigned in each pixel,
Make result of calculation more reasonable.
Accompanying drawing explanation
The present invention is further illustrated below in conjunction with the accompanying drawings.
Fig. 1 is the inventive method flow chart.
Fig. 2 is discrete point and Voronoi diagram structure schematic diagram thereof.
Fig. 3 is pixel membership and density value calculating schematic diagram.
Fig. 4 is that grid neighboring mean value smooths schematic diagram.
Fig. 5 is picture element density value reclassification schematic diagram.
Detailed description of the invention
Describing the present invention in detail below according to accompanying drawing, the purpose of the present invention and effect will be apparent from.
It is illustrated in figure 1 the present invention and combines the stream of Thiessen polygon and the density map drafting method of inverse distance-weighting
Cheng Tu, comprises the following steps:
The first step, discrete point read the discrete point set as initial data, and described discrete point has
Respective sequence number and coordinate data.
Read the coordinate of discrete point, and show according to the proportionate relationship of screen coordinate scope with discrete point coordinate range
Show each some position (Fig. 2 is left).Discrete point numbering is stored by this example as the attribute data of discrete point.
Second step, structure Voronoi diagram build Voronoi based on all discrete points in discrete point set
Figure, sets up the corresponding relation between discrete point and its affiliated Voronoi polygon;
In this example, for there is unit in all discrete points in discrete point set, builds Voronoi by scan-line algorithm
Figure, passes to the number value of discrete point the polygonal number value of Voronoi, thus establishes discrete point
And the corresponding relation between its affiliated Voronoi polygon;Simultaneously set up occur unit (discrete point) with
Topological relation between Voronoi limit, generation unit (discrete point) and Voronoi polygon, Voronoi limit
In data structure record constitute this limit linear equation coefficient, constitute this limit two end points and with this frontier juncture
There is unit's (discrete point) in the both sides of connection, records this polygonal limit collection in the polygonal data structure of Voronoi
Close;Such data are used to be conducive to the calculating of picture element density value in following 5th step.
3rd step, Voronoi diagram rasterizing according to the Voronoi diagram upper left corner and the coordinate in the lower right corner, with
And the given row, column number dividing grid cell, raster cell, rasterizing is drawn in whole Voronoi diagram region, if generating
Dry pixel also determines the center point coordinate of each pixel.
The grid of the arbitrary p*q for dividing, if the coordinate in its lower left corner, whole region and the upper right corner is respectively
(A1, B1) and (A2, B2), wherein A1< A2, B1< B2.Pixel can store with two-dimensional array form, arrangement mode
For from left to right, arrange from the top down.For arbitrary pixel aijIts pixel center point coordinate is Wherein, 0≤i≤p-1,0≤j≤q-1.
4th step, set up pixel and the polygonal membership of Voronoi and sit according to the central point of pixel
Mark and the polygonal topological relation of Voronoi, it is determined that pixel and the polygonal membership of Voronoi, when
The central point of pixel falls in certain Voronoi polygon, then judge that this pixel belongs to this Voronoi polygon.
In this example, pixel membership polygonal with Voronoi provides as follows: if pixel central point falls
In which Voronoi polygon, then this pixel is just under the jurisdiction of this Voronoi polygon;If pixel central point
Fall on certain Voronoi limit, then search and two Voronoi polygons of this frontier juncture connection, it is stipulated that this picture
Unit is under the jurisdiction of the Voronoi polygon occurring unit's numbering less;If pixel center is lucky and certain Voronoi
Summit overlaps, then search three the Voronoi limits being associated with this summit, and then find relevant to this summit
Three Voronoi polygons of connection, it is stipulated that this pixel is under the jurisdiction of in three Voronoi polygons generation unit and compiles
Number reckling.In Fig. 4, the pixel in solid border is for being under the jurisdiction of this polygonal pixel.For pixel center
Situation about falling on Voronoi polygonal Voronoi limit and the polygonal summit of Voronoi belongs to special case,
The membership rule of these pixels can be artificially defined, is not strict with, therefore the most right in the present invention
The contents of the section is defined and describes in detail.
5th step, calculate the density value i-th Voronoi polygon V of each pixeliTotal density value be
1/Sg, by this total density value 1/SgShare to Voronoi polygon ViEach pixel, make Voronoi polygon
ViThe density value summation of interior all pixels is equal to 1/Sg, wherein, SgFor the area of single pixel, 1≤i≤n, n
For the polygonal number of Voronoi in Voronoi diagram;
In this example, use each picture element density value that anti-distance weighting distribution method is shared in Voronoi polygon,
In Voronoi polygon the density value of pixel and this pixel central point to corresponding to this Voronoi polygon from
The distance of scatterplot is inversely proportional to.
It is illustrated in figure 3 pixel membership and density value calculates schematic diagram.The calculating of the concrete density value of pixel
Method is as follows:
Voronoi polygon ViThe density value of interior jth pixel isWherein Rij、Rik
Represent Voronoi polygon V respectivelyiThe central point of middle jth and kth pixel is to Voronoi polygon Vi
Corresponding discrete point PiDistance, SgRepresent the area of single pixel, j≤mi, k≤mi, miFor Voronoi
Polygon ViInterior pixel number, i, j, k are natural number.The essence that picture element density value calculates is exactly one
In individual Voronoi polygon, according to the geometric center of its each being subordinate to pixel to the distance that unit occurs
Inverse accounts for all pixel geometric centers and distributes the part of " point " to the ratio that unit's inverse distance sum occurs
Volume, then obtain dot density divided by pixel area.As it is shown in figure 5, after the data in the grid of left side are then for calculating
The picture element density value obtained, smooths followed by the 6th step grid.
6th step, grid smooth and use the method for spatial domain smothing filtering to recalculate each picture element density value.
The method of spatial domain smothing filtering can be neighboring mean value smoothing techniques, neighborhood median smoothing method, neighborhood extreme value
Smoothing techniques etc..This example uses field averaging method, will in grid the density value of a pixel neighbouring with surrounding
The density value of pixel is added, then using the meansigma methods tried to achieve as the density value of this pixel in new grid;Additionally
According to generate grid cell, raster cell number number, use the template of suitable size (such as 5*5,9*9,25*25
Deng) by traveling through each pixel carries out the matrix multiple in required pixel neighborhood line by line, as shown in Figure 4, this
What example was selected is the template of 3*3 size, and in the grid after smoothing, picture element density value is shown on the right side of Fig. 5.Through grid
After lattice are smooth, substantially can eliminate " abrupt slope " phenomenon near Voronoi limit.In the present embodiment, have employed
Mean value smoothing method, however not excluded that there is more rationally effective smoothing method.
The density value size of all pixels in 7th step, picture element density value reclassification statistical analysis grid map,
Accordingly all picture element density values are reclassified, give different gray value.
The essence of reclassification is to carry out picture element density value (property value) reclassifying or close for input pixel
Angle value changes to the method (as shown in Figure 5) of substitution value.First, each pixel, statistical analysis are traveled through line by line
Middle maximum, minima and the frequency distribution thereof of all picture element density values;Secondly, frequency distribution Nogata is made
Figure and frequency variation curve, and select rational interval threshold by density value order from small to large by institute accordingly
If there being pixel to be divided into Ganlei;Finally, different gray values is given to pixel after classification.Density is the biggest, gives
Gray value the biggest.
8th step, draw density map, according to the gray value of each pixel, grid rendered acquisition density map.
In 5th step of the present embodiment, in Voronoi polygon, the density value of pixel and this pixel central point are to being somebody's turn to do
The distance of the discrete point corresponding to Voronoi polygon is inversely proportional to;In addition, picture in Voronoi polygon
Density value and this pixel central point of unit to the discrete point corresponding to this Voronoi polygon distance square
It is inversely proportional to;Voronoi polygon ViThe density value of interior jth pixel isWherein Rij
RikRepresent Voronoi polygon V respectivelyiThe central point of middle jth and kth pixel is to Voronoi polygon
ViCorresponding discrete point PiDistance, j≤mi, k≤mi, miFor Voronoi polygon ViInterior pixel
Number, i, j, k are natural number.
When calculating picture element density value, it is possible to each pixel using equal point-score to share in Voronoi polygon is close
Angle value, Voronoi polygon ViThe density value B of interior jth pixelij=1/ (Sg*mi), miPolygon for Voronoi
Shape ViInterior pixel number, j≤mi, and j is natural number.
The Voronoi diagram that the present embodiment builds based on discrete point is divided by space based on beeline constraint
Generate " coverage " for each discrete point, carry out local density's calculating in this range and ensure that each " impact
Scope " comparability of result of calculation and reliability between (Voronoi polygon);It addition, this method is examined
The difference of different pixel dot densities in having considered " coverage ", in the Voronoi polygon at each point place
Portion have employed density value based on distance distribution way, makes result more rationally accurately.
In addition to the implementation, the present invention can also have other embodiments.All employing equivalents or equivalence
The technical scheme that conversion is formed, all falls within the protection domain of application claims.