Image segmentation method and device, electronic equipment, chip and storage medium

By using the method of using each pixel as the distance calculation center in image segmentation, the problem of increased hardware bandwidth and reduced computational efficiency caused by frequent reading of full-image pixel values ​​in the existing technology is solved, and more efficient image segmentation processing is achieved.

CN118628503APending Publication Date: 2024-09-10BEIJING X RING TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310215348.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-06
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

Existing superpixel segmentation methods need to traverse all superpixel centers in each iteration and frequently read full-size images, resulting in increased hardware bandwidth and reduced computational efficiency.

Method used

Using the method of calculating the distance pixel by pixel, only reading the pixel value in a superpixel set during each iteration process reduces the bandwidth consumption of data transmission and improves the efficiency of the hardware algorithm.

Benefits of technology

While ensuring the segmentation effect, it reduces the hardware bandwidth of data transmission, improves hardware computing efficiency, and increases the processing speed of image segmentation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118628503A
    Figure CN118628503A
Patent Text Reader

Abstract

The invention provides an image segmentation method and device, electronic equipment, a chip and a storage medium, and the method comprises the steps: determining k initial superpixels of a to-be-segmented image and initial superpixel centers corresponding to the k initial superpixels; determining m initial superpixels of a first pixel point neighborhood in a first superpixel in the k initial superpixels and distances between the first pixel point and initial superpixel centers corresponding to the m initial superpixels, updating the superpixel centers corresponding to the m superpixels, and updating the superpixel centers corresponding to the k superpixels, according to the method, the to-be-segmented image is divided according to the superpixel centers corresponding to the k superpixels, the first segmented image is obtained, a hardware efficient implementation scheme of the superpixel segmentation technology is provided, the segmentation effect is guaranteed, meanwhile, the hardware bandwidth of data transmission is reduced, and the hardware calculation efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of digital image processing, and in particular to an image segmentation method and device, electronic equipment, chip and storage medium. Background Art

[0002] Image segmentation technology is an important technology in the field of digital image processing and a key step from image processing to image analysis. The purpose of image segmentation is to simplify or change the representation of an image so that the image is easier to understand and analyze. The process of image segmentation is a labeling process, that is, pixels belonging to the same area are assigned the same number. Among them, superpixel (SP) segmentation is often used in the pre-processing process of image understanding because of its low computational cost and high implementation efficiency. However, the current mainstream superpixel segmentation method needs to traverse all superpixel centers and read the full-size image in each iteration. Frequent data reading is not friendly to the implementation of ISP hardening code, which increases hardware bandwidth and reduces computational efficiency. Summary of the invention

[0003] The present invention discloses an image segmentation method, device, electronic device, chip and storage medium to solve the problems in the related technology, and proposes a hardware efficient implementation solution of superpixel segmentation technology, which reduces the hardware bandwidth of data transmission and improves hardware computing efficiency while ensuring the segmentation effect.

[0004] A first aspect embodiment of the present disclosure proposes an image segmentation method, the method comprising: determining k initial superpixels of an image to be segmented and initial superpixel centers corresponding to the k initial superpixels; determining m initial superpixels in the neighborhood of a first pixel point in a first superpixel among the k initial superpixels and a distance between the first pixel point and the initial superpixel centers corresponding to the m initial superpixels, wherein k and m are positive integers and m is less than or equal to k; updating superpixel centers corresponding to the m superpixels based on the distance between each pixel point in the first superpixel and the initial superpixel centers corresponding to the m initial superpixels; updating superpixel centers corresponding to k superpixels, and segmenting the image to be segmented according to the superpixel centers corresponding to the k superpixels to obtain a first segmented image.

[0005] In some embodiments of the present disclosure, determining k initial superpixels of an image to be segmented and the initial superpixel centers corresponding to the k initial superpixels includes: dividing a plurality of pixel points of the image to be segmented into k initial superpixels, wherein each initial superpixel includes at least one pixel point, and the k superpixels have the same size; for each initial superpixel, determining the average vector of at least one pixel point as the center of the initial superpixel.

[0006] In some embodiments of the present disclosure, determining m initial superpixels in the neighborhood of a first pixel point in a first superpixel among the k initial superpixels and the distance between the first pixel point and the initial superpixel centers corresponding to the m initial superpixels includes: determining the distance between the first pixel point and the initial superpixel centers corresponding to the k initial superpixels; determining the m initial superpixel centers closest to the first pixel point in ascending order of distance; and determining the initial superpixels corresponding to the m initial superpixel centers as the m initial superpixels in the neighborhood of the first pixel point.

[0007] In some embodiments of the present disclosure, based on the distance between each pixel point in the first superpixel and the initial superpixel centers corresponding to the m initial superpixels, updating the superpixel centers corresponding to the m superpixels includes: determining the distance between each pixel point in the first superpixel and the initial superpixel centers corresponding to the m initial superpixels; for a second superpixel among the m initial superpixels, determining the pixel point in the first superpixel that is closest to the initial superpixel center corresponding to the second superpixel, and dividing the pixel point into the second superpixel; and updating the average vector of the pixel points divided into the second superpixel as the center of the second superpixel.

[0008] In some embodiments of the present disclosure, the method further includes: iteratively optimizing the first segmented image to obtain a second segmented image; and ending the iterative optimization processing in response to convergence of the moving distance between each superpixel center in the first segmented image and the corresponding superpixel center in the second segmented image to obtain an optimized segmented image.

[0009] In some embodiments of the present disclosure, in response to the convergence of the moving distance between each superpixel center in the first segmented image and the corresponding superpixel center in the second segmented image, the iterative optimization process is terminated to obtain an optimized segmented image, including: determining whether the moving distance between each superpixel center in the first segmented image and the corresponding superpixel center in the second segmented image is less than or equal to a preset threshold; if so, terminating the iterative optimization process and determining the second segmented image as the optimized segmented image.

[0010] In some embodiments of the present disclosure, the method further includes: acquiring an initial image; converting the initial image into a representation in the LAB color space to obtain an image to be segmented.

[0011] A second aspect embodiment of the present disclosure proposes an image segmentation device, which includes: a first determination module, used to determine k initial superpixels of an image to be segmented and initial superpixel centers corresponding to the k initial superpixels; a second determination module, used to determine m initial superpixels in the neighborhood of a first pixel point in a first superpixel among the k initial superpixels and the distance between the first pixel point and the initial superpixel centers corresponding to the m initial superpixels, wherein k and m are positive integers and m is less than or equal to k; an updating module, used to update the superpixel centers corresponding to the m superpixels based on the distance between each pixel point in the first superpixel and the initial superpixel centers corresponding to the m initial superpixels; and an acquisition module, used to update the superpixel centers corresponding to the k superpixels, and segment the image to be segmented according to the superpixel centers corresponding to the k superpixels to obtain a first segmented image.

[0012] The third aspect embodiment of the present disclosure proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the first aspect embodiment of the present disclosure.

[0013] The fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in the first aspect embodiment of the present disclosure.

[0014] The fifth aspect embodiment of the present disclosure proposes a chip, which includes one or more interface circuits and one or more processors; the interface circuit is used to receive code instructions and transmit them to the processor, and the processor is used to run the code instructions to execute the method described in the first aspect embodiment of the present disclosure.

[0015] In summary, the image segmentation method proposed in the present disclosure includes: determining k initial superpixels of the image to be segmented and the initial superpixel centers corresponding to the k initial superpixels; determining m initial superpixels in the neighborhood of the first pixel point in the first superpixel of the k initial superpixels and the distance between the first pixel point and the initial superpixel centers corresponding to the m initial superpixels, wherein k and m are positive integers and m is less than or equal to k; based on the distance between each pixel point in the first superpixel and the initial superpixel centers corresponding to the m initial superpixels, updating the superpixel centers corresponding to the m superpixels; updating the superpixel centers corresponding to the k superpixels, and segmenting the image to be segmented according to the superpixel centers corresponding to the k superpixels to obtain a first segmented image. The present disclosure provides a hardware efficient implementation scheme of superpixel segmentation technology, which reduces the hardware bandwidth of data transmission and improves hardware computing efficiency while ensuring the segmentation effect.

[0016] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0018] Figure 1 A schematic diagram of an image segmentation solution commonly used in the industry provided by an embodiment of the present disclosure;

[0019] Figure 2 A schematic diagram of an application scenario provided by an embodiment of the present disclosure;

[0020] Figure 3 A flowchart of an image segmentation method provided by an embodiment of the present disclosure;

[0021] Figure 4 A flowchart of an image segmentation method provided by an embodiment of the present disclosure;

[0022] Figure 5 A flowchart of an image segmentation method provided by an embodiment of the present disclosure;

[0023] Figure 6 A schematic diagram of calculating distance with a pixel point as the center provided in an embodiment of the present disclosure;

[0024] Figure 7 A schematic diagram of the effect of an image segmentation method provided by an embodiment of the present disclosure;

[0025] Figure 8 A schematic diagram of the structure of an image segmentation device provided in an embodiment of the present disclosure;

[0026] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0027] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.

[0028] The superpixel segmentation scheme provided in the related art is based on the SLIC superpixel segmentation algorithm proposed by Radhakrishna Achanta et al., including color conversion, SP center initialization, distance calculation, and updating SP center iteration. Figure 1 (a) provides a schematic diagram of the process of the scheme. Figure 1 (b) provides a schematic diagram of the distance calculation.

[0029] In the above superpixel segmentation scheme, the distance calculation is centered on the SP center point position, and the spatial distance and color distance between the pixel point and the SP center point within the 2S*2S image area are calculated. Therefore, each iteration needs to traverse all SP centers and read the full-size image to update the pixel label and then update the SP center point position. However, frequent data reading is not friendly to the implementation of ISP hardening code, which increases hardware bandwidth and reduces computing efficiency.

[0030] In order to solve the problems existing in the related art, the present disclosure proposes an image segmentation method. Different from the current superpixel segmentation algorithm scheme (SLIC) which uses the superpixel center point as the distance calculation center, the present scheme uses each pixel point as the distance calculation center. Therefore, in each algorithm iteration process, there is no need to read the pixel value of the entire image, but only the pixel value within a superpixel set needs to be read, which effectively reduces the bandwidth consumption of data transmission and thus improves the algorithm efficiency of the hardware.

[0031] Before introducing the detailed solution of the present disclosure, the scenario to which the solution of the present disclosure is applied is described first.

[0032] It should be emphasized that the solution disclosed herein can be applied to the digital image processing process in the hardware and software aspects of digital image chip processing or industrial camera imaging, especially to the design and development process of the ISP Pipeline, and can also be applied to other similar digital image processing processes, without limitation in the present disclosure.

[0033] Figure 2 FIG. 1 is a specific application scenario diagram of the image segmentation method in the embodiment of the present disclosure. Figure 1 As shown, the application scenario includes an electronic device 104, in which a camera module and several applications can be installed. The application can initiate an image acquisition instruction to acquire an image, and the camera module acquires the image 102. Among them, the camera module can include a front camera module and / or a rear camera module. Finally, the target image is sent to the target application. Among them, the electronic device 104 can be a smart phone, a tablet computer, a personal digital assistant, a wearable device, etc.

[0034] In some optional embodiments, the electronic device may also be a vehicle-mounted device or a vehicle networking device, such as a smart car, etc. In the present disclosure, only a smart phone is taken as an example, but it does not limit the scope of the present disclosure.

[0035] A camera can be installed on an electronic device, and images can be acquired through the installed camera. Cameras can be divided into laser cameras, visible light cameras and other types according to the different images acquired. Laser cameras can acquire images formed by irradiating lasers onto objects, and visible light cameras can acquire images formed by irradiating visible light onto objects. Several cameras can be installed on an electronic device, and the installation locations are not limited. For example, a camera can be installed on the front panel of an electronic device, and two cameras can be installed on the back panel. The camera can also be installed inside the electronic device in an embedded manner, and then the camera can be opened by rotating or sliding. Specifically, a front camera and a rear camera can be installed on an electronic device. The front camera and the rear camera can acquire images from different perspectives. Generally, the front camera can acquire images from the front perspective of the electronic device, and the rear camera can acquire images from the back perspective of the electronic device.

[0036] It should be understood that in the present disclosure, the front camera or the rear camera is only used as an example to distinguish the shooting angles of different cameras, rather than to limit the functions of multiple cameras. The multiple cameras in the present disclosure can be rear cameras or front cameras at the same time, which is not limited in this disclosure.

[0037] An electronic device can have several applications installed. An application is software written for a certain purpose in an electronic device. An electronic device can use an application to provide services to users. When an application needs to capture an image, it will initiate an image capture instruction. The electronic device will call the camera module to capture the image according to the image capture instruction. An image capture instruction is an instruction used to trigger an image capture operation.

[0038] The electronic device is also provided with a processor, and the image segmentation module in the processor can perform correction processing on the image captured by the camera module, for example, execute the image segmentation method provided in the present disclosure.

[0039] Figure 3 A flowchart of an image segmentation method provided in an embodiment of the present disclosure, the method is executed by a terminal, and the terminal may include a first image sensor and a second image sensor.

[0040] like Figure 3 As shown, the image segmentation method includes steps 201-204.

[0041] Step 201, determining k initial superpixels of the image to be segmented and initial superpixel centers corresponding to the k initial superpixels.

[0042] In the embodiment of the present disclosure, k is the set number of superpixels, and k is a positive integer. For example, the image to be segmented has a resolution of 700*1000. If there are 800,000 pixels in total, according to the specific requirements of image processing, k is set to 1000, that is, the set number of superpixels is 1000. According to the set number of superpixels, 1000 initial superpixels of the image to be segmented and the initial superpixel centers corresponding to these 1000 initial superpixels are determined.

[0043] It should be noted that a superpixel can be understood as a set of pixels, or a sub-region of an image. The determination of the initial superpixel described in the present disclosure can specifically refer to determining the pixel points included in each initial superpixel set, and determining the initial superpixel center corresponding to the initial superpixel can specifically refer to determining the center point of the initial superpixel area.

[0044] In the embodiments of the present disclosure, the initial superpixel can be determined by uniformly cutting the image to be segmented, or by other methods, which is not limited by the present disclosure. The initial superpixel center corresponding to each initial superpixel can be determined based on the average vector value of the pixel points in each initial superpixel, or by other methods, which is not limited by the present disclosure.

[0045] Step 202, determining m initial superpixels in the neighborhood of a first pixel point in a first superpixel among the k initial superpixels and the distance between the first pixel point and the initial superpixel centers corresponding to the m initial superpixels.

[0046] Wherein, m is a preset value, k and m are positive integers and m is less than or equal to k.

[0047] In the embodiment of the present disclosure, the first superpixel is any one of the k initial superpixels, and the first pixel point is any one of the first superpixel. According to the distance between the first pixel point and the superpixel centers corresponding to the k initial superpixels, m initial superpixels in the neighborhood of the first pixel point can be determined from the k initial superpixels, and then the distance between the first pixel point and the initial superpixel centers corresponding to the m initial superpixels can be calculated and determined.

[0048] It should be noted that in superpixel segmentation, a pixel point in the image to be segmented will hardly be divided into a superpixel that is spatially far away from it. Therefore, this scheme selects m initial superpixels (including the first superpixel where the first pixel point is located) in the neighborhood of the first pixel point, and then determines through calculation to divide the first pixel point into one of the m initial superpixels, which can reduce the amount of calculation.

[0049] In the embodiment of the present disclosure, the neighborhood of the first pixel point refers to the pixel area within a certain range extending outward from the first pixel point as the center. In other words, the m initial superpixels of the neighborhood of the first pixel point are the m initial superpixels within a certain distance range centered on the first pixel point, wherein the distance range and / or the number of m can be determined according to the actual application needs. Taking the image to be segmented as a 500*500 pixel image as an example, the neighborhood of the first pixel point can be set as the pixel area extending 100*100 outward from the first pixel point as the neighborhood of the first pixel point. Assuming k is 100, m can be set to 9, 25, 49, etc. Taking m as 9 as an example, the first superpixel point can be taken as the center to determine the 9 initial superpixels with the closest spatial distance to the first pixel point in the neighborhood of the first pixel point. The value of m is not limited in the present disclosure. It can be understood that when the present scheme is implemented, the value of m will affect the segmentation effect. The m value can be adjusted according to the feedback of the segmentation effect, so that the superpixel segmentation scheme of the present disclosure achieves a better segmentation effect after application.

[0050] Step 203: Update the superpixel centers corresponding to the m superpixels based on the distance between each pixel point in the first superpixel and the initial superpixel centers corresponding to the m initial superpixels.

[0051] Step 204, updating the superpixel centers corresponding to the k superpixels, and segmenting the image to be segmented according to the superpixel centers corresponding to the k superpixels to obtain a first segmented image.

[0052] In an embodiment of the present disclosure, by traversing all pixel points in the first superpixel, the distance between each pixel point in the first superpixel and the initial superpixel centers corresponding to the m initial superpixels can be obtained, and based on the distance, each pixel point in the first superpixel is divided into one superpixel among the m initial superpixels, and the superpixel centers corresponding to the m superpixels are updated.

[0053] In an embodiment of the present disclosure, the k initial superpixels include m initial superpixels, and the k initial superpixels can be traversed to update the superpixel centers corresponding to the k superpixels, and the image to be segmented can be segmented according to the superpixel centers corresponding to the updated k superpixels to obtain a first segmented image.

[0054] Specifically, in steps 202 and 203, for a certain pixel point in the first superpixel, m superpixels that are close to it can be determined, and the centers of the m superpixels can be updated. Similarly, by traversing all pixel points in the first superpixel, for example, if there are 9 pixel points in the first superpixel, the superpixel centers around each pixel point can be updated 9 times.

[0055] Similarly, in step 204, the superpixel center of the entire image to be segmented can be updated by traversing all superpixels (k superpixels), that is, the segmentation of the image is completed and the segmented image is obtained. It can be understood that the traversal of K superpixels can include: determining the n initial superpixels in the neighborhood of the second pixel point in the second superpixel in the k initial superpixels and the distance between the second pixel point and the initial superpixel center corresponding to the n initial superpixels, and updating the superpixel center corresponding to the n superpixels based on the distance between each pixel point in the second superpixel and the initial superpixel center corresponding to the n initial superpixels.

[0056] In summary, the superpixel segmentation scheme disclosed in the present invention is centered on pixels, and by determining the initial superpixel in the neighborhood of each pixel, calculating the distance between each pixel and the superpixel center corresponding to the initial superpixel in the neighborhood, dividing each pixel, and updating the pixel points in the initial superpixel based on the division results. The corresponding updated superpixel center can be determined based on the updated pixel points.

[0057] It should be noted that, in order to ensure the effect of image segmentation, a certain number of iterations is usually set for the segmentation process to obtain an optimized segmentation result. For example, the iteration can be set to about 50 times. The superpixel segmentation process described in steps 202-205 of the present disclosure can be applied to each iteration, and one of the k superpixels is selected in each iteration. Different from the prior art, this solution only needs to read the pixel values ​​in a superpixel set in each iteration, and each pixel value is calculated from the distance to the superpixel center of its pre-set neighborhood, which effectively reduces the bandwidth consumption of data transmission and improves the efficiency of the algorithm.

[0058] In summary, according to the image segmentation method proposed in the present invention, by determining k initial superpixels of the image to be segmented and the initial superpixel centers corresponding to the k initial superpixels, for the first superpixel among the k initial superpixels, m initial superpixels in the neighborhood of the first pixel point in the first superpixel and the distance between the first pixel point and the initial superpixel centers corresponding to the m initial superpixels are determined from the k initial superpixels, based on the distance between each pixel point in the first superpixel and the initial superpixel centers corresponding to the m initial superpixels, the superpixel centers corresponding to the m superpixels are updated, the superpixel centers corresponding to the k superpixels are updated, and the image to be segmented is segmented according to the superpixel centers corresponding to the k superpixels to obtain a first segmented image, thereby reducing the hardware bandwidth of data transmission and improving hardware computing efficiency while ensuring the segmentation effect.

[0059] based on Figure 3 The embodiment shown, Figure 4 The following is a flowchart of an image segmentation method proposed in the present disclosure. Figure 5 A flowchart of an image segmentation method is provided.

[0060] like Figure 4 As shown, the method includes the following steps 301-306.

[0061] Step 301, determining k initial superpixels of the image to be segmented and initial superpixel centers corresponding to the k initial superpixels.

[0062] In some embodiments of the present disclosure, this step also includes: acquiring an initial image; converting the initial image into a LAB color space representation to obtain an image to be segmented.

[0063] It should be noted that the purpose of the superpixel segmentation algorithm is to group pixels with semantic meanings into the same superpixel as much as possible, so it is necessary to preserve the image as wide a color gamut and rich colors as possible in the LAB color space.

[0064] The Lab color model consists of three elements: brightness (L) and A and B related to color. L stands for luminosity, and the value range of L is from 0 (black) to 100 (white). A stands for the range from magenta to green (negative values ​​of A indicate green and positive values ​​indicate magenta), and B stands for the range from yellow to blue (negative values ​​of B indicate blue and positive values ​​indicate yellow).

[0065] It is understandable that in most application scenarios, the image to be segmented is usually an RGB image, and the RGB model has too many transition colors between blue and green, and too few between green and red. The LAB color space can make up for the uneven color distribution of the RGB color model.

[0066] In some embodiments of the present disclosure, determining k initial superpixels of an image to be segmented and the initial superpixel centers corresponding to the k initial superpixels includes: dividing a plurality of pixel points of the image to be segmented into k initial superpixels, wherein each initial superpixel includes at least one pixel point, and the k superpixels have the same size; for each initial superpixel, determining the average vector of at least one pixel point as the center of the initial superpixel.

[0067] In a specific embodiment, seed points are evenly distributed in the image according to the set number of superpixels. Assuming that the image has a total of N pixels, it is pre-divided into k initial superpixels of the same size. Then the size of each initial superpixel is N / k, and the distance (step size) between adjacent seed points is approximately S=sqrt(N / k). For each initial superpixel, the average vector of at least one pixel is determined as the center of the initial superpixel.

[0068] Step 302, determining m initial superpixels in the neighborhood of a first pixel point in a first superpixel among the k initial superpixels and the distance between the first pixel point and the initial superpixel centers corresponding to the m initial superpixels.

[0069] Wherein, k and m are positive integers and m is less than or equal to k.

[0070] In some embodiments of the present disclosure, determining m initial superpixels in the neighborhood of a first pixel point in a first superpixel among k initial superpixels, and the distance between the first pixel point and the initial superpixel centers corresponding to the m initial superpixels includes: determining the distance between the first pixel point and the initial superpixel centers corresponding to the k initial superpixels; determining the m initial superpixel centers closest to the first pixel point in ascending order of distance; and determining the initial superpixels corresponding to the m initial superpixel centers as the m initial superpixels in the neighborhood of the first pixel point.

[0071] Specifically, when the reference position is determined, the spatial position of each pixel in the image to be segmented and the spatial positions of the k initial superpixel centers can be determined according to step 301. According to the spatial positions of the k initial superpixel centers, for each pixel in the image to be segmented, m initial superpixel centers with the closest spatial distances are pre-set, including the initial superpixel center corresponding to the initial superpixel to which it currently belongs. Assuming that there are a total of N pixels in the image, 9N mapping relationships are pre-stored, and the mapping relationship refers to the mapping relationship between each pixel and the m initial superpixel centers with the closest determined distances.

[0072] More specifically, assume that the range of the neighborhood is set to 3*3, that is, m is 9, such as Figure 6 As shown, the black dots represent the 16 divided initial super-pixel centers, and the white pixel points point to the 9 initial super-pixel centers that are closest to them in space, and the mapping relationship is pre-stored.

[0073] It should be noted that steps 303-305 are Figure 3 Step 203 in the illustrated embodiment: further disclosure of updating the superpixel centers corresponding to the m superpixels based on the distance between each pixel point in the first superpixel and the initial superpixel centers corresponding to the m initial superpixels.

[0074] The first superpixel is any initial superpixel among the k initial superpixels, and the first pixel point is any pixel point in the first superpixel.

[0075] Step 303: determine the distance between each pixel point in the first superpixel and the initial superpixel center corresponding to the m initial superpixels.

[0076] Specifically, taking m as 9 as an example, for each pixel in the first superpixel, the distance between each pixel and the corresponding 9 initial superpixel centers is calculated according to the 9 superpixel centers corresponding to each pixel. The distance calculation formula is as follows:

[0077]

[0078]

[0079]

[0080] Among them, the color coordinates of each pixel are expressed as (l i , a i , b i ), the spatial coordinate is expressed as (x i ,y i ), the color coordinates of the initial superpixel center are expressed as (l j , a j , b j ), the spatial coordinate is expressed as (x j ,y j ), dc represents the color distance, ds represents the spatial distance, Ns represents the maximum spatial distance within the class, that is, the spatial distance between each initial superpixel center and the pixel with the largest spatial distance, and Nc is the maximum color distance, that is, the color distance between each initial superpixel center and the pixel with the largest color distance. Figure 4 As shown, the distance is calculated with the pixel point as the center. For a superpixel, the amount of calculation is S*S*9 (the above approximate step size S=sqrt(N / k)).

[0081] Step 304, for the second superpixel in the m initial superpixels, determine the pixel point in the first superpixel that is closest to the center of the initial superpixel corresponding to the second superpixel, and divide the pixel point into the second superpixel.

[0082] In an embodiment of the present disclosure, the second superpixel refers to any one of the m initial superpixels after division. For each pixel point in the first superpixel, it is divided into the initial superpixel set of the nearest initial superpixel center among the m initial superpixels. In other words, for any one of the m initial superpixels, the pixel point closest to the corresponding initial superpixel center is divided into it.

[0083] Specifically, superpixel division is a clustering process. After traversing all pixels in the first superpixel area, the initial superpixel center with the smallest distance to each pixel is selected as its cluster center from the m initial superpixel centers, and then all pixels with the same cluster center are classified into one category. The second superpixel refers to the cluster re-formed after division.

[0084] Step 305: Update the average vector of the pixels divided into the second superpixel as the center of the second superpixel.

[0085] Furthermore, the superpixel label of each pixel can be updated to determine the superpixel to which it belongs after the division. The pixels with the same superpixel label together constitute a superpixel after the division. For the superpixel obtained after the division, its corresponding superpixel center is updated to the average vector of all pixels belonging to the superpixel.

[0086] Step 306, update the superpixel centers corresponding to the k superpixels, and segment the image to be segmented according to the superpixel centers corresponding to the k superpixels to obtain a first segmented image. In some embodiments of the present disclosure, the method further includes: iteratively optimizing the first segmented image to obtain a second segmented image; in response to the movement distance between each superpixel center in the first segmented image and the corresponding superpixel center in the second segmented image converging, ending the iterative optimization process to obtain an optimized segmented image.

[0087] In some embodiments of the present disclosure, in response to the convergence of the moving distance between each superpixel center in the first segmented image and the corresponding superpixel center in the second segmented image, the iterative optimization process is terminated to obtain an optimized segmented image, including: determining whether the moving distance between each superpixel center in the first segmented image and the corresponding superpixel center in the second segmented image is less than or equal to a preset threshold; if so, terminating the iterative optimization process and determining the second segmented image as the optimized segmented image.

[0088] Among them, the above-mentioned second segmented image refers to the segmented image obtained by iteratively optimizing the first segmented image. It can be understood that in response to the movement distance between each superpixel center in the first segmented image and the corresponding superpixel center in the second segmented image not converging, the second segmented image is iteratively optimized to obtain the third segmented image. By analogy, there may also be a fourth segmented image, a fifth segmented image, etc.

[0089] In other words, traverse the pixel points of the entire image, select one of the k initial pixels each time, execute steps 302-305, calculate the residual between the positions before and after the superpixel center is updated, until the residual converges to a size that meets the requirements, end the iterative process, and complete convergence.

[0090] Furthermore, the specific time when the residual converges to a size that meets the requirements can be set by oneself. For example, in some embodiments, a preset threshold is set. When the residual is greater than the preset threshold, it is considered that the residual has not converged to a size that meets the requirements, and one of the k initial pixels is continued to be selected to execute steps 302-305. When the residual is less than or equal to the preset threshold, it is considered that the residual has converged to a size that meets the requirements, and the iterative optimization process ends, and the current segmented image is determined as the optimized segmented image. It can be understood that the number of iterations can be adjusted by the preset threshold so that the iterative optimization can achieve better results. Figure 7 A diagram showing the effect of a superpixel segmentation solution disclosed in the present invention is shown.

[0091] In summary, the image segmentation method proposed in the present invention uses each pixel as the center of distance calculation. During each algorithm iteration, it is not necessary to read the pixel value of the entire image, but only to read the pixel value within a superpixel set, which effectively reduces the bandwidth consumption of data transmission and thus improves the algorithm efficiency of the hardware.

[0092] Figure 8 FIG. 4 is a schematic diagram of the structure of an image segmentation device 400 provided in an embodiment of the present disclosure. Figure 8 As shown, the image segmentation device comprises:

[0093] A first determination module 410 is used to determine k initial superpixels of the image to be segmented and initial superpixel centers corresponding to the k initial superpixels;

[0094] A second determination module 420 is used to determine, for a first superpixel among the k initial superpixels, m initial superpixels in a neighborhood of a first pixel point in the first superpixel, and distances between the first pixel point and initial superpixel centers corresponding to the m initial superpixels, wherein k and m are positive integers and m is less than or equal to k;

[0095] An updating module 430, configured to update the superpixel centers corresponding to the m superpixels based on the distance between each pixel point in the first superpixel and the initial superpixel centers corresponding to the m initial superpixels;

[0096] The acquisition module 440 is used to update the superpixel centers corresponding to the k superpixels, and segment the image to be segmented according to the superpixel centers corresponding to the k superpixels to obtain a first segmented image.

[0097] In some embodiments, the first determination module 410 is specifically used to: divide multiple pixel points of the image to be segmented into k initial superpixels, wherein each initial superpixel includes at least one pixel point, and the k superpixels have the same size; for each initial superpixel, determine the average vector of at least one pixel point as the center of the initial superpixel.

[0098] In some embodiments, the second determination module 420 is specifically used to: determine the distance between the first pixel point and the initial superpixel centers corresponding to the k initial superpixels; determine the m initial superpixel centers closest to the first pixel point in ascending order of distance; and determine the initial superpixels corresponding to the m initial superpixel centers as the m initial superpixels in the neighborhood of the first pixel point.

[0099] In some embodiments, the update module 430 is specifically used to: determine the distance between each pixel point in the first superpixel and the initial superpixel center corresponding to the m initial superpixels; for the second superpixel among the m initial superpixels, determine the pixel point in the first superpixel that is closest to the initial superpixel center corresponding to the second superpixel, and divide the pixel point into the second superpixel; update the average vector of the pixel points divided into the second superpixel to the center of the second superpixel.

[0100] In some embodiments, it also includes an iterative optimization module for iteratively optimizing the first segmented image to obtain a second segmented image; in response to the movement distance between each superpixel center in the first segmented image and the corresponding superpixel center in the second segmented image converging, the iterative optimization process is terminated to obtain an optimized segmented image.

[0101] In some embodiments of the present disclosure, in response to the convergence of the moving distance between each superpixel center in the first segmented image and the corresponding superpixel center in the second segmented image, the iterative optimization process is terminated to obtain an optimized segmented image, including: determining whether the moving distance between each superpixel center in the first segmented image and the corresponding superpixel center in the second segmented image is less than or equal to a preset threshold; if so, terminating the iterative optimization process and determining the second segmented image as the optimized segmented image.

[0102] In some embodiments, a conversion module is also included, which is used to obtain an initial image; convert the initial image into a LAB color space to obtain an image to be segmented.

[0103] Since the device provided in the embodiment of the present disclosure corresponds to the methods provided in the above-mentioned embodiments, the implementation of the method is also applicable to the device provided in the embodiment and will not be described in detail in this embodiment.

[0104] In summary, the image segmentation device proposed in the present invention, through the first determination module, the second determination module, the update module and the acquisition module, takes each pixel as the center of distance calculation. In each algorithm iteration process, it is not necessary to read the pixel value of the entire image, but only to read the pixel value within a superpixel set, which effectively reduces the bandwidth consumption of data transmission, thereby improving the algorithm efficiency of the hardware.

[0105] In the embodiments provided in the present application, the methods and devices provided in the embodiments of the present application are introduced. In order to implement the functions in the methods provided in the embodiments of the present application, the electronic device may include a hardware structure and a software module, and implement the functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. A function of the functions may be executed in the form of a hardware structure, a software module, or a hardware structure plus a software module.

[0106] Fig. 9 is a block diagram of an electronic device 500 for implementing the above-mentioned image segmentation method according to an exemplary embodiment. For example, the electronic device 500 may be a mobile phone, a computer, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0107] Reference Fig. 9 , the electronic device 500 may include one or more of the following components: a processing component 502 , a memory 504 , a power component 506 , a multimedia component 508 , an audio component 510 , an input / output (I / O) interface 512 , a sensor component 514 , and a communication component 516 .

[0108] The processing component 502 generally controls the overall operation of the electronic device 500, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 502 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 502 may include one or more modules to facilitate the interaction between the processing component 502 and other components. For example, the processing component 502 may include a multimedia module to facilitate the interaction between the multimedia component 508 and the processing component 502.

[0109] The memory 504 is configured to store various types of data to support operations on the electronic device 500. Examples of such data include instructions for any application or method operating on the electronic device 500, contact data, phone book data, messages, pictures, videos, etc. The memory 504 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0110] The power supply component 506 provides power to the various components of the electronic device 500. The power supply component 506 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 500.

[0111] The multimedia component 508 includes a screen that provides an output interface between the electronic device 500 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front camera and / or a rear camera. When the electronic device 500 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0112] The audio component 510 is configured to output and / or input audio signals. For example, the audio component 510 includes a microphone (MIC), and when the electronic device 500 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 504 or sent via the communication component 516. In some embodiments, the audio component 510 also includes a speaker for outputting audio signals.

[0113] I / O interface 512 provides an interface between processing component 502 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0114] The sensor assembly 514 includes one or more sensors for providing various aspects of status assessment for the electronic device 500. For example, the sensor assembly 514 can detect the open / closed state of the electronic device 500, the relative positioning of components, such as the display and keypad of the electronic device 500, and the sensor assembly 514 can also detect the position change of the electronic device 500 or a component of the electronic device 500, the presence or absence of user contact with the electronic device 500, the orientation or acceleration / deceleration of the electronic device 500, and the temperature change of the electronic device 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 514 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0115] The communication component 516 is configured to facilitate wired or wireless communication between the electronic device 500 and other devices. The electronic device 500 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G LTE, 5G NR (NewRadio) or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0116] In an exemplary embodiment, the electronic device 500 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0117] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 504 including instructions, and the instructions can be executed by a processor 520 of an electronic device 500 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0118] The embodiments of the present disclosure further provide a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the image segmentation method described in the above embodiments of the present disclosure.

[0119] An embodiment of the present disclosure further provides a computer program product, including a computer program, which executes the image segmentation method described in the above embodiment of the present disclosure when a processor is used to execute the computer program.

[0120] An embodiment of the present disclosure further proposes a chip, which includes one or more interface circuits and one or more processors; the interface circuit is used to receive code instructions and transmit them to the processor, and the processor is used to run the code instructions to execute the image segmentation method described in the above embodiments of the present disclosure.

[0121] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0122] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0123] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.

[0124] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processing module, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (control method), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary, and then stored in a computer memory.

[0125] It should be understood that the various parts of the embodiments of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0126] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0127] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0128] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. An image segmentation method, It is characterized in that The method comprises: Determine k initial superpixels of the image to be segmented and initial superpixel centers corresponding to the k initial superpixels; Determine m initial superpixels in the neighborhood of a first pixel in a first superpixel among the k initial superpixels and distances between the first pixel and initial superpixel centers corresponding to the m initial superpixels, where k and m are positive integers and m is less than or equal to k; Based on the distance between each pixel point in the first superpixel and the initial superpixel centers corresponding to the m initial superpixels, updating the superpixel centers corresponding to the m superpixels; The superpixel centers corresponding to the k superpixels are updated, and the image to be segmented is segmented according to the superpixel centers corresponding to the k superpixels to obtain a first segmented image.

2. The method according to claim 1, It is characterized in that The step of determining k initial superpixels of the image to be segmented and initial superpixel centers corresponding to the k initial superpixels comprises: Dividing the plurality of pixels of the image to be segmented into the k initial superpixels, wherein each initial superpixel includes at least one pixel, and the k superpixels have the same size; For each initial superpixel, the average vector of the at least one pixel point is determined as the center of the initial superpixel.

3. The method according to claim 2, It is characterized in that The determining of m initial superpixels in the neighborhood of a first pixel point in a first superpixel among the k initial superpixels and the distance between the first pixel point and the initial superpixel centers corresponding to the m initial superpixels comprises: Determine the distance between the first pixel and the initial superpixel centers corresponding to the k initial superpixels; Determine m initial superpixel centers closest to the first pixel point in ascending order of distance; The initial superpixels corresponding to the centers of the m initial superpixels are determined as the m initial superpixels in the neighborhood of the first pixel point.

4. The method according to claim 1, It is characterized in that The updating of the superpixel centers corresponding to the m superpixels based on the distance between each pixel point in the first superpixel and the initial superpixel centers corresponding to the m initial superpixels comprises: Determine the distance between each pixel point in the first superpixel and the initial superpixel center corresponding to the m initial superpixels; For a second superpixel in the m initial superpixels, determine a pixel point in the first superpixel that is closest to the center of the initial superpixel corresponding to the second superpixel, and divide the pixel point into the second superpixel; The average vector of the pixel points divided into the second superpixel is updated as the center of the second superpixel.

5. The method according to claim 1, It is characterized in that The method further comprises: Performing iterative optimization processing on the first segmented image to obtain a second segmented image; In response to the movement distance between each superpixel center in the first segmented image and the corresponding superpixel center in the second segmented image converging, the iterative optimization process is terminated to obtain an optimized segmented image.

6. The method according to claim 5, It is characterized in that In response to the movement distance between each superpixel center in the first segmented image and the corresponding superpixel center in the second segmented image converging, ending the iterative optimization process to obtain an optimized segmented image includes: Determine whether a moving distance between a center of each superpixel in the first segmented image and a corresponding superpixel center in the second segmented image is less than or equal to a preset threshold; If so, the iterative optimization process is terminated, and the second segmented image is determined as the optimized segmented image.

7. The method according to claim 1, It is characterized in that The method further comprises: Get the initial image; The initial image is converted into a LAB color space to obtain the image to be segmented.

8. An image segmentation device, It is characterized in that The device comprises: A first determination module is used to determine k initial superpixels of the image to be segmented and initial superpixel centers corresponding to the k initial superpixels; A second determination module is used to determine m initial superpixels in the neighborhood of a first pixel in a first superpixel among the k initial superpixels and distances between the first pixel and initial superpixel centers corresponding to the m initial superpixels, wherein k and m are positive integers and m is less than or equal to k; An updating module, configured to update the superpixel centers corresponding to the m superpixels based on the distance between each pixel point in the first superpixel and the initial superpixel centers corresponding to the m initial superpixels; An acquisition module is used to update the superpixel centers corresponding to the k superpixels, and segment the image to be segmented according to the superpixel centers corresponding to the k superpixels to obtain a first segmented image.

9. An electronic device, It is characterized in that include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium storing computer instructions, It is characterized in that The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.

11. A chip, It is characterized in that The method comprises one or more interface circuits and one or more processors; the interface circuit is used to receive code instructions and transmit them to the processor, and the processor is used to run the code instructions to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • An image superpixel segmentation method and a device thereof

    CN109345536A

  • Superpixel segmentation method and related equipment

    CN110503656A

  • Method for identifying boundary of sedimentary facies, computer device and computer readable storage medium

    US20210041588A1