CN102693525A - Method for solving problem of pixel multiple accesses to stack in seed filling algorithm - Google Patents

Method for solving problem of pixel multiple accesses to stack in seed filling algorithm Download PDF

Info

Publication number
CN102693525A
CN102693525A CN2012101397368A CN201210139736A CN102693525A CN 102693525 A CN102693525 A CN 102693525A CN 2012101397368 A CN2012101397368 A CN 2012101397368A CN 201210139736 A CN201210139736 A CN 201210139736A CN 102693525 A CN102693525 A CN 102693525A
Authority
CN
China
Prior art keywords
pixel
stack
algorithm
fill
seed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2012101397368A
Other languages
Chinese (zh)
Inventor
毛峡
刘运龙
薛雨丽
陈立江
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beihang University
Original Assignee
Beihang University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beihang University filed Critical Beihang University
Priority to CN2012101397368A priority Critical patent/CN102693525A/en
Publication of CN102693525A publication Critical patent/CN102693525A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Generation (AREA)

Abstract

The invention provides a method for solving a problem of pixel multiple accesses to a stack in seed filling algorithm, comprising steps that: a seed pixel is set as a color required by a filling area (referred to as an area filling color) and is pushed into the stack structure; on the premise of a non-empty stack, two operation steps that a pixel on top of the stack goes out of the stack and a pixel which is around the stack top and meets in-stack requirement is set as an area filling color and is pushed into the stack are performed repeatedly. The method of the invention can effectively solve the problem that algorithm efficiency is reduced as a result of certain pixels multiple accesses to the stack in simple seed filling algorithm.

Description

A kind ofly solve the method that pixel in the seed fill algorithm repeatedly goes out stacked problem
(1) technical field
The present invention relates to a kind of solve in the simple seed fill algorithm and have repeatedly the come in and go out method of stack architexture problem of some pixel, belong to computer graphics zone padding field.
(2) background technology
The zone is filled and to be meant according to the region contour line, its closed region that surrounds is filled with various colors, gray scale, lines or symbol, this zone can be with holes also can be not with holes.The zone is filled and generally to be divided into for two steps and to carry out: the first, confirm which the pixel that need fill has; The second, confirm to fill with what color value.Fill in the zone is that in the computer graphics figure generation field one is important and basic contents has a wide range of applications in fields such as interactive graphics design, pattern analysis, so is one of hot issue of computer graphics study always.
Two kinds of traditional region filling algorithms are arranged in the grating display system; A kind of is the scan-line algorithm that the covering of the sweep trace through confirming traversed region is filled at interval, and another kind is to begin to fill the seed fill algorithm till the border of appointment from given position.Scan-line algorithm mainly is used for the better simply polygonal region of packing ratio, and such as some simple polygon and circle, this algorithm has certain requirement to the shape of outline line, when the dealing with complicated zone, often loses efficacy.Seed fill algorithm then can solve the zone of border more complicated well and fill problem; This algorithm is through need to confirm some points in the fill area in advance; These points are called as seed points; Be starting point with these points then, with four-way connection method or eight in connection method is sought the zone have a few and fill.
It has been the main flow algorithm that fill in the zone at present that seed fill algorithm reaches the algorithm that on its basis, improves formation.Can use stack architexture to realize simple seed fill algorithm, algorithm principle is following: sub pixel is stacked; When the stack non-NULL, repeat following three steps operation:
(1) the stack top pixel is popped;
(2) pixel of will popping is carried out color and is filled;
(3) check four pixels (four-way connection method) adjacent or eight pixels (eight to connection method) in order with the pixel of popping,
If wherein certain pixel is not or not the border and do not carry out color and fill, and is then stacked this pixel.
Simple seed fill algorithm is pressed into stack architexture to too many pixel, and some pixel even the stack architexture of can repeatedly coming in and going out have reduced the efficient that algorithm is carried out on the one hand to a great extent, and another method also requires very big storage space to realize stack architexture.
If can the pixel that got into stack architexture be indicated; Make this pixel can not get into stack architexture once more; This can solve repeatedly the come in and go out problem of stack architexture of some pixel well, reduce the requirement of algorithm to storage space to a certain extent, and improve algorithm efficiency.
Through analysis, find also to lack at present from three steps that realize seed fill algorithm and set about analyzing repeatedly the come in and go out method of problem of stack architexture of some pixel that solves existing domestic data.The present invention is just through analyze realizing three steps relation each other of seed fill algorithm, proposes a kind ofly can solve repeatedly the come in and go out method of stack architexture problem of some pixel simply and effectively.
(3) summary of the invention
The objective of the invention is to propose a kind ofly can solve repeatedly the come in and go out method of stack architexture problem of some pixel in the seed fill algorithm simply and effectively, can be used for improving the prior seed filling algorithm and carry out efficient and realize the needed storage space of stack architexture with reducing.
The object of the invention reaches through following measure: at first, sub pixel is set to the desired color in fill area (being called for short regional Fill Color), and is pressed into stack architexture; Then, when the stack non-NULL, repeat following two steps:
(1) the stack top pixel is popped;
(2) by the sequential search of left, up, right, down and four the adjacent pixels of pixel of popping,, then this pixel is set to regional Fill Color if wherein certain pixel is not set to regional Fill Color and does not belong to boundary pixel, and stacked.
(4) description of drawings
Fig. 1 is traditional simple seed fill algorithm process flow diagram.
Seed fill algorithm process flow diagram after the process that Fig. 2 proposes for the present invention is improved.
A among Fig. 3, B, C, D pop pixel according to four definite pixels of four-way connection algorithm.
White point among Fig. 4 is for being the seed points of confirming before the square area of 128 * 128 pixels is filled to size.
Fig. 5 provides the region contour that need fill, and the inner white point of profile is represented the seed points selected.
Fig. 6 provides the result after Fig. 5 moves algorithm of the present invention.
(5) embodiment
Below in conjunction with accompanying drawing technical scheme of the present invention is done further to describe in detail.
The present invention designed a kind of solve exist in the simple seed fill algorithm some pixel is repeatedly gone out the method for stack-incoming operation problem.Than not improved simple seed fill algorithm, realize still that in algorithm efficiency the needed storage space of stack architexture all has optimization to a certain degree through the seed fill algorithm behind this method improvement.Traditional seed fill algorithm flow process is as shown in Figure 1, and algorithm flow of the present invention is as shown in Figure 2, and existing zone of filling with the given needs of Fig. 5 is that instantiation specifies the practical implementation step.
(1) the region contour pixel is indicated
The concrete grammar of this step is, all pixels in the image all are provided with a value of statistical indicant, for example for pixel (x, y), its corresponding value of statistical indicant be Flag (x, y), as pixel (x y) belongs to region contour, then make Flag (x, y)=1, otherwise make Flag (x, y)=0.
(2) confirm seed points
The range of choice of seed points need be limited to the intra-zone of required filling, and the inner white point of profile promptly meets such requirement among Fig. 5.
(3) seed points is stacked and be changed to the field color of need filling
Seed points is pressed in the stack architexture as first element, is filled intra-zone owing to seed points is in, so the color of seed points pixel filling needs and the solid colour of zone filling.
(4) if stack architexture is empty, represent regional filling task completion, directly quit a program; Otherwise, repeat following three steps operation:
At first, (x0's stack top pixel y0) pops;
Secondly, order judge four adjacent pixels in pixel left, up, right, down of popping (corresponding coordinate be respectively (x0-1, y0), (x0, y0+1), (x0+1, y0), whether (x0, y0-1), i.e. A among Fig. 3, B, C, D pixel) satisfy stacked condition.Stacked condition is explained as follows: if certain pixel does not belong to region contour (Flag=0) and is not changed to regional Fill Color, think that then this pixel meets stacked condition.
At last, with meeting being pressed into stack architexture in order and being changed to regional Fill Color of stacked condition among A, B, C, the D.
Be the superiority of explanation algorithm of the present invention with respect to traditional simple algorithm; Two kinds of algorithms are realized through the Matlab7.11.0 programming; And respectively Fig. 4 and the given seed points of Fig. 5 are filled the zone that region contour limits, table 1 and table 2 provide the size (element number that algorithm run time stack structure contains at most) of these two kinds of algorithms needed execution time, stack architexture when blank map 4 is regional with Fig. 5, the inner contained sum of all pixels of number of times and fill area of pixel turnover stack architexture respectively.
Table 1 is for Fig. 4, and the performance of two kinds of algorithms relatively
Execution time The stack architexture size Pixel turnover stack number of times The contained sum of all pixels in zone
Traditional algorithm (3.21875 second) 15626 (individual elements) 31501 (inferior) 15876 (individual)
Algorithm of the present invention 1.21875 (second 7848 (individual elements) 15876 (inferior) 15876 (individual)
Table 2 is for Fig. 5, and the performance of two kinds of algorithms relatively
Execution time The stack architexture size Pixel turnover stack number of times The contained sum of all pixels in zone
Traditional algorithm (0.140625 second) 1062 (individual elements) 2395 (inferior) 1274 (individual)
Algorithm of the present invention 0.078125 (second 455 (individual elements) 1274 (inferior) 1274 (individual)
Through table 1 and table 2, can find that algorithm of the present invention has had bigger improvement with respect to traditional seed fill algorithm.Can be known that by " pixel turnover stack number of times " and " regional contained sum of all pixels " this two column data algorithm pixel turnover stack number of times of the present invention equals regional contained sum of all pixels, this explanation algorithm of the present invention does not exist pixel repeatedly to pass in and out the phenomenon of stack architexture; Prior seed filling algorithm pixel turnover stack number of times then is almost the twice of regional contained sum of all pixels, explains that this algorithm exists some pixel repeatedly to pass in and out the phenomenon of stack architexture.Contrast can know that this algorithm can solve the problem that some pixel that exists in the traditional algorithm repeatedly passes in and out stack architexture.
Fig. 6 provides algorithm of the present invention Fig. 5 is filled the result who obtains afterwards, can know the completeness that algorithm is filled by figure.

Claims (1)

1. the present invention proposes a kind of method that pixel in the seed fill algorithm repeatedly goes out stacked problem that solves, can prevent some pixel stack architexture of repeatedly coming in and going out, thereby effectively reduce the quantity of element in the stack architexture and improve algorithm efficiency; It is characterized in that at first, sub pixel is set to regional Fill Color, and be pressed into stack architexture; Then, when the stack non-NULL, repeat following two steps:
Step 1: the stack top pixel is popped;
Step 2: by the sequential search of left, up, right, down and four the adjacent pixels of pixel of popping,, then this pixel is set to regional Fill Color if wherein certain pixel is not set to the desired color in fill area and does not belong to boundary pixel, and stacked.
CN2012101397368A 2012-05-08 2012-05-08 Method for solving problem of pixel multiple accesses to stack in seed filling algorithm Pending CN102693525A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2012101397368A CN102693525A (en) 2012-05-08 2012-05-08 Method for solving problem of pixel multiple accesses to stack in seed filling algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2012101397368A CN102693525A (en) 2012-05-08 2012-05-08 Method for solving problem of pixel multiple accesses to stack in seed filling algorithm

Publications (1)

Publication Number Publication Date
CN102693525A true CN102693525A (en) 2012-09-26

Family

ID=46858932

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2012101397368A Pending CN102693525A (en) 2012-05-08 2012-05-08 Method for solving problem of pixel multiple accesses to stack in seed filling algorithm

Country Status (1)

Country Link
CN (1) CN102693525A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107993242A (en) * 2017-12-14 2018-05-04 天津大学 Based on airborne LiDAR point cloud shortage of data zone boundary extracting method
CN109767479A (en) * 2018-12-13 2019-05-17 南京国电南自电网自动化有限公司 A kind of glyph filling method and system based on dynamic boundary group sequence
CN112465930A (en) * 2020-11-10 2021-03-09 深圳市益欣网络科技有限公司 Scanning line seed filling method

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
杜金津 等: "一种针对超大分辨率图像的分割填充算法", 《计算机工程》 *
柳稼航 等: "适用于任意复杂区域的全自动填充方法", 《计算机工程》 *
王洪月 等: "种子填充算法的改进方法", 《中国科技论文在线》 *
郭文平 等: "扫描线种子填充算法的改进", 《天津工业大学学报》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107993242A (en) * 2017-12-14 2018-05-04 天津大学 Based on airborne LiDAR point cloud shortage of data zone boundary extracting method
CN107993242B (en) * 2017-12-14 2022-06-03 天津大学 Method for extracting boundary of missing area based on airborne LiDAR point cloud data
CN109767479A (en) * 2018-12-13 2019-05-17 南京国电南自电网自动化有限公司 A kind of glyph filling method and system based on dynamic boundary group sequence
CN112465930A (en) * 2020-11-10 2021-03-09 深圳市益欣网络科技有限公司 Scanning line seed filling method

Similar Documents

Publication Publication Date Title
CN105184837B (en) A kind of method and system of vector polygon rasterizing
CN100587720C (en) Rendering apparatus and method, and shape data generation apparatus and method
CN103026402B (en) Show compression super tile image
US20180365873A1 (en) Recursive cell-based hierarchy for data visualizations
CN109388448B (en) Image display method, display system, and computer-readable storage medium
CN101576881A (en) Data visualization system and realization method
CN102937896B (en) The method of color mapping techniques Dynamic Display two-dimensional space data is utilized in SVG
CN103838829B (en) Raster vectorization system based on hierarchical boundary-topology search model
CN103412744B (en) A kind of methods of exhibiting of the integrated information of power plant pel
JP2009525535A5 (en)
CN101794456A (en) Methods of and apparatus for processing graphics
KR20160051154A (en) Rendering method and apparatus, and electronic apparatus
CN105701759A (en) Map vector line element corner reasonability drafting method based on graphics processing unit (GPU)
CN102122502A (en) Method and related device for displaying three-dimensional (3D) font
WO2011059014A1 (en) Chart drawing device and chart drawing method
CN105512265A (en) Method and device for displaying data through figure
CN102819820A (en) Tiled rendering based implementation method for multi-pipeline rendering in GPU (graphics processing unit)
CN103839222A (en) Grid-to-vector parallel system based on hierarchical boundary topology search model
CN109964204A (en) For handling the method and system of figure
CN104866567A (en) Method and apparatus for presenting business data
CN102693525A (en) Method for solving problem of pixel multiple accesses to stack in seed filling algorithm
CN104685543B (en) Graphics rendering device
CN105046632B (en) The efficient bianry image dyadic logical operation method of space-time
CN102999931A (en) Method and device for drawing electronic handwriting
CN107918947A (en) The method and apparatus for handling view data

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20120926