CN111640132A - Single connected region rapid marking method and device - Google Patents

Single connected region rapid marking method and device Download PDF

Info

Publication number
CN111640132A
CN111640132A CN202010487632.0A CN202010487632A CN111640132A CN 111640132 A CN111640132 A CN 111640132A CN 202010487632 A CN202010487632 A CN 202010487632A CN 111640132 A CN111640132 A CN 111640132A
Authority
CN
China
Prior art keywords
column
boundary
row
line
current search
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.)
Granted
Application number
CN202010487632.0A
Other languages
Chinese (zh)
Other versions
CN111640132B (en
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.)
Beijing Institute of Environmental Features
Original Assignee
Beijing Institute of Environmental Features
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 Beijing Institute of Environmental Features filed Critical Beijing Institute of Environmental Features
Priority to CN202010487632.0A priority Critical patent/CN111640132B/en
Publication of CN111640132A publication Critical patent/CN111640132A/en
Application granted granted Critical
Publication of CN111640132B publication Critical patent/CN111640132B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling

Abstract

The invention relates to a method and a device for rapidly marking a single connected region, wherein the method comprises the steps of carrying out boundary estimation on acquired boundary condition data to obtain a boundary estimation rectangle, and obtaining a height value and a column width value of the boundary estimation rectangle; then traversing the boundary condition data, and interpolating two adjacent boundary points in the boundary condition data to obtain boundary interpolation data; finally, judging whether the column width value is larger than the row height value, if so, carrying out row intersection point search and row area marking on the boundary interpolation data row by row in the boundary estimation rectangular area; otherwise, column intersection point searching and column area marking are carried out on the boundary interpolation data column by column in the boundary rectangular area. The marking method can obviously improve the marking speed of the connected region and meet the requirement of real-time marking.

Description

Single connected region rapid marking method and device
Technical Field
The invention relates to the technical field of image processing, in particular to a method and a device for rapidly marking a single connected region.
Background
In the simulation technology test or actual test process, the pixel points belonging to the boundary in the image need to be quickly marked according to the input boundary condition data so as to facilitate subsequent processing. The connected region marking method in the prior art needs long time and cannot meet the real-time requirement. For example, in the experimental process, for an image with frame rate of 100HZ and resolution of 640 × 512, the time for processing one frame of image in real time cannot be more than 10 ms. The time for marking the image area per frame cannot be more than 1ms because of the need for other image processing calculations. The mark is judged point by using the traditional method, generally 5-10ms is needed, the needed time is too long, and the requirement can not be met.
Therefore, in view of the above disadvantages, it is desirable to provide a fast connected region labeling method that reduces the labeling time.
Disclosure of Invention
The invention aims to solve the technical problem that the existing marking method cannot meet the real-time requirement due to overlong time, and provides a single connected region rapid marking method for improving the marking speed aiming at the defects in the prior art.
In order to solve the technical problem, the invention provides a method for rapidly marking a single connected region, which comprises the following steps:
step S1, boundary condition data are obtained, boundary estimation is carried out on the boundary condition data to obtain a boundary estimation rectangle, and a row height value and a column width value of the boundary estimation rectangle are obtained;
step S2, traversing the boundary condition data, and interpolating two adjacent boundary points in the boundary condition data to obtain boundary interpolation data;
step S3, judging whether the column width value is larger than the row height value, if so, performing row intersection point search and row area marking on the boundary interpolation data row by row in the boundary estimation rectangular area; otherwise, column cross point search and column area marking are carried out on the boundary interpolation data column by column in the boundary rectangular area.
Preferably, the step S1 specifically includes:
acquiring boundary condition data, performing traversal search on the boundary condition data to obtain a row minimum value, a row maximum value, a column minimum value and a column maximum value in the boundary condition data, acquiring the boundary estimation rectangle according to the row minimum value, the row maximum value, the column minimum value and the column maximum value, and acquiring the row height value and the column width value of the boundary estimation rectangle.
Preferably, the interpolating two adjacent boundary points in the boundary condition data in step S2 specifically includes:
and calculating the row difference and the column difference of two adjacent boundary points in the boundary condition data, and performing equal interval interpolation on the two adjacent boundary points, wherein the interpolation number is the larger value of the row difference and the column difference.
Preferably, the search line for performing the line intersection search in step S3 ranges from the line minimum value to the line maximum value.
Preferably, the line intersection searching and line area marking in step S3 specifically includes:
traversing the boundary interpolation data, and searching a line intersection point of a current search line, wherein the line intersection point meets the following conditions:
H≤hi
H>hi+1
or
H≥hi
H<hi+1
Where H denotes the current search line, HiLine position, h, representing the ith boundary point in the boundary interpolation datai+1A line position representing the (i + 1) th boundary point in the boundary interpolation data;
the line intersections are subjected to increasing sequencing according to line positions to obtain increasing sequence line intersections, and the increasing sequence line intersections are marked as Bj(h, w) (j ═ 0, 1.., M-1), where h denotes the row position, w denotes the column position, and M denotes the number of row intersections within the current search row;
according to the increasing sequence line intersection points, marking the line area of the current search line, wherein the specific expression is as follows:
Ii(H,w)=1(wj<wi<wj+1,j=0,2,4,...,j≤M-1)
wherein, Ii(H, w) represents the image pixel value of the current search line, wiIndicating the ith in the boundary interpolation dataColumn position of boundary point, wjA column position, w, representing the jth row crossing point among the increasing sequence of row crossings of the current search rowj+1And the column position of the j +1 th line intersection in the increasing sequence line intersections of the current search line is represented, if M is an even number, the maximum value of j is M-2, and if M is an odd number, the maximum value of j is M-1.
Preferably, the search column for performing the column intersection search in step S3 ranges from the column minimum value to the column maximum value.
Preferably, the column intersection search and the column area labeling in step S3 specifically include:
traversing the boundary interpolation data, and searching column intersection points of the current search column, wherein the column intersection points meet the following conditions:
W≤wi
W>wi+1
or
W≥wi
W<wi+1
Where W denotes the current search column, WiIndicating the column position of the ith boundary point in the boundary interpolation data, wi+1A column position indicating an i +1 th boundary point in the boundary interpolation data;
the column intersections are subjected to increasing sequencing according to column positions to obtain increasing sequence intersections, and the increasing sequence intersections are marked as Bk(h, w) (k ═ 0, 1.., N-1), where h denotes the row position, w denotes the column position, and N denotes the number of column intersections within the current search column;
according to the sequence increasing intersection points, carrying out column region marking on the current search column, wherein the specific expression is as follows:
Ii(h,W)=1(hk<hi<hk+1,k=0,2,4,...,k≤N-1)
wherein, Ii(h, W) represents the image pixel value of the current search column, hiLine position, h, representing the ith boundary point in the boundary interpolation datakRow position, h, representing the k-th column crossing in the increasing sequence crossings of the current search columnk+1Representing a current search columnThe line position of the (k + 1) th column cross point in the increased sequence cross point is that if N is an even number, the maximum value of k is N-2, and if N is an odd number, the maximum value of k is N-1.
The invention also provides a single connected region rapid marking device, which is characterized by comprising:
the boundary estimation unit is used for acquiring boundary condition data, performing boundary estimation on the boundary condition data to obtain a boundary estimation rectangle, and obtaining a row height value and a column width value of the boundary estimation rectangle;
the boundary interpolation unit is used for traversing the boundary condition data and interpolating two adjacent boundary points in the boundary condition data to obtain boundary interpolation data;
the area marking unit is used for judging whether the column width value is larger than the row height value or not, and if so, line intersection point searching and line area marking are carried out on the boundary interpolation data line by line in the boundary estimation rectangular area; otherwise, column intersection point searching and column area marking are carried out on the boundary interpolation data column by column in the boundary rectangular area.
Preferably, the boundary estimation unit is specifically configured to perform the following operations:
acquiring boundary condition data, performing traversal search on the boundary condition data to obtain a row minimum value, a row maximum value, a column minimum value and a column maximum value in the boundary condition data, acquiring the boundary estimation rectangle according to the row minimum value, the row maximum value, the column minimum value and the column maximum value, and acquiring the row height value and the column width value of the boundary estimation rectangle.
Preferably, the boundary interpolation unit is specifically configured to perform the following operations:
and calculating the row difference and the column difference of two adjacent boundary points in the boundary condition data, and performing equal interval interpolation on the two adjacent boundary points, wherein the interpolation number is the larger value of the row difference and the column difference.
Preferably, the search line used by the area marking unit to perform the line intersection search ranges from the line minimum value to the line maximum value.
Preferably, when the area marking unit is used for performing row intersection searching and row area marking, the following operations are specifically performed:
traversing the boundary interpolation data, and searching a line intersection point of a current search line, wherein the line intersection point meets the following conditions:
H≤hi
H>hi+1
or
H≥hi
H<hi+1
Where H denotes the current search line, HiLine position, h, representing the ith boundary point in the boundary interpolation datai+1A line position representing the (i + 1) th boundary point in the boundary interpolation data;
the line intersections are subjected to increasing sequencing according to line positions to obtain increasing sequence line intersections, and the increasing sequence line intersections are marked as Bj(h, w) (j ═ 0, 1.., M-1), where h denotes the row position, w denotes the column position, and M denotes the number of row intersections within the current search row;
according to the increasing sequence line intersection points, marking the line area of the current search line, wherein the specific expression is as follows:
Ii(H,w)=1(wj<wi<wj+1,j=0,2,4,...,j≤M-1)
wherein, Ii(H, w) represents the image pixel value of the current search line, wiIndicating the column position of the ith boundary point in the boundary interpolation data, wjA column position, w, representing the jth row crossing point among the increasing sequence of row crossings of the current search rowj+1And the column position of the j +1 th line intersection in the increasing sequence line intersections of the current search line is represented, if M is an even number, the maximum value of j is M-2, and if M is an odd number, the maximum value of j is M-1.
Preferably, the search columns used by the area labeling unit to perform the column intersection search range from the column minimum value to the column maximum value.
Preferably, when the area marking unit is used for performing column intersection searching and column area marking, the following operations are specifically performed:
traversing the boundary interpolation data, and searching column intersection points of the current search column, wherein the column intersection points meet the following conditions:
W≤wi
W>wi+1
or
W≥wi
W<wi+1
Where W denotes the current search column, WiIndicating the column position of the ith boundary point in the boundary interpolation data, wi+1A column position indicating an i +1 th boundary point in the boundary interpolation data;
the column intersections are subjected to increasing sequencing according to column positions to obtain increasing sequence intersections, and the increasing sequence intersections are marked as Bk(h, w) (k ═ 0, 1.., N-1), where h denotes the row position, w denotes the column position, and N denotes the number of column intersections within the current search column;
according to the sequence increasing intersection points, carrying out column region marking on the current search column, wherein the specific expression is as follows:
Ii(h,W)=1(hk<hi<hk+1,k=0,2,4,...,k≤N-1)
wherein, Ii(h, W) represents the image pixel value of the current search column, hiLine position, h, representing the ith boundary point in the boundary interpolation datakRow position, h, representing the k-th column crossing in the increasing sequence crossings of the current search columnk+1And the row position of the (k + 1) th column intersection in the increased sequence intersections of the current search column is represented, if N is an even number, the maximum value of k is N-2, and if N is an odd number, the maximum value of k is N-1.
The method and the device for rapidly marking the single connected region have the following beneficial effects:
1. according to the scheme, the boundary condition data are estimated to obtain the boundary estimation rectangle, so that the search area range is reduced, and the search time is reduced;
2. according to the method, when the region is marked, the line height value and the column width value of the boundary estimation rectangle are judged and compared, and line intersection searching and line region marking or column intersection searching and column region marking are correspondingly selected, so that the searching time and the marking time are greatly shortened, the problem that the existing marking method takes a long time and cannot meet the real-time requirement is solved, and the real-time marking of image pixel points in boundaries of any shapes can be realized;
3. the invention interpolates the boundary condition data before marking the region, so that the boundary data reaches the sub-pixel resolution, and the marking accuracy can be further improved.
Drawings
FIG. 1 is a flowchart of a single connected region fast labeling method according to a first embodiment of the present invention;
FIG. 2 is a schematic diagram of a single connected region rapid marking apparatus according to a second embodiment of the present invention;
FIG. 3 is a schematic diagram of a boundary estimation rectangle of an embodiment;
FIG. 4 is a diagram illustrating the results of the row intersection search of FIG. 3;
FIG. 5 is a schematic diagram of a boundary estimation rectangle of another embodiment;
fig. 6 is a diagram illustrating the results of the column intersection search performed in fig. 5.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making an invasive task, are within the scope of the present invention.
Example one
As shown in fig. 1, the method for rapidly marking a single connected area provided in the embodiment of the present invention specifically includes the following steps:
first, in step S1, boundary condition data is acquired, and boundary estimation is performed on the boundary condition data to obtain a boundary estimation rectangle, and a row height value and a column width value of the boundary estimation rectangle are obtained.
The method aims at the single connected region, and the boundary condition data is obtained according to the existing method and is known data. For example, the boundary condition data obtained may be expressed as: b isl(h, w) (l ═ 0, 1.., n-1), where B is presentl(h, w) represents boundary points in the boundary condition data, n represents the number of boundary points in the boundary condition data, h represents a row position, and w represents a column position.
In some preferred embodiments, the step specifically comprises: acquiring boundary condition data, performing traversal search on the boundary condition data to obtain a row minimum value, a row maximum value, a column minimum value and a column maximum value in the boundary condition data, acquiring a boundary estimation rectangle according to the row minimum value, the row maximum value, the column minimum value and the column maximum value, and acquiring a row height value and a column width value of the boundary estimation rectangle.
Specifically, for the above boundary condition data Bl(h, w) (l ═ 0, 1.., n-1) to perform a traversal search, finding the line minimum hminRow maximum value hmaxColumn minimum value wminAnd column maximum value wmaxIn h, withmin、hmax、wminAnd wmaxDividing a boundary estimation rectangle, wherein the boundary estimation rectangle comprises a connected region, and obtaining a line height bh and a column width bw of the boundary estimation rectangle at the same time, which can be specifically expressed as follows:
bh=hmax-hmin
bw=wmax-wmin
by carrying out boundary estimation, a boundary estimation rectangle containing a connected region is obtained, the range of subsequent search marks can be narrowed, and the search time is shortened.
Subsequently, in step S2, the boundary condition data is traversed, and two adjacent boundary points in the boundary condition data are interpolated to obtain boundary interpolation data.
In some preferred embodiments, the two adjacent boundary points in the boundary condition data are interpolated at equal intervals by calculating the row difference value and the column difference value of the two adjacent boundary points, and the interpolation number is the larger value of the row difference value and the column difference value.
In particular, suppose B1(h, w) and B2(h, w) are two adjacent boundary points, and the row difference ch and the column difference cw of the two boundary points are respectively calculated:
ch=h2-h1
cw=w2-w1
wherein h is1Represents the boundary point B1Line position of (h, w), h2Represents the boundary point B2Line position of (h, w), w1Represents the boundary point B1Column position of (h, w), w2Represents the boundary point B2Column position of (h, w).
Comparing the row difference ch and the column difference cw, and taking the larger value of the two as the interpolation number, for example, ch > cw, then at the adjacent boundary point B1(h, w) and B2And (h, w) are interpolated at equal intervals, and the number of the interpolated values is ch. After the boundary condition data are traversed for interpolation, the total number of boundary points is increased to obtain boundary interpolation data which are marked as Bi(h, w) (i ═ 0, 1.., cn-1), where B is presenti(h, w) represents boundary points in the boundary interpolation data, cn represents the number of boundary points in the boundary interpolation data, h represents a row position, and w represents a column position.
The invention performs equal interval interpolation on the acquired boundary condition data to enable the boundary point to reach the sub-pixel resolution, thereby improving the accuracy of region marking.
Subsequently, in step S3, it is determined whether the column width value is greater than the row height value, and if so, row intersection search and row area labeling are performed on the boundary interpolation data row by row in the boundary estimation rectangular area; otherwise, column intersection point searching and column area marking are carried out on the boundary interpolation data column by column in the boundary rectangle area.
After the boundary interpolation is carried out, comparing and judging the row height value and the column width value of a boundary estimation rectangle, and marking a row area if the column width value is greater than the row height value; otherwise, marking the column region. This can shorten the search time and further improve the search speed.
In some preferred embodiments, the search rows for the row intersection search range from a row minimum value to a row maximum value when the column width value is greater than the row height value.
Specifically, when the column width value bw is larger than the row height value bh, the row minimum value h is set from the row minimum value h when the row cross point search is performedminTo the maximum value of line hmaxThe search is performed row by row.
Traversing the boundary interpolation data B on the assumption of the current search behavior H linei(h, w) (i ═ 0, 1.., cn-1), searching for a line intersection, wherein the line intersection satisfies the following condition:
H≤hi
H>hi+1
or
H≥hi
H<hi+1
Where H denotes the current search line, HiLine position, h, representing the ith boundary point in the boundary interpolation datai+1And (3) indicating the line position of the (i + 1) th boundary point in the boundary interpolation data.
Then, the line intersections of the current search line are subjected to increasing ordering according to line positions from small to large to obtain increasing order line intersections, and the increasing order line intersections are marked as Bj(h, w) (j ═ 0, 1.., M-1), where h denotes the row position, w denotes the column position, and M denotes the number of row intersections within the current search row.
Then line intersections B are increased in accordance with the abovej(h, w) (j is 0, 1.., M-1), performing region marking on the current search line, and marking a pixel point in the communication region as 1, wherein a specific expression is as follows:
Ii(H,w)=1(wj<wi<wj+1,j=0,2,4,...,j≤M-1)
wherein, Ii(H, w) represents the image pixel value of the current search line, wiIndicating the column position of the ith boundary point in the boundary interpolation data, wjA column position, w, representing the jth row crossing point among the increasing sequence of row crossings of the current search rowj+1Representing a current searchAnd the maximum value of j is M-2 if M is an even number, and the maximum value of j is M-1 if M is an odd number.
The above steps of line intersection point search and line area marking are repeated line by line, and then all points in the boundary can be marked.
In some further preferred embodiments, the search column for performing the column crossing point search ranges from the column minimum value to the column maximum value when the column width value is greater than the row height value.
Specifically, when the column width value bw is not larger than the row height value bh, the column intersection search is performed from the column minimum value wminTo the maximum value w of the columnmaxThe search is performed column by column.
Traversing the boundary interpolation data B on the assumption that the current search column is W columni(h, w) (i ═ 0, 1.., cn-1), searching for a column intersection, wherein the column intersection satisfies the following condition:
W≤wi
W>wi+1
or
W≥wi
W<wi+1
Where W denotes the current search column, WiIndicating the column position of the ith boundary point in the boundary interpolation data, wi+1The column position of the (i + 1) th boundary point in the boundary interpolation data is indicated.
Then, according to the above-mentioned column crossing points making progressive increase sorting according to the column position from small to large to obtain increasing sequence crossing point, and marking as Bk(h, w) (k 0, 1.., N-1), where h denotes a row position, w denotes a column position, and N denotes the number of column intersections within the current search column.
And then subsequently cross over point B according to the increasing sequence described abovek(h, w) (k is 0,1,.., N-1), performing column region marking on the current search column, and marking the pixel points in the communication region as 1, wherein the specific expression is as follows:
Ii(h,W)=1(hk<hi<hk+1,k=0,2,4,...,k≤N-1)
wherein, Ii(h, W) represents the image pixel value of the current search column, hiLine position, h, representing the ith boundary point in the boundary interpolation datakRow position, h, representing the k-th column crossing in the increasing sequence crossings of the current search columnk+1And the row position of the (k + 1) th column intersection in the increased sequence intersections of the current search column is represented, if N is an even number, the maximum value of k is N-2, and if N is an odd number, the maximum value of k is N-1.
The above steps of column intersection searching and column area marking are repeated column by column, so that all points in the boundary area can be marked.
When in use, the marking method of the invention can be programmed, for example, the c language is adopted for programming, and the marking method can be operated on a real-time processing system or a PC.
It should be noted that when the row height value of the boundary estimation rectangle is equal to the column width value, the method of row intersection search and row area marking may also be used, and the search efficiency is equivalent to the method of column intersection search and column area marking.
The method of the invention obtains the boundary estimation rectangle by estimating the boundary condition data, reduces the search area range and reduces the search time. When area marking is carried out subsequently, line cross point searching and line area marking or column cross point searching and column area marking are correspondingly selected by judging and comparing the sizes of the height value and the column width value of the boundary estimation rectangle, so that the searching time and the marking time are greatly shortened, the problem that the existing marking method takes a long time and cannot meet the real-time requirement is solved, the real-time marking of image pixel points in boundaries with any shapes can be realized, and compared with the traditional point-by-point searching and marking method, the method has shorter searching time and higher marking speed.
Example two
As shown in fig. 2, the apparatus for rapidly labeling a single connected region according to the second embodiment includes a boundary estimation unit 100, a boundary interpolation unit 200, and a region labeling unit 300.
The boundary estimation unit 100 is configured to acquire boundary condition data, perform boundary estimation on the boundary condition data to obtain a boundary estimation rectangle, and obtain a row height value and a column width value of the boundary estimation rectangle.
In some preferred embodiments, the boundary estimation unit 100 is specifically configured to: acquiring boundary condition data, performing traversal search on the boundary condition data to obtain a row minimum value, a row maximum value, a column minimum value and a column maximum value in the boundary condition data, acquiring a boundary estimation rectangle according to the row minimum value, the row maximum value, the column minimum value and the column maximum value, and acquiring a row height value and a column width value of the boundary estimation rectangle.
And a boundary interpolation unit 200, configured to traverse the boundary condition data, and interpolate two adjacent boundary points in the boundary condition data to obtain boundary interpolation data.
In some preferred embodiments, the boundary interpolation unit 200 is configured to perform the following operations: and performing equal interval interpolation on the two adjacent boundary points by calculating the row difference value and the column difference value of the two adjacent boundary points in the boundary condition data, wherein the interpolation number is the larger value of the row difference value and the column difference value.
The area marking unit 300 is configured to determine whether the column width value is greater than the line height value, and if so, perform line intersection search and line area marking on the boundary interpolation data line by line in the boundary estimation rectangular area; otherwise, column intersection point searching and column area marking are carried out on the boundary interpolation data column by column in the boundary rectangle area.
In some preferred embodiments, the search rows for the row intersection search range from a row minimum value to a row maximum value when the column width value is greater than the row height value.
In some preferred embodiments, when the area marking unit 300 is used for performing the row intersection search and the row area marking, the following operations are specifically performed:
traversing the boundary interpolation data, and searching a line intersection point of a current search line, wherein the line intersection point meets the following conditions:
H≤hi
H>hi+1
or
H≥hi
H<hi+1
Where H denotes the current search line, HiLine position, h, representing the ith boundary point in the boundary interpolation datai+1A line position representing the (i + 1) th boundary point in the boundary interpolation data;
the line intersections are subjected to increasing sequencing according to line positions to obtain increasing sequence line intersections, and the increasing sequence line intersections are marked as Bj(h, w) (j ═ 0, 1.., M-1), where h denotes the row position, w denotes the column position, and M denotes the number of row intersections within the current search row;
according to the increasing sequence line intersection points, marking the line area of the current search line, wherein the specific expression is as follows:
Ii(H,w)=1(wj<wi<wj+1,j=0,2,4,...,j≤M-1)
wherein, Ii(H, w) represents the image pixel value of the current search line, wiIndicating the column position of the ith boundary point in the boundary interpolation data, wjA column position, w, representing the jth row crossing point among the increasing sequence of row crossings of the current search rowj+1And the column position of the j +1 th line intersection in the increasing sequence line intersections of the current search line is represented, if M is an even number, the maximum value of j is M-2, and if M is an odd number, the maximum value of j is M-1.
In some preferred embodiments, the search column for column intersection searches ranges from the column minimum value to the column maximum value when the column width value is greater than the row height value.
In some preferred embodiments, when the area labeling unit 300 is used for performing row intersection searching and column area labeling, the following operations are specifically performed:
traversing the boundary interpolation data, and searching column intersection points of the current search column, wherein the column intersection points meet the following conditions:
W≤wi
W>wi+1
or
W≥wi
W<wi+1
Where W denotes the current search column, WiIndicating the column position of the ith boundary point in the boundary interpolation data, wi+1A column position indicating an i +1 th boundary point in the boundary interpolation data;
the column intersections are subjected to increasing sequencing according to column positions to obtain increasing sequence intersections, and the increasing sequence intersections are marked as Bk(h, w) (k ═ 0, 1.., N-1), where h denotes the row position, w denotes the column position, and N denotes the number of column intersections within the current search column;
according to the sequence increasing intersection points, carrying out column region marking on the current search column, wherein the specific expression is as follows:
Ii(h,W)=1(hk<hi<hk+1,k=0,2,4,...,k≤N-1)
wherein, Ii(h, W) represents the image pixel value of the current search column, hiLine position, h, representing the ith boundary point in the boundary interpolation datakRow position, h, representing the k-th column crossing in the increasing sequence crossings of the current search columnk+1And the row position of the (k + 1) th column intersection in the increased sequence intersections of the current search column is represented, if N is an even number, the maximum value of k is N-2, and if N is an odd number, the maximum value of k is N-1.
It will be appreciated that the principles of the single-connected region rapid marking apparatus of the present invention are the same as the preceding single-connected region rapid marking method, and therefore the specific description of the embodiments of the method applies to the apparatus as well.
The invention also provides comparison with the traditional point-by-point marking method, and verifies that the scheme of the invention can greatly improve the area marking speed. The frame frequency of the first test image used in the present invention is 100HZ, the resolution is 640 × 512, and fig. 3 is a schematic diagram illustrating the boundary estimation of a set of boundary condition data obtained from the first test image, where a black rectangle is a boundary estimation rectangle. Referring to fig. 4, a schematic diagram of a result of performing row intersection search on one row in fig. 3 is shown, where a, b, c, and d respectively represent 0 th, 1 st, 2 nd, and 3 rd row intersections, and then performing row region labeling according to an odd-even interphase rule, that is, a pixel point between the 0 th and 1 st row intersections is a point in a connected region, a pixel point between the 1 st and 2 nd row intersections is not a point in the connected region, and a pixel point between the 2 nd and 3 rd row intersections is a point in the connected region, thereby labeling the point in the connected region as 1. The first test image is marked by the traditional point-by-point marking method for 50ms, while the marking method of the invention only needs 0.6 ms. The frame frequency of the second test image used in the present invention is 50HZ, the resolution is 320 × 256, and referring to fig. 5, the second test image is a schematic diagram of performing boundary estimation on a set of boundary condition data of the second test image, where a black rectangle is a boundary estimation rectangle. Referring to fig. 6, a schematic diagram of a result of performing row-column intersection search on one column in fig. 5 is shown, where e and f respectively represent 0 th and 1 st column intersections, and then row area marking is performed according to an odd-even alternation rule, that is, a pixel point between the 0 th and 1 st column intersections is a point in a communication area, and the point in the communication area is marked as 1. The marking of the second test image by the conventional point-by-point marking method takes 6ms, while the marking method of the invention only needs 0.07 ms.
In summary, the invention performs boundary estimation on the boundary condition data to obtain the boundary estimation rectangle, and only needs to search the boundary points in the boundary estimation rectangle area during the subsequent search, thereby reducing the search area range and reducing the search time. Compared with the traditional point-by-point marking method, the method has the advantages that the searching and marking time is greatly shortened, the problem that the existing marking method takes too long time to meet the real-time requirement is solved, and the real-time marking of image pixel points in boundaries with any shapes can be realized. In addition, the invention interpolates the boundary condition data before marking the region, so that the boundary data reaches the sub-pixel resolution, and the marking accuracy can be further improved.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A single connected region rapid marking method is characterized by comprising the following steps:
step S1, boundary condition data are obtained, boundary estimation is carried out on the boundary condition data to obtain a boundary estimation rectangle, and a row height value and a column width value of the boundary estimation rectangle are obtained;
step S2, traversing the boundary condition data, and interpolating two adjacent boundary points in the boundary condition data to obtain boundary interpolation data;
step S3, judging whether the column width value is larger than the row height value, if so, performing row intersection point search and row area marking on the boundary interpolation data row by row in the boundary estimation rectangular area; otherwise, column intersection point searching and column area marking are carried out on the boundary interpolation data column by column in the boundary rectangular area.
2. The method for rapidly marking a single connected region according to claim 1, wherein the step S1 specifically comprises:
acquiring boundary condition data, performing traversal search on the boundary condition data to obtain a row minimum value, a row maximum value, a column minimum value and a column maximum value in the boundary condition data, acquiring the boundary estimation rectangle according to the row minimum value, the row maximum value, the column minimum value and the column maximum value, and acquiring the row height value and the column width value of the boundary estimation rectangle.
3. The method for rapidly labeling a single connected region according to claim 1 or 2, wherein the step S2 of interpolating two adjacent boundary points in the boundary condition data specifically includes:
and calculating the row difference value and the column difference value of two adjacent boundary points in the boundary condition data, and performing equal interval interpolation on the two adjacent boundary points, wherein the interpolation number is the larger value of the row difference value and the column difference value.
4. The single-connected region rapid marking method according to claim 2, characterized in that: the search line for which the line intersection search is performed in the step S3 ranges from the line minimum value to the line maximum value.
5. The method for rapidly labeling a single connected region according to claim 1, wherein the row intersection searching and row region labeling in step S3 specifically comprises:
traversing the boundary interpolation data, and searching a line intersection point of a current search line, wherein the line intersection point meets the following conditions:
H≤hi
H>hi+1
or
H≥hi
H<hi+1
Where H denotes the current search line, HiLine position, h, representing the ith boundary point in the boundary interpolation datai+1A line position representing the (i + 1) th boundary point in the boundary interpolation data;
the line intersections are subjected to increasing sequencing according to line positions to obtain increasing sequence line intersections, and the increasing sequence line intersections are marked as Bj(h, w) (j ═ 0, 1.., M-1), where h denotes a row position, w denotes a column position, and M denotes the number of row intersections within the current search row;
marking the line area of the current search line according to the increasing sequence line intersection, wherein the specific expression is as follows:
Ii(H,w)=1(wj<wi<wj+1,j=0,2,4,...,j≤M-1)
wherein, Ii(H, w) represents the image pixel value of the current search line, wiIndicating the column position of the ith boundary point in the boundary interpolation data, wjA column position, w, representing the jth row crossing point among the increasing sequence of row crossings of the current search rowj+1And the column position of the j +1 th line intersection in the increasing sequence line intersections of the current search line is represented, if M is an even number, the maximum value of j is M-2, and if M is an odd number, the maximum value of j is M-1.
6. The single-connected region rapid marking method according to claim 2, characterized in that: the search column for the column intersection search in step S3 ranges from the column minimum value to the column maximum value.
7. The method for rapidly labeling a single connected region according to claim 1, wherein the column intersection searching and column region labeling in step S3 specifically comprises:
traversing the boundary interpolation data, and searching column intersection points of the current search column, wherein the column intersection points meet the following conditions:
W≤wi
W>wi+1
or
W≥wi
W<wi+1
Where W denotes the current search column, WiIndicating the column position of the ith boundary point in the boundary interpolation data, wi+1A column position indicating an i +1 th boundary point in the boundary interpolation data;
the column intersections are subjected to increasing sequencing according to column positions to obtain increasing sequence intersections, and the increasing sequence intersections are marked as Bk(h, w) (k ═ 0, 1.., N-1), where h denotes the row position, w denotes the column position, and N denotes the number of column intersections within the current search column;
according to the increased sequence intersection points, column region marking is carried out on the current search column, and the specific expression is as follows:
Ii(h,W)=1(hk<hi<hk+1,k=0,2,4,...,k≤N-1)
wherein, Ii(h, W) represents the image pixel value of the current search column, hiLine position, h, representing the ith boundary point in the boundary interpolation datakRow position, h, representing the k-th column crossing in the increasing sequence crossings of the current search columnk+1And the row position of the (k + 1) th column intersection in the increased sequence intersections of the current search column is represented, if N is an even number, the maximum value of k is N-2, and if N is an odd number, the maximum value of k is N-1.
8. A single-connectivity area rapid marking device, comprising:
the boundary estimation unit is used for acquiring boundary condition data, carrying out boundary estimation on the boundary condition data to obtain a boundary estimation rectangle, and obtaining a row height value and a column width value of the boundary estimation rectangle;
the boundary interpolation unit is used for traversing the boundary condition data and interpolating two adjacent boundary points in the boundary condition data to obtain boundary interpolation data;
the area marking unit is used for judging whether the column width value is larger than the row height value or not, and if so, line intersection point searching and line area marking are carried out on the boundary interpolation data line by line in the boundary estimation rectangular area; otherwise, column intersection point searching and column area marking are carried out on the boundary interpolation data column by column in the boundary rectangular area.
9. The apparatus according to claim 8, wherein the area marking unit is configured to perform the following operations when performing the line intersection search and the line area marking:
traversing the boundary interpolation data, and searching a line intersection point of a current search line, wherein the line intersection point meets the following conditions:
H≤hi
H>hi+1
or
H≥hi
H<hi+1
Where H denotes the current search line, HiLine position, h, representing the ith boundary point in the boundary interpolation datai+1A line position representing the (i + 1) th boundary point in the boundary interpolation data;
the line intersections are subjected to increasing sequencing according to line positions to obtain increasing sequence line intersections, and the increasing sequence line intersections are marked as Bj(h, w) (j ═ 0, 1.., M-1), where h denotes a row position, w denotes a column position, and M denotes the number of row intersections within the current search row;
marking the line area of the current search line according to the increasing sequence line intersection, wherein the specific expression is as follows:
Ii(H,w)=1(wj<wi<wj+1,j=0,2,4,...,j≤M-1)
wherein, Ii(H, w) represents the image pixel value of the current search line, wiIndicating the column position of the ith boundary point in the boundary interpolation data, wjA column position, w, representing the jth row crossing point among the increasing sequence of row crossings of the current search rowj+1And the column position of the j +1 th line intersection in the increasing sequence line intersections of the current search line is represented, if M is an even number, the maximum value of j is M-2, and if M is an odd number, the maximum value of j is M-1.
10. The apparatus according to claim 8, wherein the area marking unit is configured to perform column intersection searching and column area marking by performing the following operations:
traversing the boundary interpolation data, and searching column intersection points of the current search column, wherein the column intersection points meet the following conditions:
W≤wi
W>wi+1
or
W≥wi
W<wi+1
Where W denotes the current search column, WiIndicating the column position of the ith boundary point in the boundary interpolation data, wi+1A column position indicating an i +1 th boundary point in the boundary interpolation data;
the column intersections are subjected to increasing sequencing according to column positions to obtain increasing sequence intersections, and the increasing sequence intersections are marked as Bk(h, w) (k ═ 0, 1.., N-1), where h denotes the row position, w denotes the column position, and N denotes the number of column intersections within the current search column;
according to the increased sequence intersection points, column region marking is carried out on the current search column, and the specific expression is as follows:
Ii(h,W)=1(hk<hi<hk+1,k=0,2,4,...,k≤N-1)
wherein, Ii(h, W) represents the image pixel value of the current search column, hiLine position, h, representing the ith boundary point in the boundary interpolation datakRow position, h, representing the k-th column crossing in the increasing sequence crossings of the current search columnk+1And the row position of the (k + 1) th column intersection in the increased sequence intersections of the current search column is represented, if N is an even number, the maximum value of k is N-2, and if N is an odd number, the maximum value of k is N-1.
CN202010487632.0A 2020-06-02 2020-06-02 Quick marking method and device for single communication area Active CN111640132B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010487632.0A CN111640132B (en) 2020-06-02 2020-06-02 Quick marking method and device for single communication area

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010487632.0A CN111640132B (en) 2020-06-02 2020-06-02 Quick marking method and device for single communication area

Publications (2)

Publication Number Publication Date
CN111640132A true CN111640132A (en) 2020-09-08
CN111640132B CN111640132B (en) 2023-05-26

Family

ID=72330667

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010487632.0A Active CN111640132B (en) 2020-06-02 2020-06-02 Quick marking method and device for single communication area

Country Status (1)

Country Link
CN (1) CN111640132B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002175533A (en) * 2000-12-07 2002-06-21 Aloka Co Ltd Area detecting method and ultrasonic image processor
CN105404868A (en) * 2015-11-19 2016-03-16 电子科技大学 Interaction platform based method for rapidly detecting text in complex background
CN107657639A (en) * 2017-08-09 2018-02-02 武汉高德智感科技有限公司 A kind of method and apparatus of quickly positioning target
CN109145808A (en) * 2018-08-17 2019-01-04 郑州轻工业学院 A kind of tuna recognition methods based on adaptive fish body bending die
CN111105431A (en) * 2019-12-20 2020-05-05 深圳市智影医疗科技有限公司 Method and device for marking image

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002175533A (en) * 2000-12-07 2002-06-21 Aloka Co Ltd Area detecting method and ultrasonic image processor
CN105404868A (en) * 2015-11-19 2016-03-16 电子科技大学 Interaction platform based method for rapidly detecting text in complex background
CN107657639A (en) * 2017-08-09 2018-02-02 武汉高德智感科技有限公司 A kind of method and apparatus of quickly positioning target
CN109145808A (en) * 2018-08-17 2019-01-04 郑州轻工业学院 A kind of tuna recognition methods based on adaptive fish body bending die
CN111105431A (en) * 2019-12-20 2020-05-05 深圳市智影医疗科技有限公司 Method and device for marking image

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
章德伟;蒲晓蓉;章毅;: "基于Max-tree的连通区域标记新算法" *

Also Published As

Publication number Publication date
CN111640132B (en) 2023-05-26

Similar Documents

Publication Publication Date Title
JP4806230B2 (en) Deterioration dictionary generation program, method and apparatus
CN109146912B (en) Visual target tracking method based on target analysis
CN110598698B (en) Natural scene text detection method and system based on adaptive regional suggestion network
CN108345888A (en) A kind of connected domain extracting method and device
CN111062331B (en) Image mosaic detection method and device, electronic equipment and storage medium
CN111757110A (en) Video coding method, coding tree unit dividing method, system, device and readable storage medium
CN110544267B (en) Correlation filtering tracking method for self-adaptive selection characteristics
CN109660814B (en) Method for detecting deletion tampering of video foreground
CN111967345A (en) Method for judging shielding state of camera in real time
CN111149101A (en) Target pattern searching method and computer readable storage medium
CN111640132A (en) Single connected region rapid marking method and device
CN110996128B (en) Online teaching video push management system
CN109886276B (en) Half-word judging method for dial rolling digital character
JP4453202B2 (en) Image processing apparatus, image processing method, and computer-readable recording medium
CN113470063A (en) Multi-target tracking method, device and medium based on feature set
JP2980810B2 (en) Motion vector search method and apparatus
JP3727768B2 (en) Computer image display method and display device
CN111046727A (en) Video feature extraction method and device, electronic equipment and storage medium
CN115098731B (en) Target association method, device and storage medium
CN113139625B (en) Model training method, electronic equipment and storage medium thereof
CN112819820B (en) Road asphalt repairing and detecting method based on machine vision
CN116757964B (en) Image correction method for geographical information display
CN116229419B (en) Pedestrian detection method and device
CN109271986B (en) Digital identification method based on Second-Confirm
CN111783794B (en) Multi-scale target detection method based on depth separable convolution residual block and improved NMS (network management system)

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant