Be used for image and change the optimization method that follow the trail of the figure boundary line
Technical field
The present invention relates to a kind of image that is used for and change the optimization method that follow the trail of the figure boundary line.
Background technology
In the prior art, along with popularizing of computing machine and network, people are also constantly increasing the demand of describing objective things with image and figure, and the application of image and figure almost is penetrated into the every aspect of people's life.The advantage of image data format grid is stacked, the combinatorial operation and the analysis of data as you know, and mathematical simulation.And the advantage of graphics data format vector is object-oriented, compact conformation, and data redudancy is low, and has the topology information of spatial data, is convenient to profound analysis.
These two kinds of data storage methods, strengths and weaknesses is respectively arranged, complement each other mutually, because data layout difference, people have designed many algorithms and have realized mutual conversion between these two kinds of data layouts for this reason, wherein the grid format data are to the transfer algorithm of vector format data particularly difficulty, and it promptly is to extract the border of polygonal region of the grid set expression with identical numbering and the topological relation on border that grid changes vector, and are expressed as the process of vector format boundary line.Grid in vector conversion the most difficulty be the boundary line search, topological structure generates and unnecessary point is removed several aspects.
Existing image changes figure, and the vector of grid commentaries on classics just method intuitively has two kinds:
A kind of angle from image is followed the tracks of and is produced vector, and another kind is to set about directly producing vector from the vectorial property analytic angle:
Vector is followed the tracks of and produced to first kind of angle from image: this also is that everybody expects easily and obtains the method for everybody approval that its process is divided following 3 steps: 1, Polygonal Boundary is extracted, and promptly uses high-pass filtering with the grating image binaryzation; 2, follow the trail of the boundary line, promptly to each segmental arc by a node to another node searching.3, topological relation generates and removes unnecessary point and curve slyness.Analyze from tracing process and tracking results, because the adjacent part between the image-region is that the wide bilateral boundary of two pixels is (as Fig. 1, the boundary line of area I and area I I is ABCD and abcd, distance between the border is a pixel), in fact the complicacy of region shape, in fact the public boundary pixel of adjacent area be difficult to determine, track algorithm is complexity and makeing mistakes easily quite.Algorithm commonly used has linear iteration technique, segmentation cubic polynomial interpolation method, positive axis of a parabola average weighted method, inclined shaft para-curve average weighted method, splines method of interpolation etc. in the frontier point deletion.The angle that these algorithms of deleting nodes all are based on the boundary line slyness is handled, the boundary line dissociated out analyze separately, owing to do not consider the topological relation between the entity in the process of following the tracks of, cause deleting very at random a little, for the renewal and the attended operation of data brings a lot of workloads.Need simultaneously corresponding change to be done at least 2 target areas when the edit-modify operation of carrying out data, the situation that unavoidable appearance cavity and polygon intersect, its topological consistance are difficult to guarantee.Usually handling this class problem is by professional software, is background with the image, and to top and make amendment in the above, operator also needs certain professional skill and knowledge background vector superposed.Also just because of there are much more so technical matterss not solve, make to be difficult to be applied in the actual production and go, and the people who studies along this thinking are a lot, loses more than gain by the method.
Another kind is to set about directly producing vector from the vectorial property analytic angle, and this is with ENVI, n4||n6; C does not have tracked point; D is tracked point; Isnode detects tracked polygonal function, and isagain_point detects the function that polygon intersects, and then its track algorithm is:
if(A?&&?isnode?&&?C)goto?find;
if(A?&&?isagain_point?&&?isnode?&&?D)goto?find;
if(B?&&?isnode?&&?C)goto?find;
if(B?&&?isagain_point?&&?isnode?&&?D)goto?find;
The present invention is with respect to prior art, and its advantage is as follows:
Description of drawings:
Fig. 1 is a schematic diagram of following the tracks of and produce vector in the prior art from the angle of image;
The polar plot of Fig. 2 for extracting with prior art ENVI;
Fig. 3 is 130 zone boundary polar plot for gray-scale value in the image;
Fig. 4 accepts or rejects polygonal boundary node for adopting the present invention, guarantees that the vector that produces satisfies topological condition for consistence, does not occur the cavity between its polygon, does not also have the polar plot of polygon crossover phenomenon;
Fig. 5 is the schematic diagram of acnode deletion;
Fig. 6 is the acnode deletion figure after handling;
Fig. 7 is the boundary image of forming by 0 and 1;
Fig. 8 is the schematic diagram of counterclockwise n0-n7 for tracking direction;
Fig. 9 is the border record diagram;
Figure 10 is the border record diagram;
Figure 11 is by iterating the figure of generation;
Figure 12 is the polar plot that indivedual polygons intersect;
Figure 13 passes through the amended figure of vector Figure 12;
Figure 14 is a process flow diagram of the present invention;
Embodiment
Technological thought referring to Fig. 1, the inventive method is the boundary vector of target atural object, does not have live width, just is being based on this thought, and the present invention to translation 0.5 pixel, makes the vector point drop on four summits of pixel rather than the center of pixel by the upper left side.Thereby the adjacent part border between the image-region is a limit rather than bilateral boundary, and as Fig. 1, the zone boundary of I and II is thick line, rather than ABCD and abcd.Avoided the cavity between the zone to occur from the source that vector produces, followed the tracks of laying the foundation for the border of success.
Can show the boundary characteristic of original image clearly by the vector of top method extraction, business softwares such as ERDAS are representative, in order to have guaranteed the topological consistance of original target atural object, it is form very passive note of all boundary nodes with sawtooth, as Fig. 1, the border of area I and area I I is a red line, and original topology information area I and area I I are closed on not utilization, make unnecessary node to delete, the vector number that it produces is along with the image size increases, also increase pro rata, can see tangible sawtooth after amplifying.As the rectangle diagram picture of N*M, the vector nodal point number that its produces is 2N+2M, and in fact its vector nodal point number should be 4 points, and this is for increasing many workloads with vector as the figure research and analysis of research object.(as Fig. 2, this figure is the polar plot that extracts with ENVI), its data volume and the quality of data are poor.Its result can only cause: process is very complicated, and manual member is a lot, sets up topological relation and makes mistakes easily, needs to handle hot-tempered sound point, burr, cavity etc.
Technical scheme
The object of the present invention is to provide a kind of image that is used for to change the optimization method that follow the trail of the figure boundary line, its graphics memory space is few, image error is little and do not have manual workload, the automaticity height.Can follow the tracks of complicated image.
For achieving the above object, the technical solution used in the present invention is:
Being used for image changes the optimization method that follow the trail of the figure boundary line, and its special character is: described method may further comprise the steps:
(1), the generation of boundary image: for the boundary vector that makes generation can just in time drop on four angles of pixel, by realizing with down conversion:
A given image A, can with the ranks number respectively add 1 image B go toward 0.5 pixel of upper left side translation overlapping, four pixels of four summits correspondence B figure of a pixel among the A figure like this, its corresponding relation is:
A{(i,j)}->B{(i,j),(i+1,j),(i+1,j+1),(i,j+1)}
A figure is by after the following formula conversion, form the B figure of band edge circle, all nontarget areas all are 0 value, a certain pixel in the target area its up and down four pixels all in the target area, then this pixel also is 0 value, remaining pixel all is 1 value, is exactly boundary image B figure by 0 and 1 image of forming like this;
(3), the border follows the tracks of: it is 1 border that pixel value among the lock-on boundary image B figure is just followed the tracks of on the border, and the border trace template adopts counterclockwise template;
(4), frontier point processing, record:
A, adopt counterclockwise template, in tracing process, just can guarantee that left side pixel value is object forever; And the value on right side changes, and then this point may become frontier point, can realize with the isnode function.
If in the point that b detects, the point that several successive arranged removes intermediate point point-blank.
Between c, two check points, if exist, then by iterating record medial border point greater than 1.5 pixel points.
In the above-mentioned image processing process, at first carry out Flame Image Process, the deletion of acnode and burr.
After (4) step of carrying out above-mentioned Flame Image Process, carry out the processing that polygon intersects.
During follow the tracks of on border in (3) step of carrying out above-mentioned Flame Image Process, must have to be tracked polygon on one side, a polygon could be followed the tracks of next polygon after following the tracks of and finishing.For the pixel of distinguishing tracked mistake and the pixel that does not have tracked tracking, be the pixel assignment of having followed the tracks of 3.Be made as A=n1||n3||n5||n7; B=n0||n2|| but it has kept the character of many images, these character just in time can be utilized in tracing process well, make us can use the analytical approach that 4-is communicated with or 8-is communicated with to handle these vector points, the 4-connection is meant four pixels as m1-m4 among Fig. 5, the 8-connection is meant eight pixels as n0-n7 among Fig. 8, and the vector node is accepted or rejected (must keep as the point of the EF among Fig. 1, middle junction is is then accepted or rejected as required) according to topological relation.And the intermediate node of thick line can all be removed and only keeps starting point and terminal point, data volume significantly reduces, make that five points reduce to two points among Fig. 1, this method had both overcome a large amount of sawtooth owing to the data redundancy generation on the traditional software, and boundary line tracking and the boundary node choice for object provides theoretical foundation and feasible method again.
In order to make the process of following the tracks of not cause confusion on the border, require whole process strictly to be undertaken by counter clockwise direction, these a lot of software requirements with GIS are consistent, it can determine the polygon direction.In the design of algorithm, in order to guarantee topological consistance, the node that must feasiblely use counterclockwise tracking to produce is identical with the node of pressing clockwise generation, is that order is opposite.Because the choice of this method point is based on topological relation, and other nodes interpolations must error be greater than 1.5 pixels just can, standard is consistent, thereby can satisfy top condition.In Fig. 1, be FE to the border in I zone, and the border in II zone is EF, suppose that in the middle of the FE of I zone 1 P being arranged greater than 1.5 pixels, and P is the point of maximum in the distance of FE to P to the distance of FE, then the boundary node in I zone should be FPE; And, having 1 P equally to the II zone, greater than 1.5 pixels, and P is maximum point in the distance of EF to P to the distance of EF, so the boundary node in II zone should be EPF certainly.Referring to Fig. 4, owing to accept or reject polygonal boundary node, guarantee that the vector that produces satisfies topological condition for consistence with the method, institute does not have polygon to interlock so that there is not the border in cavity to follow the tracks of between the polygon after following the tracks of yet.And be that the vector coding mode of basic comprising unit all brings convenience aspect Data Update and attended operation from now on the segment of curve, because its data have uniqueness.
Referring to Figure 14, process flow diagram of the present invention;
This method can be divided into five steps such as processing that follow the tracks of on generation, border, frontier point writes down, indivedual polygons intersect of acnode deletion, boundary image:
One, acnode deletion:
Acnode is only considered two kinds of situations: do not have the same down about four pixels do not have the point of identical value, perhaps around three values be identical.First kind of situation; referring to Fig. 5; the m1-m4 value is all unequal mutually; average with four values substitutes; this is to handle isolated point from the angle of Flame Image Process, because the vector data amount of isolated point is a rectangular vector data, and the even some pixels of eight pixels on every side that arrive of this point; the error precision that only causes a pixel obviously is to calculate very much.Because the definition of acnode is very strict, the accumulation of error can not occur.Second kind of situation: wherein three values are arranged is identical to m1-m4, just is worth to substitute original value with this, and this situation can effectively be deleted the burr under hot-tempered sound and the pure background atural object.
In Fig. 6, the burr A of blue look has treated as isolated point (hot-tempered sound point) in the background of yellow color, and deleted.And burr B then is retained.
Two, the generation of boundary image:
For the boundary vector that makes generation can just in time drop on four angles of pixel, this algorithm is by realizing with down conversion.
A given image A, can with the ranks number respectively add 1 image B go toward 0.5 pixel of upper left side translation overlapping, four pixels of four summits correspondence B figure of a pixel among the A figure like this, its corresponding relation is:
A{(i,j)}->B{(i,j),(i+1,j),(i+1,j+1),(i,j+1)}
A figure forms the B figure of band edge circle by after the following formula conversion.In B figure, all nontarget areas are 0 value all, a certain pixel in the target area its up and down four pixels all in the target area, then this pixel also is 0 value, remaining pixel all is 1 value, is exactly boundary image by 0 and 1 image of forming like this, referring to Fig. 7.
Three, follow the tracks of on the border:
Referring to Fig. 8, the border is followed the tracks of and just to be followed the tracks of the pixel value is 1 border.The border trace template adopts counterclockwise template, and its tracking direction is counterclockwise n0-n7.
Must have to be tracked polygon on one side in tracing process, a polygon could be followed the tracks of next polygon after following the tracks of and finishing.
For the pixel of distinguishing tracked mistake and the pixel that does not have tracked tracking, be the pixel assignment of having followed the tracks of 3.Be made as A=n1||n3||n5||n7; B=n0||n2||n4||n6; C does not have tracked point; D is tracked point; Isnode detects tracked polygonal function, and isagain_point detects the function that polygon intersects, and then its track algorithm is:
if(A?&&?isnode?&&?C)goto?find;
if(A?&&?isagain_point?&&?isnode?&&?D)goto?find;
if(B?&&?isnode?&&?C)goto?find;
if(B?&&?isagain_point?&&?isnode?&&?D)goto?find;
Four, border record:
1,, in tracing process, just can guarantee that left side pixel value is object forever because adopt counterclockwise template.And the value of right side (being that the pixel value is a side of 0 in the B image) changes (changing in the A image), and then this point may become frontier point, can realize with the isnode function.Follow the tracks of the I district in Fig. 1, its border is that F is to E.Variation has taken place in the value on right side when tracing into the E point.
If in 2 points that detect, the point that several successive arranged removes intermediate point point-blank.Remove the B point as ABC;
3, between two check points, if exist, then by iterating record medial border point greater than 1.5 pixel points; As: add C between BD, add A between FB.
In Figure 10, the border of yellow and grey, though what at first determine is the AB border, that note at last is BEDA (border of yellow area) or ADEB (border of gray area).Figure 11 is by iterating the figure of generation.
Five, the crossing processing of indivedual polygons:
The border can not occur by the most polygons of the frontier point of top four steps generation and intersect, indivedual polygons can be detected by the method that line and line intersect, and make amendment.Referring to Figure 12, Figure 13, Figure 12 becomes Figure 13 after vector is revised.This a place only occurs owing to polygonal self intersection causes on the image of 905*302, modification can be finished by program.
The method explanation:
The appearance of error is caused by acnode deletion and deletion intermediate node, because two kinds of situations can be not overlapping, so this method has only 1.5 pixel errors, through checking is suitable, it had both kept the original information of image, having avoided the border of second kind of classic method generation again is the sawtooth situation, and reduces data volume effectively.
Remote sensing technology is by years of researches and development, remotely-sensed data is obtained advancing by leaps and bounds of technology, in its application also be and huge increasing of day to the demand of vector, but that is that all right is ripe for raster data automatic vectorization technology, artificial tracing digitizing is the current main method of obtaining vector data, and this certainly will cause shortcomings such as workload is big, data are obtained difficulty, efficient is low.The little bottleneck formula general layout in big centre, this two obviously is to be difficult to be competent at out-of-date methods.The brand-new polygon based on topological relation that the present invention proposes is followed the tracks of, and has thoroughly changed the mode of handwork, and the remote sensing technology industrialization is become a reality, and is just right in conjunction with getting efficient and extensibility.
More typical topology rule is: polygon can not be overlapped; Point must be covered by the polygon sideline; The suspension node can not be arranged; Two line layers can not intersect etc.In new method, can satisfy well, and be impossible realize with first kind of classic method.
This research topic, an application program with the C++builder Programming with Pascal Language checks test to the multiple series of images data and has all obtained good effect, and has proved that intermediate node adopts 1.5 pixel errors to iterate and calculates is feasible.If we are calling key point by the initial polygonal frontier point of selecting of algorithm, the choice of this key point is obviously according to topological relation, the node of getting between key point for the slick and sly degree that strengthens the border promptly iterates node, and also it can not destroy original topological relation as can be seen in the border algorithm that its choice is mentioned in front.Abandoned thoroughly with the method that to come the people by mathematical formulae in the classic method be the slick and sly degree that reaches curve, do not determined the method for intermediate node, solved it fully and be not easy to realize technological difficulties such as editor, renewal and attended operation according to topological relation.
By translation, make vector fall on the summit of pixel, utilize the 4-connection of image or 8-connection character to follow the tracks of to line of vector, this provides technical guarantee for following the tracks of based on the border of topological relation.Through evidence, any complex image can successfully be followed the tracks of, thereby makes grid change vector enters into image applications from the laboratory field, directly and has effectively promoted the image applications potentiality, has overcome the little bottleneck formula general layout in big centre, two effectively.Along with the raising of people to information-based industry degree of dependence, demand to image and vector is also increasing, and the effect that just in time can play bridge is followed the tracks of on the border based on topological relation that this paper proposes, and the slick and sly degree of the curve in the classic method will be substituted.