CN115049685A - Region growing image segmentation method and device, computer equipment and storage medium - Google Patents

Region growing image segmentation method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN115049685A
CN115049685A CN202210966778.2A CN202210966778A CN115049685A CN 115049685 A CN115049685 A CN 115049685A CN 202210966778 A CN202210966778 A CN 202210966778A CN 115049685 A CN115049685 A CN 115049685A
Authority
CN
China
Prior art keywords
column
line
pixel
merging
structural body
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
CN202210966778.2A
Other languages
Chinese (zh)
Other versions
CN115049685B (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.)
Matrixtime Robotics Shanghai Co ltd
Original Assignee
Jushi Technology Shenzhen Co ltd
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 Jushi Technology Shenzhen Co ltd filed Critical Jushi Technology Shenzhen Co ltd
Priority to CN202210966778.2A priority Critical patent/CN115049685B/en
Publication of CN115049685A publication Critical patent/CN115049685A/en
Application granted granted Critical
Publication of CN115049685B publication Critical patent/CN115049685B/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/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging

Abstract

The invention belongs to the field of image segmentation, and particularly relates to a region growing image segmentation method and device, computer equipment and a storage medium. The region growing image segmentation method comprises the following steps: acquiring pixel information of an image, comparing the pixel information of each row of pixels with a threshold condition, and storing pixel paragraphs meeting the threshold condition to obtain a segmentation area; performing data conversion on the divided areas to obtain structural body data of the divided areas; and merging the divided areas meeting the merging condition in each structural body data to obtain all target areas needing to be divided in the image. According to the method, the target area of each row of pixels in the image data is segmented, the segmented area is defined into the structure data type, the image data processing problem is converted into the data structure processing problem, the calculation is simplified, the memory consumption is reduced, the robustness and the efficiency are higher, and the image segmentation requirement of extracting the target area at a high speed is met.

Description

Region growing image segmentation method and device, computer equipment and storage medium
Technical Field
The application belongs to the field of image segmentation, and particularly relates to a region growing image segmentation method and device, computer equipment and a storage medium.
Background
Region growing refers to the process of developing groups of pixels or regions into larger regions. The region growing is widely applied to the field of image processing at present, and the functions of target positioning and target feature detection are finally realized mainly by positioning and extracting various types of images. At present, the image segmentation efficiency of the region growing image is difficult to improve mainly under the influence of larger and larger image data quantity.
Disclosure of Invention
In view of the above problems, the present application provides a region growing image segmentation method, device, computer device and storage medium, which are used to solve the problem of low efficiency of the region growing image segmentation algorithm.
An embodiment of a first aspect of the present application provides a region growing image segmentation method, including:
acquiring pixel information of an image, comparing the pixel information of each row of pixels with a threshold condition, and storing pixel paragraphs meeting the threshold condition to obtain a segmentation area;
performing data conversion on the divided areas to obtain structural body data of the divided areas;
and merging the divided areas meeting the merging condition in each structural body data to obtain all target areas needing to be divided in the image.
According to the region growing image segmentation method, the target region of each row of pixels in the image data is segmented, the segmented regions are defined into structural body data types, then the structural body data are combined to obtain all target regions to be segmented in the image, the image data processing problem is converted into the data structure processing problem, calculation is simplified, memory consumption is reduced, robustness and efficiency are improved, and the image segmentation requirement of extracting the target regions at a high speed is met.
In one embodiment, the pixel information acquisition of the image comprises: and acquiring an image with segmentation, traversing the image by adopting a plurality of rows of pixels in parallel, and acquiring pixel information of the plurality of rows of pixels.
In an embodiment, the traversing the image in parallel by using multiple rows of pixels, and obtaining the pixel information of the multiple rows of pixels includes: the method comprises the steps of obtaining an initial address pointer of each row of pixels in an image, sending the initial address pointer to a thread, traversing pixel information of the whole row of pixels by the thread, and comparing the pixel information with a threshold condition to obtain a segmentation area meeting the threshold condition.
In an embodiment, the partition areas comprise row partition areas and/or column partition areas, wherein:
a. the line segmentation area is obtained by comparing the pixel information of each line of pixels with a threshold condition and storing pixel paragraphs meeting the threshold condition;
b. the column division area is obtained by comparing pixel information of each column of pixels with a threshold condition and storing pixel paragraphs satisfying the threshold condition.
In one embodiment, the data transformation of the partitioned area includes:
a. when the division area is a line division area, acquiring a pixel line number, a head pixel column position and a tail pixel column position of the line division area, and determining elements of the structural body data according to the pixel line number, the head pixel column position and the tail pixel column position to obtain the structural body data comprising the pixel line number, the head pixel column position, the tail pixel column position and the area number;
b. when the division area is a column division area, acquiring a pixel column number, a head pixel row position and a tail pixel row position of the column division area, and determining elements of the structural body data according to the pixel column number, the head pixel row position and the tail pixel row position to obtain the structural body data comprising the pixel column number, the head pixel row position, the tail pixel row position and the area number.
In one embodiment, the split area combining adopts one of row-by-row combining and column-by-column combining;
the line-by-line merging includes any one of:
a. merging line by line from the first line until the last line is merged;
b. merging from any middle line up and down line by line until merging into the first line and the last line;
the column-by-column consolidation includes any one of:
a. merging from the first column to the last column;
b. merging left and right column by column starting from any middle column until merging to the first column and the last column.
In one embodiment, the merge condition includes an a merge condition or a b merge condition:
a merging condition:
when line-by-line combination is adopted, obtaining structural body data of line division areas in a line to be combined and a current line, and obtaining structural body data of column division areas in the line to be combined and the current line; judging whether a column segmentation area exists and has the same pixel position with a line segmentation area in a current line and a line segmentation area in a line to be merged, and if so, giving the two line segmentation areas the same area number of structural body data;
when column-by-column combination is adopted, obtaining structural body data of column division areas in a column to be combined and a current column, and obtaining structural body data of row division areas in the column to be combined and the current column; judging whether a row segmentation area exists and has the same pixel position as a column segmentation area in the current column and a column segmentation area in a column to be merged, and if so, giving the two column segmentation areas the same area number of structural body data;
b, merging conditions:
when line-by-line combination is adopted, structural body data in a line to be combined and a current line are obtained, whether column position coincidence exists between the structural body data in the line to be combined and the structural body data in the current line is judged, and when the column position coincidence exists, the same area number is given to the two structural body data with the column position coincidence;
when column-by-column combination is adopted, structural body data in a column to be combined and a current column are obtained, whether line position coincidence exists between the structural body data in the column to be combined and the structural body data in the current column is judged, and when the line position coincidence exists, the same area number is given to the two structural body data with the line position coincidence.
In an embodiment, after the merging is completed, all the segmented regions with the same region number are merged to obtain all the target regions to be segmented in the image.
The embodiment of the second aspect of the present application provides a region growing image segmentation apparatus, including:
the data extraction module is used for acquiring pixel information of the image, comparing the pixel information of each row of pixels with a threshold condition, and storing pixel paragraphs meeting the threshold condition to obtain a segmentation area;
the data conversion module is used for carrying out data conversion on the divided areas to obtain structural body data of the divided areas;
and the structural body data processing module is used for merging the segmentation areas meeting the merging condition in each structural body data to obtain all target areas needing to be segmented in the image.
A fourth aspect of the present application provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the steps of the method of any one of the above.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
The drawings in the present application are for illustrative purposes only of the preferred embodiments and for purposes of clarity of understanding the various other advantages and benefits that will become apparent to those skilled in the art, and are not intended to be limiting of the present application. Moreover, like reference numerals are used to refer to like elements throughout.
FIG. 1 is a flowchart of a region growing image segmentation method in an embodiment;
FIG. 2 is a first exemplary diagram of assignment of structure data to row partition areas in one embodiment;
FIG. 3 is a diagram illustrating assignment of structure data to line partition regions in an embodiment;
FIG. 4 is a diagram of an example of assignment of structure data to line partitions in an embodiment;
FIG. 5 is an exemplary diagram of assignment of structure data to row/column partition regions in one embodiment;
FIG. 6 is an illustration of a merging process when progressive merging is used in an embodiment;
FIG. 7 is a block diagram of an exemplary region growing image segmentation apparatus;
FIG. 8 is a block diagram of a data fetch module in accordance with an embodiment;
FIG. 9 is a block diagram of a computer device in an embodiment.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to specific embodiments. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In the description of the embodiments of the present application, the term "and/or" is only one kind of association relationship describing an associated object, and means that three relationships may exist, for example, a and/or B, and may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
Region growing refers to the process of developing groups of pixels or regions into larger regions. The region growing is widely applied to the field of image processing at present, and the functions of target positioning and target feature detection are finally realized by mainly positioning and extracting color images, gray level images, binary images and the like. At present, the image segmentation efficiency of the region growing image is difficult to improve mainly under the influence of larger and larger image data quantity. Through analysis, the inventor of the application finds that: the traditional region growing image segmentation method mainly comprises the steps of taking pixels by pixels as seed points, searching 4 neighborhoods or 8 neighborhoods for expanding the field of the seed points, and expanding expanded points serving as new seed points again until no new expanded points exist, so that the whole image region is traversed. Because region growing is a serial region segmentation method, the calculation can only be completed under a single thread due to the relevance between pixels, and the problem of repeated traversal inevitably exists, the invalid traversal times are too many, and the calculation time is long finally. As the amount of image data increases, the efficiency impact becomes more pronounced.
In an embodiment of the first aspect, referring to fig. 1, there is provided a region growing image segmentation method, including the following steps:
s100, acquiring pixel information of an image, comparing the pixel information of each row of pixels with a threshold condition, and storing pixel paragraphs meeting the threshold condition to obtain a segmentation area;
s200, performing data conversion on the divided areas to obtain structural body data of the divided areas;
and S300, merging the divided areas meeting the merging condition in each structural body data to obtain all target areas needing to be divided in the image.
It can be understood that, in the region-growing image segmentation method in this embodiment, the target region of each row of pixels in the image data is segmented, the circular traversal of the entire image is only performed once, the segmented region is compressed and converted into a structure data type, and the image data processing problem is converted into a data structure processing problem, so that the calculation is simplified.
This embodiment is a specific description of the manner of dividing the area in step S100, where the divided area may be a row divided area and/or a column divided area, and the corresponding manner is: a. the line segmentation area is obtained by comparing the pixel information of each line of pixels with a threshold condition and storing pixel paragraphs meeting the threshold condition; b. the column division area is obtained by comparing pixel information of each column of pixels with a threshold condition and storing pixel segments satisfying the threshold condition. It is understood that each row of pixels may be each row of pixels, or each column of pixels; it is possible to use the pixels in the rows or columns as the dividing units, and the specific rows or columns can be freely selected without limitation.
In this embodiment, a calculation structure for acquiring the image pixel information in step S100 is described, the image pixel information may be acquired by performing parallel traversal using multiple rows of pixels, and simultaneously acquiring pixel information of the multiple rows of pixels, and simultaneously comparing the pixel information with a threshold condition to obtain a partition region satisfying the threshold condition in the multiple rows of pixels.
Specifically, the multi-row pixel-parallel traversal comprises:
a. acquiring a head address pointer of each line of pixels in an image, sending the head address pointer to a thread, traversing pixel information of the whole line of pixels by the thread, and comparing the pixel information with a threshold condition to obtain a line segmentation area meeting the threshold condition;
b. the method comprises the steps of obtaining a first address pointer of each row of pixels in an image, sending the first address pointer to a thread, traversing pixel information of the whole row of pixels by the thread, and comparing the pixel information with a threshold condition to obtain a row segmentation area meeting the threshold condition.
The above-mentioned a and b may be performed separately or simultaneously, but are not limited thereto, and a 16-thread processor will be described as an example.
When the processing is carried out respectively, a first address pointer of each row/column pixel in the image is obtained, the 1 st to 16 th row/column first address pointers are sent to 16 threads respectively, the 16 threads simultaneously calculate and process the 16 row/column pixels, after the 1 st to 16 th row/column pixels are processed, the 17 th to 32 th row/column pixels are processed, and the like until the whole picture is processed.
When the processing is carried out simultaneously, the first address pointer of each row/column pixel in the image is obtained, 16 threads are equally or unequally divided into two groups which are respectively used for processing the row pixels and the column pixels, and the pixels with the corresponding row number and column number are processed according to the mode; the allocation mode of the 16 threads is determined according to the size of the image, and the simultaneous processing of the row pixels and the column pixels is completed as far as possible.
It is understood that the method may be embodied in a computer device, the computer device mainly includes a memory and a processor, the memory stores the computer program and an operating system, and the steps of the method are the steps when the processor executes the computer program. Almost all modern operating systems allow a process to contain multiple threads, i.e., a process with multiple control threads, share operating system resources, and can perform multiple tasks simultaneously. Each thread is a basic unit used by the processor, mainly including a thread ID, a program counter, a register set, and a stack. Therefore, the method can distribute the processing tasks of multiple rows of pixels in the image to different threads according to the number of the threads of the processor and simultaneously divide the threads in parallel by a multithread parallel computing architecture, can utilize the performance of the processor to the maximum extent to quickly extract and divide the image area, and realizes high-speed image processing and computing.
The present embodiment is a specific description of the threshold condition in step S100, where the threshold condition is a threshold range of pixel information in the image data that needs to be divided into target regions, and the threshold range can be determined according to a color in a three-channel color map or a gray scale in a gray scale map. The determination of the color threshold range is explained below using a grayscale map as an example.
Figure 907162DEST_PATH_IMAGE001
Figure 355461DEST_PATH_IMAGE002
The division formula for dividing each row of pixels, which represents the set region division threshold range, is as follows:
Figure 400777DEST_PATH_IMAGE003
in the formula (I), the compound is shown in the specification,
Figure 795986DEST_PATH_IMAGE004
which represents the position of the column of pixels,
Figure 141517DEST_PATH_IMAGE005
which represents the position of the row of pixels,
Figure 229559DEST_PATH_IMAGE006
which represents the gray-scale value of the pixel,
Figure 762171DEST_PATH_IMAGE007
a segmentation result indicating whether the current pixel is within the threshold range.
Figure 226651DEST_PATH_IMAGE008
When the value is 1, the pixel is the required divided pixel, and the pixel position coordinate is
Figure 161109DEST_PATH_IMAGE009
It can be understood that the threshold condition may be determined according to the color in the three-channel color map, the gray scale in the gray scale map, and the like, and then the image in this embodiment may include the three-channel color map, the gray scale map, and the like, where the three-channel color map may also be converted into the gray scale map, and then the threshold range is selected, which indicates that the region growing image segmentation method has high applicability to the input image.
This embodiment is a specific description of the data conversion in step S200, where a structure data type of a division region is configured in advance, a pixel row number, a first pixel column position, and a last pixel column position of the row division region are obtained, and the configuration of the structure data of the row division region according to the pixel row number, the first pixel column position, and the last pixel column position specifically includes: a. when the division area is a line division area, the elements comprise the pixel line number, the head and tail column positions and the area number of the line division area; b. when the divided area is a column divided area, the elements include a pixel column number, a head-tail line position, and an area number of the line divided area. The following description will take the line division area as an example.
Structural data for line division regions arranged in advance
Figure 420052DEST_PATH_IMAGE010
Represents:
Figure 705540DEST_PATH_IMAGE011
wherein
Figure 708131DEST_PATH_IMAGE004
Figure 231516DEST_PATH_IMAGE005
Figure 926939DEST_PATH_IMAGE012
Figure 699723DEST_PATH_IMAGE013
Figure 240426DEST_PATH_IMAGE014
Are all integers, and are not limited to the whole number,
Figure 149476DEST_PATH_IMAGE004
which represents the position of the column of pixels,
Figure 750222DEST_PATH_IMAGE005
which represents the position of the row of pixels,
Figure 744723DEST_PATH_IMAGE012
the first pixel column position representing the row division area,
Figure 89116DEST_PATH_IMAGE013
the tail pixel column position representing the row division area,
Figure 852673DEST_PATH_IMAGE014
indicates the area number to which the divided area belongs, and cols indicates the number of columns in the image.
The initial value of the structure data is
Figure 889899DEST_PATH_IMAGE015
Where-1 is an initial value, which may be a pixel column position
Figure 106117DEST_PATH_IMAGE004
And pixel row position
Figure 254201DEST_PATH_IMAGE005
Other numbers, e.g. -2, -3, -4, etc., cannot occupy any pixel column position
Figure 872265DEST_PATH_IMAGE004
And pixel row position
Figure 80392DEST_PATH_IMAGE005
The value of (b) is not a single operation, and indicates an initial state in which a specific value is not given to the line segment area. In the above formula
Figure 783906DEST_PATH_IMAGE016
To represent
Figure 470102DEST_PATH_IMAGE012
Is an initial value of the time,
Figure 208251DEST_PATH_IMAGE017
to represent
Figure 852859DEST_PATH_IMAGE012
Not the initial value.
According to the pixel row number, the first pixel column position and the tail pixel column position obtained by the traversal calculation of each row of pixels, the pair
Figure 43669DEST_PATH_IMAGE018
Assigning, specifically including the following conditions:
a. as shown in FIG. 2, the pixel of the current calculated position is within the threshold value and within the structural body data
Figure 533556DEST_PATH_IMAGE012
When the initial value is set, the pixel row position is the same as the initial valueLine division area starting position, i.e.
Figure 595053DEST_PATH_IMAGE019
(ii) a Wherein the structural body data
Figure 144983DEST_PATH_IMAGE012
When the value is an initial value, the value indicates that the current value is not found to be available
Figure 88668DEST_PATH_IMAGE012
The location of the assignment; continuously traversing and calculating;
b. as shown in FIG. 3, the pixel at the current calculation position is not within the threshold and is within the structure data
Figure 116667DEST_PATH_IMAGE012
Not at the initial value, i.e.
Figure 563829DEST_PATH_IMAGE020
At this time, it can be determined that the row division area has been searched, and the previous column position of the pixel is the end position of the row division area, i.e. the last position of the row division area
Figure 19081DEST_PATH_IMAGE021
Outputting the structural data of the line division region
Figure 184483DEST_PATH_IMAGE022
(ii) a Continuously traversing and calculating;
it is understood that the line division region located at the head of each line of pixels and the line division region located in the middle of each line of pixels can output the structure data in the above-mentioned a and b manners;
c. as shown in FIG. 4, when the pixel at the current calculation position is within the threshold and the pixel is the last pixel in the row, the pixel column position is marked as
Figure 16173DEST_PATH_IMAGE023
Is that is
Figure 583420DEST_PATH_IMAGE024
Outputting the region structure
Figure 209574DEST_PATH_IMAGE025
Through the above process, the entire row of pixels is traversed, and all the row division areas and the column division areas are assigned with values, for example, in fig. 5, the structural data of the row division area in the nth row of pixels includes: struct (n, 0, 2, -1), Struct (n, 6, 8, -1) and Struct (n, 13, 15, -1); the structural body data of the column division region in the mth column of pixels includes: struct (m, 2, 4, -1), Struct (m, 8, 9, -1) and Struct (m, 12, 13, -1); it can be seen that, in the structure data of the row division areas and the column division areas, the area numbers are both initial values of-1, because no combination is performed at this time, and no assignment is required for the area numbers.
It is understood that the line division area positioned at the rearmost end of each line of pixels may output the structural body data in the manner of a and c.
It is to be understood that the structural body data of the column division areas is the same as the structural body data of the row division areas, and only the rows in the structural body data of the row division areas are replaced with the columns.
By customizing the structure data and compressing and converting the pixel data in the image into the structure data type, the data volume can be reduced, so that the memory consumption is reduced, the calculation process can be simplified, and the calculation efficiency is improved.
This embodiment is a specific description of the foregoing step S300, and includes:
1. and merging the divided areas row by row, assigning area numbers, and merging row by row in a row-by-row merging mode and merging column by column. Wherein:
the line-by-line merging includes the following two ways:
a. merging line by line from the first line until the last line is merged;
b. merging from any middle line up and down line by line until merging to the first line and the last line;
column-by-column merging also includes the following two ways:
a. merging from the first column to the last column;
b. merging left and right column by column starting from any middle column until merging to the first column and the last column.
It should be understood that, in any of the above merging methods, the divided regions in the next row are merged into the current row in sequence, and the merging method is the same, but the starting row is different.
Specifically, the merging method includes:
in an embodiment, when the line-by-line merging adopts line-by-line merging, obtaining structural body data of line partition areas in a line to be merged and a current line, and obtaining structural body data of column partition areas in the line to be merged and the current line; and judging whether the column division areas exist and have the same pixel positions as the row division areas in the current row and the row division areas in the row to be merged, and if so, giving the two row division areas the same area numbers of the structural body data. When the line-by-line merging adopts the line-by-line merging, the same manner as described above is used, and thus, a detailed description thereof will not be given. The process illustrated in fig. 6 is used as an example.
Fig. 6 shows a process of merging the line-by-line, merging the n-1 th line with the n-th line.
(ii) line n-1 has a second structure data Struct (n-1, 5, 6, k + 1) and a third structure data Struct (n-1, 8, 15, k + 2), line n has a second structure data Struct (n, 6, 8, -1);
judging whether the structure data of the column division area has the same pixel position with the structure data Struct (n-1, 5, 6, k + 1) and the structure data Struct (n, 6, 8-1) at the same time; wherein the structure data Struct (6, n-1, n, -1) of the column division area has the same pixel position as both the structure data Struct (n-1, 5, 6, k + 1) and the structure data Struct (n, 6, 8, -1), and the same pixel area is: (j = n-1, i = 6) and (j = n, i = 6);
thirdly, merging the structure data Struct (n, 6, 8, -1) in the nth row with the structure data Struct (n-1, 5, 6, k + 1) in the nth-1 row, and assigning the area number in the structure data Struct (n, 6, 8, -1) to k +1 to obtain the assigned structure data Struct (n, 6, 8, k + 1);
judging whether the structural data of the column division area has the same pixel position with the structural data Struct (n-1, 8, 15, k + 2) and the structural data Struct (n, 6, 8, k + 1) at the same time; wherein the structure data Struct (8, n-1, n, -1) of the column division area has the same pixel position as both the structure data Struct (n-1, 8, 15, k + 2) and the structure data Struct (n, 6, 8, k + 1), and the same pixel area is: (j = n-1, i = 8) and (j = n, i = 8);
and fifthly, merging the structure data Struct (n, 6, 8, k + 1) in the nth row with the structure data Struct (n-1, 8, 15, k + 2) in the nth-1 row, and assigning the area number in the structure data Struct (n-1, 8, 15, k + 2) to k +1 to obtain the assigned structure data Struct (n-1, 8, 15, k + 1).
It is to be understood that the next combined structure data is given the region number value of the previous structure data in the combining order; when there is structural body data that cannot be merged in one row of pixels being merged, a new region number value is assigned to the structural body data in order.
It should be noted that, in row 1, the area numbers of the partition areas are sequentially assigned with 0, 1, 2, 3, 4, and 5 … … in the order of columns, and are merged row by row according to the above method until row n-1, the assignment of the area numbers is already k +2, and k is a positive integer.
In an embodiment, when the line-by-line merging adopts line-by-line merging, structural body data in a line to be merged and a current line are obtained, whether column position coincidence exists between the structural body data in the line to be merged and the structural body data in the current line is judged, and when the column position coincidence exists, an area number which is the same as that of two structural body data with the column position coincidence exists is given. When the line-by-line merging adopts the line-by-line merging, the same manner as described above is used, and thus, a detailed description thereof will not be given. The process illustrated in fig. 6 is also used as an example.
(ii) line n-1 has a second structure data Struct (n-1, 5, 6, k + 1) and a third structure data Struct (n-1, 8, 15, k + 2), line n has a second structure data Struct (n, 6, 8, -1);
taking column pixel sets of structure data Struct (n, 6, 8-1) as [6, 7 and 8], and taking column pixel sets of structure data Struct (n-1, 5, 6, k + 1) and Struct (n-1, 8, 15, k + 2) as [5 and 6] and [8, 9, 10, 11, 12, 13, 14 and 15 ];
thirdly, sequentially taking each column pixel position 6, 7 and 8 in the structure data Struct (n, 6, 8, -1) column pixel set [6, 7 and 8], judging whether the column pixel set also belongs to the structure data Struct (n-1, 5, 6, k + 1) or Struct (n-1, 8, 15, k + 2), and if the column pixel set also belongs to the structure data Struct (n-1, 5, 6, k + 1), Struct (n-1, 8, 15, k + 2) and Struct (n, 6, 8, -1) are endowed with the same area number; it is apparent that the column pixel position 6 belongs to the column pixel set [5, 6] of the structure data Struct (n-1, 5, 6, k + 1), the structure data Struct (n, 6, 8, -1) and Struct (n-1, 5, 6, k + 1) may be given the same region number k +1, i.e., the structure data Struct (n, 6, 8, -1) is merged to become Struct (n, 6, 8, k + 1); continuing with the merge, it is apparent that column pixel position 8 in structure data Struct (n, 6, 8, k + 1) belongs to column pixel set [8, 9, 10, 11, 12, 13, 14, 15] of structure data Struct (n-1, 8, 15, k + 2), and thus structure data Struct (n, 6, 8, k + 1) and Struct (n-1, 8, 15, k + 2) may be assigned the same region number k + 1.
2. After the line-by-line combination is finished, combining the divided areas with the same area number into a whole to obtain all target areas needing to be divided in the image. The number of finally generated area numbers is the number of divided target areas.
The merging calculation is performed based on the structure data type, so that the amount of data required to be calculated is limited, and the occupied memory is small.
In an embodiment, after the foregoing step S300 is completed, the method may further include sorting the region numbers, specifically, assigning a value of the region number to the region number that has jumped during the merging process according to the region where the region number should be located.
It should be noted that, in the foregoing step S300 and after completion, there may be a problem of region number jump; as shown in the following formula, merging into the same region is performed,
Figure 596693DEST_PATH_IMAGE026
area number quilt
Figure 232074DEST_PATH_IMAGE027
Instead, the region number is not assigned from the new value, or the assignment is wrong, and the region number jumps. Therefore, the area numbers need to be sorted, and the jump area numbers are assigned from the new area according to the area where the jump area numbers are located, so that the partitions of all areas of the whole graph are more accurate, and an error correction function is achieved:
Figure 388248DEST_PATH_IMAGE028
wherein the content of the first and second substances,
Figure 450882DEST_PATH_IMAGE029
a list of positions is indicated that is to be displayed,
Figure 325297DEST_PATH_IMAGE030
a position of a certain line is indicated,
Figure 764369DEST_PATH_IMAGE031
indicating the region number.
The specific application scenario of the region growing image segmentation method provided in the present application is described, but the present application is not limited thereto. The method specifically comprises the following steps:
s101, acquiring a gray scale image of an image, and converting the image which is not the gray scale image into the gray scale image; setting a threshold range of gray scale values according to a target region to be divided,
Figure 40630DEST_PATH_IMAGE032
Figure 274165DEST_PATH_IMAGE033
lower and upper limits of the threshold range, respectively; given the gray value segmentation formula, the following:
Figure 635876DEST_PATH_IMAGE034
in the formula (I), the compound is shown in the specification,
Figure 347480DEST_PATH_IMAGE035
which represents the position of the column of pixels,
Figure 743826DEST_PATH_IMAGE036
which represents the position of the row of pixels,
Figure 882684DEST_PATH_IMAGE037
which represents the gray-scale value of the pixel,
Figure 731691DEST_PATH_IMAGE038
a segmentation result indicating whether the current pixel is within the threshold range. Such as when
Figure 246986DEST_PATH_IMAGE038
When the value is 1, the pixel is the required divided pixel, and the pixel position coordinate is
Figure 497839DEST_PATH_IMAGE039
S102, acquiring a first address pointer of each row of pixels in the image, and sending the first address pointers of the pixels in the 1 st row to the 16 th row to 16 threads of the processor, wherein the 16 threads simultaneously traverse the gray value of the pixels in the whole row; repeating the steps until the whole image is traversed;
and S103, substituting the gray value of each pixel into the given gray value segmentation formula for comparison and calculation to obtain row and column segmentation areas meeting the threshold condition.
S201, pre-configuring structural data of row and column division regions for use
Figure 73177DEST_PATH_IMAGE040
Represents:
Figure 409480DEST_PATH_IMAGE041
wherein
Figure 728466DEST_PATH_IMAGE042
Figure 568246DEST_PATH_IMAGE043
Figure 314485DEST_PATH_IMAGE044
Figure 872505DEST_PATH_IMAGE045
Figure 995182DEST_PATH_IMAGE046
Are all integers, and are not limited to the whole number,
Figure 955048DEST_PATH_IMAGE042
which represents the position of the pixel column and,
Figure 872188DEST_PATH_IMAGE043
which represents the position of the row of pixels,
Figure 917505DEST_PATH_IMAGE044
the first pixel column position representing the row division area,
Figure 578293DEST_PATH_IMAGE045
the tail pixel column position representing the row division area,
Figure 392665DEST_PATH_IMAGE046
indicates the area number to which the divided area belongs, cols indicates the number of columns of the image, and the initial value of the structure data is
Figure 746286DEST_PATH_IMAGE047
. The structural body data of the column division area is configured in the same way;
s202, performing data conversion on all the row and column division areas, and setting the initial value of the structure data according to the pixel row (column) number, the first pixel column (row) position and the tail pixel column (row) position in the division areas
Figure 278899DEST_PATH_IMAGE048
And assigning values, wherein the area numbers are assigned with initial values, and the structure data of all the row and column division areas are obtained.
S301, obtaining structural body data of row division areas in the row to be merged and the current row, and obtaining structural body data of column division areas in the row to be merged and the current row; and judging whether the column division areas exist and have the same pixel positions as the row division areas in the current row and the row division areas in the row to be merged, if so, giving the area numbers with the same structural body data to the two row division areas, and if not, merging the next group of row division areas. By parity of reasoning, merging the next row until the merging of the whole picture is completed;
and S302, after the line-by-line combination is finished, combining the divided areas with the same area number into a whole to obtain all target areas needing to be divided in the image.
In an embodiment of the second aspect of the present application, there is provided a region growing image segmentation apparatus, as shown in fig. 7, including:
the data extraction module is used for acquiring pixel information of the image, comparing the pixel information of each row of pixels with a threshold condition, and storing pixel paragraphs meeting the threshold condition to obtain a segmentation area;
the data conversion module is used for carrying out data conversion on the divided areas to obtain structural body data of the divided areas;
and the structural body data processing module is used for merging the divided areas meeting the merging condition in each structural body data to obtain all target areas needing to be divided in the image.
In an embodiment, the data extracting module includes a traversing module and a determining module, as shown in fig. 8, wherein the traversing module is configured to traverse pixel information of each row of pixels in the image data, where the pixel information includes, but is not limited to, colors in a color map, and gray levels in a gray scale map; the judging module is used for comparing the pixel information of each pixel with a threshold condition, and storing pixel paragraphs meeting the threshold condition to obtain a segmentation area.
For specific definition of the region growing image segmentation apparatus, reference may be made to the above definition of a region growing image segmentation method, which is not described herein again. The modules in the above region growing image segmentation device can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In an embodiment of the third aspect, a computer device is provided, and the computer device may be a terminal, and the internal structure diagram of the computer device may be as shown in fig. 9. The computer device comprises a processor, a memory, a communication interface, an output device and an input device which are connected through a system bus, wherein the output device can be a display and the like, and the input device can be a keyboard, a mouse and the like. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for connecting and communicating with an external terminal through a network. The computer program is executed by a processor to implement a region growing image segmentation method.
Those skilled in the art will appreciate that the configuration shown in fig. 9 is a block diagram of only a portion of the configuration associated with the present application and does not constitute a limitation on the computing device to which the present application may be applied, and that a particular computing device may include more or less components than those shown in fig. 9, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory storing a computer program, the processor when executing the computer program comprising the method steps of:
acquiring pixel information of an image, comparing the pixel information of each row of pixels with a threshold condition, and storing pixel paragraphs meeting the threshold condition to obtain a segmentation area;
performing data conversion on the divided areas to obtain structural body data of the divided areas;
and merging the segmentation areas meeting the merging condition in each structural body data to obtain all target areas needing to be segmented in the image.
It should be noted that the method steps when the processor executes the computer program include, but are not limited to, a region growing image segmentation method provided in any of the embodiments of the first aspect.
In an embodiment of a fourth aspect of the present application, there is provided a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of a region growing image segmentation method provided in any of the embodiments of the first aspect.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory, among others. Volatile memory can include Random Access Memory (RAM), or external cache memory, or the like. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), Direct Rambus Dynamic RAM (DRDRAM), and Rambus Dynamic RAM (RDRAM).
In conclusion, the image compression method is innovatively applied to image segmentation, the image data processing problem is converted into the data structure processing problem, and compared with the traditional image segmentation method, the image compression method not only greatly compresses the data calculation amount, but also reduces the consumption of the memory space. Meanwhile, in an embodiment of the application, a multithreading parallel computing method is introduced, so that independent computation of each row and each column of image data is realized, the performance of a processor is greatly utilized, and the computation efficiency is improved.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same. Although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the present disclosure, and the present disclosure should be construed as being covered by the claims and the specification. In particular, the features mentioned in the embodiments can be combined in any way, as long as there are no contradiction conflicts. The present application is not intended to be limited to the particular embodiments disclosed herein but is to cover all embodiments that may fall within the scope of the appended claims.

Claims (10)

1. A region growing image segmentation method is characterized by comprising the following steps:
acquiring pixel information of an image, comparing the pixel information of each row of pixels with a threshold condition, and storing pixel paragraphs meeting the threshold condition to obtain a segmentation area;
performing data conversion on the divided areas to obtain structural body data of the divided areas;
and merging the divided areas meeting the merging condition in each structural body data to obtain all target areas needing to be divided in the image.
2. The region growing image segmentation method according to claim 1, wherein the obtaining of the pixel information of the image includes: and acquiring an image with segmentation, traversing the image by adopting a plurality of rows of pixels in parallel, and acquiring pixel information of the plurality of rows of pixels.
3. The region growing image segmentation method of claim 2, wherein traversing the image in parallel using a plurality of rows of pixels while obtaining pixel information for the plurality of rows of pixels comprises: the method comprises the steps of obtaining an initial address pointer of each row of pixels in an image, sending the initial address pointer to a thread, traversing pixel information of the whole row of pixels by the thread, and comparing the pixel information with a threshold condition to obtain a segmentation area meeting the threshold condition.
4. The region growing image segmentation method of claim 1, wherein the segmentation regions comprise row segmentation regions and/or column segmentation regions, wherein:
a. the line segmentation area is obtained by comparing the pixel information of each line of pixels with a threshold condition and storing pixel paragraphs meeting the threshold condition;
b. the column division area is obtained by comparing pixel information of each column of pixels with a threshold condition and storing pixel paragraphs satisfying the threshold condition.
5. The region growing image segmentation method of claim 4, wherein the data transformation of the segmented regions comprises:
a. when the division area is a line division area, acquiring a pixel line number, a head pixel column position and a tail pixel column position of the line division area, and determining elements of the structural body data according to the pixel line number, the head pixel column position and the tail pixel column position to obtain the structural body data comprising the pixel line number, the head pixel column position, the tail pixel column position and the area number;
b. when the division area is a column division area, acquiring a pixel column number, a head pixel row position and a tail pixel row position of the column division area, and determining elements of the structural body data according to the pixel column number, the head pixel row position and the tail pixel row position to obtain the structural body data comprising the pixel column number, the head pixel row position, the tail pixel row position and the area number.
6. The region growing image segmentation method of claim 5, wherein the segmentation region merging adopts one of row-by-row merging and column-by-column merging;
the line-by-line merging includes any one of:
a. merging line by line from the first line until the last line is merged;
b. merging from any middle line up and down line by line until merging into the first line and the last line;
the column-by-column merging includes any one of:
a. merging from the first column to the last column;
b. merging left and right column by column starting from any middle column until merging to the first column and the last column.
7. The region growing image segmentation method according to claim 6, wherein the merging condition includes an a-merging condition or a b-merging condition:
a merging condition:
when line-by-line combination is adopted, obtaining structural body data of line division areas in a line to be combined and a current line, and obtaining structural body data of column division areas in the line to be combined and the current line; judging whether a column segmentation area exists and has the same pixel position with a line segmentation area in a current line and a line segmentation area in a line to be merged, and if so, giving the two line segmentation areas the same area number of structural body data;
when column-by-column combination is adopted, obtaining structural body data of column division areas in a column to be combined and a current column, and obtaining structural body data of row division areas in the column to be combined and the current column; judging whether a row segmentation area exists and has the same pixel position as a column segmentation area in the current column and a column segmentation area in a column to be merged, and if so, giving the two column segmentation areas the same area number of structural body data;
b, merging conditions:
when line-by-line combination is adopted, structural body data in a line to be combined and a current line are obtained, whether column position coincidence exists between the structural body data in the line to be combined and the structural body data in the current line is judged, and when the column position coincidence exists, the same area number is given to the two structural body data with the column position coincidence;
when the column-by-column combination is adopted, the structural body data in the column to be combined and the current column are obtained, whether the line position coincidence exists between the structural body data in the column to be combined and the structural body data in the current column is judged, and when the line position coincidence exists, the same area number is given to the two structural body data with the line position coincidence.
8. The region growing image segmentation method of claim 7, wherein after the merging, all the segmented regions with the same region number are merged to obtain all the target regions to be segmented in the image.
9. A region growing image segmentation apparatus comprising:
the data extraction module is used for acquiring pixel information of the image, comparing the pixel information of each row of pixels with a threshold condition, and storing pixel paragraphs meeting the threshold condition to obtain a segmentation area;
the data conversion module is used for carrying out data conversion on the divided areas to obtain structural body data of the divided areas;
and the structural body data processing module is used for merging the divided areas meeting the merging condition in each structural body data to obtain all target areas needing to be divided in the image.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of any one of the preceding claims 1 to 8.
CN202210966778.2A 2022-08-12 2022-08-12 Region growing image segmentation method and device, computer equipment and storage medium Active CN115049685B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210966778.2A CN115049685B (en) 2022-08-12 2022-08-12 Region growing image segmentation method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210966778.2A CN115049685B (en) 2022-08-12 2022-08-12 Region growing image segmentation method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115049685A true CN115049685A (en) 2022-09-13
CN115049685B CN115049685B (en) 2023-02-03

Family

ID=83167905

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210966778.2A Active CN115049685B (en) 2022-08-12 2022-08-12 Region growing image segmentation method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115049685B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070127802A1 (en) * 2005-12-05 2007-06-07 Siemens Corporate Research, Inc. Method and System for Automatic Lung Segmentation
CN101499169A (en) * 2009-02-13 2009-08-05 北京中星微电子有限公司 Method and apparatus for scanning connected region in combined image
US20090322748A1 (en) * 2008-06-09 2009-12-31 Uti Limited Partnership Methods,systems, and computer program products for GPU-based point radiation for interactive volume sculpting and segmentation
CN103400368A (en) * 2013-06-25 2013-11-20 西安电子科技大学 Parallel rapid SAR image segmentation method based on graph theory and superpixel
JP2015095115A (en) * 2013-11-12 2015-05-18 国立大学法人富山大学 Area division method, area division program and image processing system
US20160189373A1 (en) * 2013-08-01 2016-06-30 Seoul National University R&Db Foundation Method for Extracting Airways and Pulmonary Lobes and Apparatus Therefor
CN110599505A (en) * 2019-09-17 2019-12-20 上海微创医疗器械(集团)有限公司 Organ image segmentation method and device, electronic equipment and storage medium
CN111260596A (en) * 2020-01-09 2020-06-09 山东财经大学 Anti-noise rapid image super-pixel automatic generation method, device and readable storage medium
CN111833362A (en) * 2020-06-17 2020-10-27 北京科技大学 Unstructured road segmentation method and system based on superpixel and region growing
CN114170247A (en) * 2021-12-13 2022-03-11 上海景吾智能科技有限公司 Depth image segmentation method and system

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070127802A1 (en) * 2005-12-05 2007-06-07 Siemens Corporate Research, Inc. Method and System for Automatic Lung Segmentation
US20090322748A1 (en) * 2008-06-09 2009-12-31 Uti Limited Partnership Methods,systems, and computer program products for GPU-based point radiation for interactive volume sculpting and segmentation
CN101499169A (en) * 2009-02-13 2009-08-05 北京中星微电子有限公司 Method and apparatus for scanning connected region in combined image
CN103400368A (en) * 2013-06-25 2013-11-20 西安电子科技大学 Parallel rapid SAR image segmentation method based on graph theory and superpixel
US20160189373A1 (en) * 2013-08-01 2016-06-30 Seoul National University R&Db Foundation Method for Extracting Airways and Pulmonary Lobes and Apparatus Therefor
JP2015095115A (en) * 2013-11-12 2015-05-18 国立大学法人富山大学 Area division method, area division program and image processing system
CN110599505A (en) * 2019-09-17 2019-12-20 上海微创医疗器械(集团)有限公司 Organ image segmentation method and device, electronic equipment and storage medium
CN111260596A (en) * 2020-01-09 2020-06-09 山东财经大学 Anti-noise rapid image super-pixel automatic generation method, device and readable storage medium
CN111833362A (en) * 2020-06-17 2020-10-27 北京科技大学 Unstructured road segmentation method and system based on superpixel and region growing
CN114170247A (en) * 2021-12-13 2022-03-11 上海景吾智能科技有限公司 Depth image segmentation method and system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
姜伟等: "结合区域生长与图割算法的冠状动脉CT血管造影图像三维分割", 《计算机应用》 *
黄谊等: "基于阈值法和区域生长法的图像分割算法研究", 《电子测试》 *

Also Published As

Publication number Publication date
CN115049685B (en) 2023-02-03

Similar Documents

Publication Publication Date Title
EP4227886A1 (en) Matrix operation method and apparatus for image data, device, and storage medium
WO2014184202A1 (en) Method and device for processing input image data
US7728840B2 (en) Sliding data buffering for image processing
CN115049685B (en) Region growing image segmentation method and device, computer equipment and storage medium
CN113283575A (en) Processor for reconstructing artificial neural network, operation method thereof and electrical equipment
CN110825693A (en) Medical data storage method, device and readable storage medium
CN110322388B (en) Pooling method and apparatus, pooling system, and computer-readable storage medium
CN112165486B (en) Network address set splitting method and device
CN113963241B (en) FPGA hardware architecture, data processing method thereof and storage medium
CN110866127A (en) Method for establishing index and related device
US20170277974A1 (en) Apparatus and Method for Detecting a Feature in an Image
EP3859611A1 (en) Method, apparatus and device for updating convolutional neural network using gpu cluster
CN109284260B (en) Big data file reading method and device, computer equipment and storage medium
CN113778518A (en) Data processing method, data processing device, computer equipment and storage medium
EP2657887A1 (en) Improvements in and relating to data comparison
CN115049529A (en) Image gradient determination method, device, equipment and storage medium
CN111323775A (en) Image processing method, image processing device, computer equipment and storage medium
CN116993798B (en) Image processing method and electronic equipment
CN117710235B (en) Image target enhancement method, device, computer equipment and storage medium
US20220269752A1 (en) Execution method for convolution computation
US9659140B2 (en) Critical region identification
CN111931123B (en) Boundary convolution calculation method and device, hardware accelerator and computer equipment
CN113554095B (en) Feature map processing method and device and computer equipment
CN117710235A (en) Image target enhancement method, device, computer equipment and storage medium
CN114282660A (en) Method for managing convolution calculations and corresponding device

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
TR01 Transfer of patent right

Effective date of registration: 20231120

Address after: Room 801, No. 1126 Shenbin South Road, Minhang District, Shanghai, 201107

Patentee after: MATRIXTIME ROBOTICS (SHANGHAI) Co.,Ltd.

Address before: No. 4, 4th Floor, Huashen Building, No. 1038 Aiguo Road, Xinyi Community, Huangbei Street, Luohu District, Shenzhen, Guangdong 518001

Patentee before: Jushi Technology (Shenzhen) Co.,Ltd.

TR01 Transfer of patent right