An image segmentation method, device, and computer-readable storage medium
Through the SLIC superpixel segmentation algorithm, region growth algorithm, color similarity merging algorithm and adaptive center selection method, the segmentation error problem caused by uneven lighting and noise in image segmentation is solved, and the edge fit and internal connectivity of the image segmentation results are achieved.
Patent Information
- Application Number
- CN201910854988.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-10
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2039-09-10
AI Technical Summary
The prior art is prone to problems such as uneven light, noise influence, unclear image and shadow during the image segmentation process, resulting in segmentation errors, non-closed edges, non-connected internal connections, and problems of over-segment or under-segment are prone to occur.
The SLIC superpixel segmentation algorithm is used for preliminary segmentation, and then the seed points are selected in each superpixel, the second generation superpixel is divided by the region growth algorithm, and the region propagation merging algorithm is combined based on color similarity, and the segmentation results are finally optimized through the adaptive center selection method.
It effectively solves the edge fitting problem in image segmentation, ensuring that the edges of the segmentation result are independent of the edges of the image object or the color dividing line, and are connected internally, in line with the visual habits of the human eye, and avoiding over-segment and under-segment.
Smart Images

Figure CN112561919B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure generally relate to the fields of computer vision and image processing, and more particularly, to an image segmentation method, apparatus, and computer-readable storage medium. Background Art
[0002] Image segmentation is a crucial preprocessing step for image recognition and computer vision. Without correct segmentation, correct recognition is impossible. However, the only basis for segmentation is the brightness and color of pixels in the image, and various difficulties will be encountered when the computer automatically processes the segmentation. For example, uneven illumination, the influence of noise, unclear parts in the image, and shadows often result in segmentation errors.
[0003] Because the image texture is complex, the target is often divided into too many regions, resulting in too small segmentation regions. Moreover, if the image noise is large, the edges of the segmented image are often not closed and not connected internally, and cannot form independent target regions. Summary of the Invention
[0004] According to an embodiment of the present disclosure, an image segmentation solution is provided.
[0005] In a first aspect of the present disclosure, an image segmentation method is provided. The method includes:
[0006] Performing segmentation processing on a target segmentation image through a SLIC superpixel segmentation algorithm to obtain an initial superpixel segmentation result, where the initial superpixel segmentation result includes a plurality of initial superpixels;
[0007] Selecting one or more seed points within the initial superpixel, and using a region growing algorithm to divide the initial superpixel into one or more secondary superpixels according to the number of seed points within the initial superpixel;
[0008] Centering on the segmentation center of the initial superpixel, merging the divided secondary superpixels through a region propagation merging algorithm based on color similarity to obtain an optimized initial superpixel;
[0009] Selecting a region propagation center according to an adaptive center selection method, and merging the optimized initial superpixels to obtain an image segmentation result.
[0010] Further, before performing segmentation processing on the target segmentation image through the SLIC superpixel segmentation algorithm, performing sharpening processing on the target segmentation image through a Wallis operator to obtain a sharpened image as the target segmentation image to be segmented.
[0011] Further, the region propagation merging algorithm based on color similarity is:
[0012] The pixel value of the seed point pixel of each sub-generation superpixel represents the color average value of the entire sub-generation superpixel. The similarity between adjacent sub-generation superpixels is calculated through the Euclidean formula. Each time, only one independent region with the highest similarity among adjacent ones is merged for each center. This process is iterated until there are no independent regions, and the optimized initial superpixels are obtained.
[0013] Further, the adaptive center selection method includes:
[0014] Calculate the average value of each color channel of all pixels in the region formed by the independent optimized initial superpixels and the optimized initial superpixels adjacent to them, and select the optimized initial superpixel closest to this average value as the region propagation center.
[0015] Further, the calculation of the average value of each color channel of all pixels in the region formed by the independent optimized initial superpixels and the optimized initial superpixels adjacent to them includes:
[0016]
[0017]
[0018]
[0019] Where K is the region formed by the independent optimized initial superpixels and the optimized initial superpixels adjacent to them; (R i , G i , B i ) is the color mean value of the independent optimized initial superpixel; n is the number of optimized superpixels in K; (m R , m G , m B ) is the average value of K.
[0020] Further, the merging of the optimized initial superpixels includes:
[0021] Calculate the similarity between the optimized initial superpixel as the region propagation center and the optimized initial superpixels adjacent to it, compare the obtained similarity result with the threshold, and merge the two superpixels with similarity less than the threshold;
[0022] Traverse each independent optimized initial superpixel until there are no independent optimized initial superpixels, and the image segmentation result is obtained.
[0023] Further, the calculation of the similarity between the optimized initial superpixel as the region propagation center and the optimized initial superpixels adjacent to it includes:
[0024]
[0025] Among them, D c,j is the Euclidean distance between superpixels c and j, used to represent similarity; (R c , G c , B c ) and (R j , G j , B j ) are the color means of adjacent optimized initial superpixels respectively.
[0026] Furthermore, the threshold is:
[0027]
[0028] Among them, T is the threshold; std(RGB pixels ) is the standard deviation value of all pixels in the image in the RGB color domain.
[0029] In a second aspect of the present disclosure, an electronic device is provided. The electronic device includes: a memory and a processor, a computer program is stored on the memory, and when the processor executes the program, the image segmentation method as described above is implemented.
[0030] In a third aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the image segmentation method according to the first aspect and / or the second aspect of the present disclosure is implemented.
[0031] It should be understood that the content described in the Summary of the Invention section is not intended to limit the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In combination with the drawings and with reference to the following detailed description, the above and other features, advantages and aspects of the embodiments of the present disclosure will become more obvious. In the drawings, the same or similar reference numerals represent the same or similar elements, where:
[0033] Figure 1 shows a flowchart of an image segmentation method according to an embodiment of the present disclosure;
[0034] Figure 2 shows a block diagram of an exemplary electronic device capable of implementing the embodiments of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0035] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Apparently, the described embodiments are some, but not all, of the embodiments of the present disclosure. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present disclosure without creative efforts shall fall within the scope of protection of the present disclosure.
[0036] In the present disclosure, an image segmentation method is disclosed, which relates to the fields of computer vision and image processing and is mainly used for the preprocessing process of image semantic recognition and image search. This method is divided into three steps. First is image preprocessing, that is, using the Wallis operator to sharpen the image. Second is the improved SLIC superpixel segmentation, that is, using the SLIC superpixel algorithm to perform preliminary processing on the image, randomly selecting several seed points within each generated superpixel, simply using the region growing algorithm to divide the original superpixel into one or more new superpixels while retaining the segmentation center of the original superpixel. With the segmentation center of the original superpixel as the center, through the region propagation merging algorithm based on color similarity, each center only merges the nearest independent region each time, and the iteration is completed until there are no independent regions. Finally, an adaptive center selection method is used to select the merged central superpixel and adaptively determine the merging threshold. With the selected central superpixel as the center, according to the threshold, the superpixels in its neighborhood recorded by the system are merged, and the iteration continues until there are no independent superpixels. In this way, the edges of the image segmentation can fit the edges of the objects in the image or the color boundaries, be independent of each other, internally connected, conform to human vision and human segmentation habits, have basically regular shapes, and a limited number, avoiding over-segmentation and under-segmentation.
[0037] Figure 1 The flowchart of the image segmentation method according to the embodiment of the present disclosure is shown.
[0038] The present disclosure provides an image segmentation method, including:
[0039] S101. Performing segmentation processing on the target segmentation image through the SLIC superpixel segmentation algorithm to obtain an initial superpixel segmentation result, where the initial superpixel segmentation result includes a plurality of initial superpixels;
[0040] Through the traditional SLIC superpixel segmentation algorithm, the segmentation processing of the image can be realized, and superpixels of a conventional size can be generated. Although the boundaries of most of the generated superpixels can well fit the image boundary. However, there are still some superpixels that may contain the image edges of the original image.
[0041] The initial superpixel segmentation result is the result obtained by performing segmentation processing on the target segmentation image through the SLIC superpixel segmentation algorithm, which includes a plurality of initial superpixels.
[0042] S102. Select one or more seed points within the initial superpixel, and adopt a region growing algorithm to divide the initial superpixel into one or more sub-generation superpixels according to the number of seed points within the initial superpixel.
[0043] First, select seed points within the obtained initial superpixel. The selection of seed points is random, and the number can be one or more. Based on the connectivity constraint in the color domain, adopt a region growing algorithm to divide the initial superpixel into new independent regions with the same number as the number of seed points, that is, sub-generation superpixels. Thus, separate the small region blocks included in the initial superpixel due to unconnected regions or the non-conformance of the superpixel boundary to the color edge, so that they can be divided into the superpixels where they should be during subsequent merging, and obtain an initial superpixel with internal connectivity and conforming to the color edge.
[0044] S103. Taking the segmentation center of the initial superpixel as the center, merge the divided sub-generation superpixels through a region propagation merging algorithm based on color similarity to obtain an optimized initial superpixel.
[0045] Retain the segmentation center of the initial superpixel, and taking the segmentation center of the initial superpixel as the center, through a region propagation merging algorithm based on color similarity: use the pixel value of the seed point pixel of each sub-generation superpixel to represent the color average value of the entire sub-generation superpixel, calculate the similarity between sub-generation superpixels through the Euclidean formula, and each center only merges one adjacent independent region with the highest similarity each time. Iteration is completed until there are no independent regions, improving the final segmentation result. The edge of the segmentation result conforms to the edge of the object in the image or the color demarcation line, is mutually independent, and conforms to human vision and human segmentation habits.
[0046] S104. Select a region propagation center according to the adaptive center selection method, and merge the optimized initial superpixels to obtain an image segmentation result.
[0047] In each iteration, for each independent optimized initial superpixel, the system records the optimized initial superpixels directly adjacent to it, calculates the average value of each optimized initial superpixel directly adjacent to it, selects the best superpixel closest to the average value as the region propagation center, and uses the Euclidean distance in the RGB domain to measure the similarity between the best superpixel and its adjacent optimized initial superpixels. Merge the optimized initial superpixels adjacent to it recorded by the system according to the threshold, and iterate until there are no independent optimized initial superpixels. The threshold is determined through an adaptive process. The threshold is automatically adjusted for images with different complexities.
[0048] Based on color similarity, assuming that similar colors connected together belong to the same object, the same object or the local parts of the same color of the object can be segmented. The design of the adaptive threshold enables the algorithm to have good segmentation effects on any image. The threshold is automatically adjusted without the need for manual experiments and settings for different picture scenarios.
[0049] Further, before segmenting the target segmentation image through the SLIC superpixel segmentation algorithm, the target segmentation image is sharpened through the Wallis operator to obtain a sharpened image as the target segmentation image to be segmented.
[0050] The human eye visual characteristics are mainly considered, and the sharpening result conforms to the human eye characteristics, which can make the edge information clearer.
[0051] Different from other algorithms that directly perform image segmentation, due to the good image segmentation effect, which depends on the image having a clear and definite edge information. Due to the quality differences of cameras, the edges of images are often blurred and the edges cannot reach the pixel level, so the image needs to be sharpened. And in this disclosure, the target segmentation image is sharpened through the Wallis operator, mainly considering the human eye visual characteristics, and the sharpening result conforms to the human eye characteristics, which can make the edge information clearer.
[0052] Further, the region propagation and merging algorithm based on color similarity is as follows:
[0053] Taking the pixel value of the seed point pixel of each sub-generation superpixel as the color average value of the whole sub-generation superpixel, the similarity between adjacent sub-generation superpixels is calculated through the Euclidean formula. Each time, each center only merges the adjacent independent region with the highest similarity. Iterate this process until there is no independent region, and the optimized initial superpixels are obtained.
[0054] In each iteration, for each independent optimized initial superpixel, the system records the optimized initial superpixels directly adjacent to it, selects the best superpixel as the region propagation center, and uses the Euclidean distance in the RGB domain to measure the similarity between the best superpixel and its adjacent optimized initial superpixels. According to the adaptive threshold, the adjacent optimized initial superpixels recorded by the system are merged, and the iteration continues until there are no independent optimized initial superpixels.
[0055] Further, the adaptive center selection method includes:
[0056] Calculate the average value of an independent optimized initial superpixel and the region formed by its adjacent optimized initial superpixels, and select the optimized initial superpixel closest to this average value as the region propagation center. Perform region merging based on the similarity between this optimized initial superpixel and its adjacent optimized initial superpixels;
[0057] Iterate the above process, traverse each independent optimized initial superpixel until there are no independent optimized initial superpixels.
[0058] The advantage of the adaptive center selection method is that it can exclude the superpixels with the largest color differences at the beginning, improving accuracy.
[0059] For each independent optimized initial superpixel, the optimized initial superpixels directly adjacent to it recorded by the system together form region K, which includes the independent optimized initial superpixel and its directly adjacent optimized initial superpixels. Calculate the average value of region K, that is:
[0060]
[0061]
[0062]
[0063] where K is the region formed by the independent optimized initial superpixel and its adjacent optimized initial superpixels; (R i , G i , B i ) is the color mean value of the independent optimized initial superpixel; n is the number of optimized superpixels in K; (m R , m G , m B ) is the average value of K.
[0064] Select the optimized initial superpixel closest to this average value as the region propagation center, and calculate the similarity between the optimized initial superpixel and its adjacent optimized initial superpixels with its center as the center, that is:
[0065]
[0066] where D c, is the Euclidean distance between superpixels c and j, used to represent similarity; (R c , G c , B c ) and (R j , G j , B j ) are the color mean values of the adjacent optimized initial superpixels respectively.
[0067] Further, performing region merging according to the similarity between the optimized initial superpixels and their adjacent optimized initial superpixels includes:
[0068] Calculating the similarity between the optimized initial superpixel as the region propagation center and its adjacent optimized initial superpixels, comparing the obtained similarity result with a threshold, and merging two superpixels with a similarity less than the threshold. If the similarity result is greater than the threshold after comparison with the threshold, the two superpixels are not merged.
[0069] Based on the assumption that connected similar colors belong to the same object, through region merging, splicing a large number of optimized initial superpixels, and merging adjacent superpixels with the same or similar colors, the same object or the local parts of the same color of the object can be segmented.
[0070] Traverse each independent optimized initial superpixel, iterate the above process, merge regions with a similarity less than the threshold until there are no independent optimized initial superpixels.
[0071] Further, the threshold is:
[0072]
[0073] where T is the threshold; std(RGB pixels ) is the standard deviation value of all pixels in the image in the RGB color domain.
[0074] In the following embodiments, an image segmentation method is provided, including:
[0075] Before performing segmentation processing on the target segmentation image by the SLIC superpixel segmentation algorithm, performing sharpening processing on the target segmentation image through a Wallis operator to obtain a sharpened image as the target segmentation image to be segmented.
[0076] The Wallis operator is an adaptive operator that combines the Laplacian operator and the logarithmic operator, that is:
[0077]
[0078] This embodiment does not limit the method of sharpening processing. Other methods of sharpening processing that can solve the above technical problems can also be used as the sharpening processing method of the present disclosure. For example: sobel operator sharpening, laplcian operator sharpening, canny operator sharpening, log operator sharpening, etc.
[0079] The target segmentation image is segmented by the SLIC superpixel segmentation algorithm to obtain an initial superpixel segmentation result, and the initial superpixel segmentation result includes a number of initial superpixels.
[0080] The initial superpixel segmentation result is the result obtained by segmenting the target segmentation image by the SLIC superpixel segmentation algorithm, which includes a number of initial superpixels.
[0081] Select one or more seed points within the initial superpixel, and use the region growing algorithm. According to the number of seed points within the initial superpixel, the initial superpixel is divided into one or more sub-generation superpixels.
[0082] Seed points are selected randomly within the obtained initial superpixel, and the number of seed points can be one or more. Based on the connectivity constraint in the color domain, the region growing algorithm is used to divide the initial superpixel into new independent regions with the same number as the number of seed points, that is, sub-generation superpixels.
[0083] Use the pixel value of the seed point pixel of each sub-generation superpixel to represent the color average value of the entire sub-generation superpixel, calculate the similarity between adjacent sub-generation superpixels through the Euclidean formula, and each time only merge one adjacent independent region with the highest similarity at each center. Iterate this process until there are no independent regions, and the optimized initial superpixel is obtained.
[0084] In each iteration, for each independent optimized initial superpixel, the system records the optimized initial superpixels directly adjacent to it, selects the best superpixel as the region propagation center, and uses the Euclidean distance in the RGB domain to measure the similarity between the best superpixel and its adjacent optimized initial superpixels, that is:
[0085]
[0086] where R c,j is the Euclidean distance between superpixels c and j, which is used to represent similarity; (R c , G c , B c ) and (R j , G j , B j ) are the color means of adjacent optimized initial superpixels respectively.
[0087] Merge the optimized initial superpixels adjacent to the system recorded according to the adaptive threshold, and iterate until there are no independent optimized initial superpixels. That is, compare the obtained similarity result with the threshold, and merge the two superpixels with similarity less than the threshold. If the similarity result is greater than the threshold after comparison with the threshold, the two superpixels are not merged.
[0088] The threshold is:
[0089]
[0090] where T is the threshold; std(RGB pixels ) is the standard deviation value of all pixels in the image in the RGB color domain.
[0091] Centered on the segmentation center of the initial superpixels, the secondary superpixels are merged through a region propagation and merging algorithm based on color similarity to obtain the optimized initial superpixels;
[0092] Retain the segmentation center of the initial superpixels, and centered on the segmentation center of the initial superpixels, through a region propagation and merging algorithm based on color similarity: use the pixel value of the seed point pixel of each secondary superpixel to represent the color average value of the entire secondary superpixel, calculate the similarity between secondary superpixels through the Euclidean formula, and each center only merges the adjacent independent region with the highest similarity each time. Iteration is completed until there are no independent regions to improve the final segmentation result.
[0093] For each independent optimized initial superpixel, the optimized initial superpixels directly adjacent to it recorded by the system jointly form region K. Region K includes the independent optimized initial superpixels and the optimized initial superpixels directly adjacent to it. Calculate the average value of region K, that is:
[0094]
[0095]
[0096]
[0097] where K is the region formed by the independent optimized initial superpixels and the optimized initial superpixels adjacent to them; (R i , G i , B i ) is the color mean value of the independent optimized initial superpixels; n is the number of optimized superpixels in K; (m R , m G , m B ) is the average value of K.
[0098] Select the region propagation center according to the adaptive center selection method, and merge the optimized initial superpixels to obtain the image segmentation result.
[0099] Calculate the average value of an independent optimized initial superpixel and the region formed by its adjacent optimized initial superpixels, and select the optimized initial superpixel closest to this average value as the region propagation center. Perform region merging based on the similarity between this optimized initial superpixel and its adjacent optimized initial superpixels; compare the obtained similarity result with a threshold, and merge two superpixels with a similarity less than the threshold. If the similarity result is greater than the threshold after comparison with the threshold, do not merge these two superpixels.
[0100] Iterate the above process, traverse each independent optimized initial superpixel until there are no independent optimized initial superpixels.
[0101] In each iteration, for each independent optimized initial superpixel, the system records the optimized initial superpixels directly adjacent to it, calculates the average value of each directly adjacent optimized initial superpixel, selects the best superpixel closest to the average value as the region propagation center, and uses the Euclidean distance in the RGB domain to measure the similarity between the best superpixel and its adjacent optimized initial superpixels, that is:
[0102]
[0103] where D c,j is the Euclidean distance between superpixels c and j, used to represent similarity; (R c , G c , B c ) and (R j , G j , B j ) are the color means of adjacent optimized initial superpixels respectively.
[0104] Merge the optimized initial superpixels adjacent to those recorded by the system according to the threshold, and iterate until there are no independent optimized initial superpixels. The threshold is determined through an adaptive process. The threshold is automatically adjusted for images with different complexities.
[0105] The threshold is:
[0106]
[0107] where T is the threshold; std(RGB pixels ) is the standard deviation value of all pixels in the image in the RGB color domain.
[0108] It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present disclosure is not limited by the described action sequence, because according to the present disclosure, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to the present disclosure.
[0109] Figure 2 FIG. shows a schematic block diagram of an electronic device 700 that can be used to implement embodiments of the present disclosure.
[0110] The device 700 includes a central processing unit (CPU) 701, which can execute various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 702 or computer program instructions loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The CPU 701, ROM 702, and RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0111] A plurality of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a magnetic disk, an optical disc, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0112] The processing unit 701 executes the various methods and processes described above, such as methods S101 - S104. For example, in some embodiments, methods S101 - S104 can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the CPU 701, one or more steps of the methods S101 - S104 described above can be executed. Alternatively, in other embodiments, the CPU 701 can be configured to execute methods S101 - S104 in any other appropriate manner (for example, by means of firmware).
[0113] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that can be used include: Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), Systems on Chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
[0114] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program code is executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code can be executed entirely on the machine, partially on the machine, executed partially on the machine and partially on a remote machine as an independent software package, or executed entirely on a remote machine or server.
[0115] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include electrical connections based on one or more wires, portable computer disks, hard disks, Random Access Memory (RAM), Read Only Memory (ROM), Erasable Programmable Read Only Memory (EPROM or Flash Memory), optical fibers, portable Compact Disc Read Only Memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0116] In addition, although the operations are depicted in a particular order, this should be understood as requiring that such operations be performed in the particular order shown or in sequential order, or that all illustrated operations be performed to achieve the desired result. In certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features described in the context of separate embodiments can also be implemented in combination in a single implementation. Conversely, the various features described in the context of a single implementation can also be implemented separately or in any suitable sub-combination in multiple implementations.
[0117] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. On the contrary, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. An image segmentation method, characterized in that, it includes: Performing segmentation processing on the target segmentation image through the SLIC superpixel segmentation algorithm to obtain an initial superpixel segmentation result, where the initial superpixel segmentation result includes a number of initial superpixels; Selecting one or more seed points within the initial superpixels, and using the region growing algorithm to divide the initial superpixels into sub-generation superpixels with the same number as the number of seed points; Centered on the segmentation center of the initial superpixels, merging the divided sub-generation superpixels through a region propagation merging algorithm based on color similarity to obtain optimized initial superpixels; wherein, the region propagation merging algorithm based on color similarity is: Using the pixel value of the seed point pixel of each sub-generation superpixel to represent the color average value of the entire sub-generation superpixel, calculating the similarity between adjacent sub-generation superpixels through the Euclidean formula, and each time each center only merges the adjacent independent region with the highest similarity, iterating this process until there are no independent regions to obtain optimized initial superpixels; Selecting a region propagation center according to the adaptive center selection method, and merging the optimized initial superpixels to obtain an image segmentation result, where, The adaptive center selection method includes: calculating the average value of each color channel of all pixels within the region formed by the independent optimized initial superpixels and the optimized initial superpixels adjacent to them, and selecting the optimized initial superpixel closest to this average value as the region propagation center.
2. The method according to claim 1, characterized in that, it further includes: Before performing segmentation processing on the target segmentation image through the SLIC superpixel segmentation algorithm, performing sharpening processing on the target segmentation image through the Wallis operator to obtain a sharpened image as the target segmentation image to be segmented.
3. The method according to claim 1, characterized in that, The calculation of the average value of each color channel of all pixels within the region formed by the independent optimized initial superpixels and the optimized initial superpixels adjacent to them includes: Among them, K is the area formed by an independent optimized initial superpixel and its adjacent optimized initial superpixels; (R i , G i , B i ) is the color mean value of an independent optimized initial superpixel; n is the number of optimized superpixels in K; (m R , m G , m B ) is the average value of K.
4. The method according to claim 1, characterized in that, The merging of the optimized initial superpixels includes: Calculating the similarity between the optimized initial superpixel serving as the region propagation center and the optimized initial superpixels adjacent to it, comparing the obtained similarity result with a threshold, and merging the two superpixels with a similarity less than the threshold; Traversing each independent optimized initial superpixel until there are no independent optimized initial superpixels to obtain an image segmentation result.
5. The method according to claim 4, characterized in that, The calculation of the similarity between the optimized initial superpixel serving as the region propagation center and the optimized initial superpixels adjacent to it includes: Among them, D c,j is the Euclidean distance between superpixels c and j, used to represent similarity; (Rx, G c , B c ) and (R j , G j , B j ) are the color means of adjacent optimized initial superpixels respectively.
6. The method according to claim 5, characterized in that, The threshold is: where T is the threshold; std(RGB pixels ) is the standard deviation value of all pixels in the image in the RGB color domain.
7. An electronic device, including a memory and a processor, with a computer program stored on the memory, characterized in that, when the processor executes the program, it implements the image segmentation method according to any one of claims 1 to 6.
8. A computer-readable storage medium, with a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements the image segmentation method according to any one of claims 1 to 6.