Image segmentation method and device based on fuzzy clustering, and electronic device
By using a fuzzy clustering method and adjusting the clusters using multivariate arrays and multidimensional histograms, the problem of balancing image segmentation speed and accuracy is solved, achieving more efficient image segmentation results.
Patent Information
- Application Number
- CN202510594311.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-09
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2045-05-09
AI Technical Summary
Existing image segmentation techniques struggle to balance speed and accuracy, especially when dealing with complex image characteristics, making effective segmentation difficult.
By using a fuzzy clustering method, multiple sub-images of the target image are obtained, a multivariate array and a multidimensional histogram are constructed, and the objective function is minimized by the difference or ratio of the first distance and the second distance. The clusters are then adjusted to achieve image segmentation.
It improves the speed and accuracy of image segmentation, enhances robustness to noise and outliers, and accurately identifies the boundary and texture information of target images.
Smart Images

Figure CN120125602B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and in particular to an image segmentation method and device based on fuzzy clustering, and an electronic device. BACKGROUND
[0002] Image segmentation refers to a process of dividing an image into a plurality of homogeneous regions based on feature information such as brightness, color, and texture in the image, and the feature information in a homogeneous region is consistent.
[0003] A Chinese patent with application number 202311818218.3 discloses an image segmentation method based on adaptive feature perception, which includes: obtaining a feature vector corresponding to each pixel point in a to-be-segmented image and an initial weight thereof, determining each initial clustering center, and obtaining an initial clustering cluster corresponding to each initial clustering center; determining whether to update the clustering center according to the contour coefficient of each pixel point in the determined initial clustering cluster, if the clustering center needs to be updated, performing adaptive weighted update on the initial weight of the feature vector to obtain a first weight, and determining each first clustering center; determining the clustering cluster at the next iteration based on the first weight and the first clustering center, and iteratively performing the clustering cluster obtaining and evaluating process until the clustering result meets the preset clustering requirement, and taking the clustering result at this time as the segmentation result of the to-be-segmented image; the present application optimizes the clustering process adaptively, and improves the accuracy of image segmentation.
[0004] Although the image segmentation technology similar to the above-mentioned technology improves the accuracy of image segmentation to a certain extent, due to the complex characteristics of image segmentation, it is still difficult to achieve both speed and accuracy. Therefore, how to effectively segment an image has become a problem to be solved at present. SUMMARY
[0005] The present specification proposes an image segmentation technical scheme.
[0006] According to an aspect of the present specification, an image segmentation method based on fuzzy clustering is provided, which includes:
[0007] Obtaining a target image and a use scenario of the target image, and performing attribute separation processing on the target image using a sub-image acquisition method matched with the use scenario to obtain a plurality of sub-images, the sub-images having the same size as the target image;
[0008] According to the pixel information of each sub-image at the same pixel point, a multi-element array is constructed, and a multi-dimensional histogram is constructed with each pixel information in the multi-element array and the number of multi-element arrays in the target image as dimensions;
[0009] According to the multi-dimensional histogram, initial clustering processing is performed on the pixel points in the target image to obtain a plurality of clustering clusters, and a first distance between pixel points in a same clustering cluster and a clustering center and a second distance between clustering centers of different clustering clusters are determined;
[0010] According to a difference and / or a ratio of the first distance and the second distance, a target function is determined, and the pixel points contained in the clustering clusters are adjusted by minimizing the target function to obtain a segmentation result of the target image according to the adjusted clustering clusters.
[0011] In a possible implementation, the constructing a multi-dimensional array according to the pixel information of each of the sub-images at a same pixel point comprises:
[0012] A target sub-image to be dilated is selected from the sub-images, and a one-dimensional histogram is constructed by taking the pixel information of the pixels in the target sub-image as the abscissa and taking the number of pixels contained in each of the pixel information as the ordinate;
[0013] In the target sub-image, a target pixel corresponding to a trough in the one-dimensional histogram is dilated to obtain a dilated sub-image, and the dilating is used to make the pixels adjacent to the target pixel have the same pixel information as the target pixel;
[0014] The multi-dimensional array is constructed according to the dilated sub-image and the pixel information of each of the sub-images at a same pixel point.
[0015] In a possible implementation, the dilating a target pixel corresponding to a trough in the one-dimensional histogram in the target sub-image to obtain a dilated sub-image comprises:
[0016] In the target sub-image, a dilated pixel corresponding to the target pixel is determined by taking the target pixel as the center and a preset distance as the radius;
[0017] The pixel information of the target pixel corresponding to the dilated pixel in the target sub-image is taken as the pixel information of the dilated pixel to realize the dilating and obtain the dilated sub-image.
[0018] In a possible implementation, in the case where the use scenario is real-time tracking, the using a sub-image acquisition mode matched with the use scenario to perform attribute separation processing on the target image to obtain a plurality of sub-images comprises:
[0019] The target image is subjected to grayscale processing to obtain a grayscale image of the target image as a first sub-image;
[0020] The target image is filtered using a preset smoothing filter to obtain a filtered image of the target image, which serves as the second sub-image.
[0021] In one possible implementation, when the usage scenario is under multiple illumination conditions, the target image is subjected to attribute separation processing using a sub-image acquisition method matching the usage scenario to obtain multiple sub-images, including:
[0022] The target image is converted from RGB space to HSV space to obtain an HSV image;
[0023] The HSV image is subjected to channel separation processing to obtain an H channel image, an S channel image, and a V channel image, which are respectively used as the first sub-image, the second sub-image, and the third sub-image.
[0024] In one possible implementation, the step of constructing a multivariate array based on the pixel information of each of the sub-images at the same pixel point, and constructing a multidimensional histogram using the pixel information in the multivariate array and the number of multivariate arrays in the target image as dimensions, includes:
[0025] Based on the pixel information of the H-channel image and the S-channel image at the same pixel point, a first multivariate array is constructed, and a first multidimensional histogram is constructed using the pixel information in the first multivariate array and the number of multivariate arrays in the target image as dimensions.
[0026] Based on the pixel information of the H-channel image and the V-channel image at the same pixel point, a second multivariate array is constructed, and a second multidimensional histogram is constructed using the pixel information in the second multivariate array and the number of multivariate arrays in the target image as dimensions;
[0027] The initial clustering process is performed on the pixels in the target image based on the multidimensional histogram to obtain multiple clusters, including:
[0028] Based on the first multidimensional histogram, the pixels in the target image are initially clustered to obtain multiple first clusters.
[0029] Based on the second multidimensional histogram, the pixels in the target image are initially clustered to obtain multiple second clusters.
[0030] The first cluster is merged with the second cluster corresponding to the first cluster to obtain the cluster.
[0031] In one possible implementation, determining the first distance between pixels in the same cluster and the cluster center, and the second distance between cluster centers of different clusters, includes:
[0032] using a preset kernel function, performing feature transformation on image information corresponding to the pixel points in the cluster, to obtain transformation information;
[0033] determining the first distance according to transformation information corresponding to the pixel points and the cluster center in the same cluster;
[0034] determining the second distance according to transformation information corresponding to cluster centers of different clusters.
[0035] According to an aspect of the present specification, an image segmentation device based on fuzzy clustering is provided, comprising:
[0036] a sub-image module configured to obtain a target image and a use scenario of the target image, and perform attribute separation processing on the target image using a sub-image acquisition method matched with the use scenario, to obtain a plurality of sub-images, the sub-images having the same size as the target image;
[0037] a histogram module configured to construct a multi-element array according to pixel information of each of the sub-images at the same pixel point, and construct a multi-dimensional histogram with each of the pixel information in the multi-element array and the number of multi-element arrays in the target image as dimensions;
[0038] an initial clustering module configured to perform initial clustering processing on the pixel points in the target image according to the multi-dimensional histogram, to obtain a plurality of clusters, and determine a first distance between the pixel points and the cluster center in the same cluster and a second distance between the cluster centers of different clusters;
[0039] a segmentation module configured to determine a target function according to a difference and / or a ratio of the first distance and the second distance, and adjust the pixel points included in the clusters by minimizing the target function, to obtain a segmentation result of the target image according to the adjusted clusters.
[0040] In a possible implementation manner, the histogram module comprises:
[0041] a one-dimensional histogram unit configured to select a target sub-image to be dilated from the sub-images, and construct a one-dimensional histogram with pixel information of pixels in the target sub-image as abscissa and a number of pixels included in each of the pixel information as ordinate;
[0042] a dilation processing unit configured to perform dilation processing on a target pixel corresponding to a trough in the one-dimensional histogram in the target sub-image, to obtain a dilated sub-image, the dilation processing being configured to make pixels adjacent to the target pixel have the same pixel information as the target pixel;
[0043] A multi-element array unit is configured to construct the multi-element array according to pixel information of the same pixel point of the expanded sub-image and the sub-image.
[0044] In a possible implementation, the expanding the target pixel corresponding to the valley in the one-dimensional histogram in the target sub-image to obtain an expanded sub-image includes:
[0045] determining an expanded pixel corresponding to the target pixel in the target sub-image, with the target pixel as the center and a preset distance as the radius;
[0046] obtaining the expanded sub-image by taking pixel information of the target pixel corresponding to the expanded pixel in the target sub-image as pixel information of the expanded pixel to implement the expanding.
[0047] In a possible implementation, in the case where the use scenario is real-time tracking, the sub-image module includes:
[0048] a first sub-image unit configured to perform a grayscale processing on the target image to obtain a grayscale image of the target image as a first sub-image;
[0049] a second sub-image unit configured to perform a filter processing on the target image by using a preset smoothing filter to obtain a filter image of the target image as a second sub-image.
[0050] In a possible implementation, in the case where the use scenario is multi-illumination, the sub-image module includes:
[0051] an HSV image unit configured to convert the target image from an RGB space to an HSV space to obtain an HSV image;
[0052] an HSV channel separation unit configured to perform a channel separation processing on the HSV image to obtain an H channel image, an S channel image, and a V channel image as a first sub-image, a second sub-image, and a third sub-image, respectively.
[0053] In a possible implementation, the histogram module includes:
[0054] a first histogram unit configured to construct a first multi-element array according to pixel information of the same pixel point of the H channel image and the S channel image, and construct a first multi-dimensional histogram with each pixel information in the first multi-element array and a number of multi-element arrays in the target image as dimensions;
[0055] a second histogram unit, configured to construct a second multi-dimensional array according to pixel information of the same pixel point in the H channel image and the V channel image, and construct a second multi-dimensional histogram with each pixel information in the second multi-dimensional array and a number of multi-dimensional arrays in the target image as dimensions;
[0056] The initial clustering module includes:
[0057] a first clustering cluster unit, configured to perform initial clustering processing on the pixel points in the target image according to the first multi-dimensional histogram, to obtain a plurality of first clustering clusters;
[0058] a second clustering cluster unit, configured to perform initial clustering processing on the pixel points in the target image according to the second multi-dimensional histogram, to obtain a plurality of second clustering clusters;
[0059] a clustering cluster unit, configured to fuse the first clustering cluster and the second clustering cluster corresponding to the first clustering cluster, to obtain the clustering cluster.
[0060] In a possible implementation, the initial clustering module includes:
[0061] a function unit, configured to perform feature transformation on image information corresponding to the pixel points in the clustering cluster by using a preset kernel function, to obtain transformation information;
[0062] a first variation unit, configured to determine the first distance according to transformation information corresponding to the pixel points and the cluster center in the same clustering cluster;
[0063] a second variation unit, configured to determine the second distance according to transformation information corresponding to cluster centers of different clustering clusters.
[0064] According to an aspect of the present specification, an electronic device is provided, including:
[0065] a processor; a memory for storing processor-executable instructions; wherein the processor is configured to invoke instructions stored in the memory to perform the image segmentation method described above.
[0066] According to an aspect of the present specification, a computer-readable storage medium having computer program instructions stored thereon is also provided, and the computer program instructions are executed by a processor to implement the image segmentation method described above.
[0067] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, but not limiting the present specification.
[0068] Other features and aspects of the present specification will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings.
[0069] Beneficial effects: the present application can realize local operation of the target image by introducing a kernel function that limits operation in a smaller local area of the image in the clustering process, provide multi-level and multi-aspect information support, improve the robustness of the segmentation process to noise and outliers, and further help accurately identify the boundary and texture information of the target image, and improve the segmentation precision. BRIEF DESCRIPTION OF DRAWINGS
[0070] The drawings incorporated in and forming a part of the specification, illustrate embodiments consistent with the present specification, and together with the description, serve to explain the principles of the present specification.
[0071] Figure 1 A flow chart of an image segmentation method according to an embodiment of the present specification is shown.
[0072] Figure 2 A block diagram of an image segmentation device according to an embodiment of the present specification is shown.
[0073] Figure 3 A block diagram of an electronic device according to an embodiment of the present specification is shown.
[0074] Figure 4 A block diagram of another electronic device according to an embodiment of the present specification is shown. DETAILED DESCRIPTION
[0075] Various exemplary embodiments, features and aspects of the present specification will be described in detail below with reference to the accompanying drawings. The same reference numbers in the drawings represent functionally the same or similar elements. Although various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
[0076] The word "exemplary" is used herein to mean "serving as an example, instance, or illustration." Any implementation described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other implementations.
[0077] The term "and / or", merely describes an associated relationship, which means that there can be three relationships, for example, A and / or B, which can mean that A exists alone, A and B exist together, and B exists alone. In addition, the term "at least one" herein means any one of the plurality or any combination of at least two of the plurality, for example, including at least one of A, B, C, which can mean including any one or more elements selected from the set consisting of A, B and C.
[0078] In addition, for a better understanding of the present specification, numerous specific details are given in the following detailed description. It will be understood by those skilled in the art that the present specification can also be implemented without certain specific details. In some examples, methods, means, elements and circuits well known to those skilled in the art are not described in detail in order to highlight the main ideas of the present specification.
[0079] Figure 1 A flowchart of an image segmentation method according to an embodiment of the present specification is shown, which can be applied to an image segmentation device, which can be a terminal device, a server or other processing device, etc. The terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc.
[0080] In some possible implementations, the image segmentation method can be implemented by a processor invoking computer readable instructions stored in a memory.
[0081] As shown in Figure 1 The image segmentation method based on fuzzy clustering can include:
[0082] Step S11, obtaining a target image and a use scenario of the target image, and performing attribute separation processing on the target image using a sub-image acquisition method matched with the use scenario to obtain a plurality of sub-images.
[0083] The target image is an image to be segmented. The target image can be an image collected by an image collection device of an autonomous vehicle, an image collected by a face recognition device, or an image collected by a medical device. The source of the target image is not limited in the present specification and can be determined according to actual conditions.
[0084] The use scenario of the target image can also be different for different sources. For example, the use scenario of the target image collected by an autonomous vehicle can be real-time tracking, the use scenario of the target image collected by a face recognition device can be face recognition, and the use scenario of the target image collected by a medical device can be organ or tissue recognition. Further, the use scenario of the target image can also be refined for the same source. For example, the use scenario of the target image collected by a medical device can be divided into a color dominant scenario and a multi-light source scenario. The use scenario of the target image is not limited in the present specification and can be determined according to actual conditions.
[0085] The sub-image is an image obtained by attribute separation of the target image. Different use scenarios correspond to different sub-image acquisition methods, and different sub-images are obtained. For example, for a color dominant scenario, the RGB channel attribute separation sub-image acquisition method can be adopted for the target image to obtain the R channel image, the G channel image and / or the B channel image as the sub-image; for a texture dominant scenario, the texture attribute separation sub-image acquisition method can be adopted for the target image to obtain the texture image as the sub-image. In order to facilitate the subsequent image segmentation process, each sub-image can have the same size as the target image.
[0086] In an example, the determination of the use scenario of the target image can be combined with the source of the target image and the content of the target image, etc. After determining the use scenario, the sub-image acquisition method can be determined in combination with the use scenario, and then the attribute separation processing of the target image is performed using the sub-image acquisition method to obtain the sub-image.
[0087] In step S12, a multi-element array is constructed according to the pixel information of each sub-image at the same pixel point, and a multi-dimensional histogram is constructed with each pixel information in the multi-element array and the number of multi-element arrays in the target image as dimensions.
[0088] The multi-dimensional histogram is a histogram constructed based on the pixel information of each pixel point in the target image, and the pixel information contained in each pixel point in the sub-image can be a gray value, a brightness value, etc.
[0089] The multi-element array is an array that integrates the pixel information of each sub-image separated from the target image. Specifically, one pixel point corresponds to one multi-element array, and the number of elements in the multi-element array can be the same as the number of sub-images separated from the target image. The elements in the multi-element array are the pixel information of the same pixel point in each sub-image.
[0090] In an example, the multi-dimensional histogram can be constructed based on the multi-element array. In the curve corresponding to the multi-dimensional histogram, one of the coordinate axes can represent the number of the same multi-element array in the sub-image, and the remaining coordinate axes represent each element in the multi-element array, i.e., the dimension N of the multi-dimensional histogram curve is the number of sub-images corresponding to the target image or the number of elements in the multi-element array, and N is greater than or equal to 2.
[0091] Since the number of occurrences of the multi-element array is counted by using the multi-dimensional histogram, the defect that it takes a long time to calculate the repeated values of the multi-element array can be avoided, which greatly improves the segmentation speed of the target image based on the clustering algorithm of the multi-dimensional histogram in subsequent steps S13-S14.
[0092] It can be found in the process of adding noise to the target image that the one-dimensional histogram of the target image after adding noise has only one peak, that is, the object and the background are in a single peak state. At this time, the target may not be extracted from the target image by using the traditional image threshold or clustering segmentation method. The multi-dimensional histogram of the target image after adding noise obviously presents a multi-peak distribution. Therefore, the multi-dimensional histogram algorithm is used in step S12 to effectively extract the image target and improve the anti-noise ability of the segmentation.
[0093] In step S13, the pixel points in the target image are initially clustered based on the multi-dimensional histogram to obtain a plurality of clustering clusters, and a first distance between the pixel points in the same clustering cluster and a clustering center and a second distance between the clustering centers of different clustering clusters are determined.
[0094] In step S14, a target function is determined according to the difference and / or ratio of the first distance and the second distance, and the pixel points in the clustering cluster are adjusted by minimizing the target function to obtain a segmentation result of the target image according to the adjusted clustering cluster.
[0095] The first distance is the distance between the pixel points in the same clustering cluster and the clustering center, which reflects the intra-class compactness. The second distance is the distance between the clustering centers of different clustering clusters, which reflects the inter-class dispersion.
[0096] Specifically, after the pixel points in the target image are initially clustered based on the multi-dimensional histogram, the target function can be constructed based on the first distance and the second distance, and then the pixel points in each clustering cluster are adjusted using the target function to obtain the segmentation result.
[0097] Since the difference or ratio of the first distance and the second distance can combine the intra-class compactness and the inter-class dispersion, in an example, the target function can be constructed based on the difference or ratio of the first distance and the second distance to adjust the compactness of the pixel points and the clustering center and the dispersion between different clustering clusters by the target function. When the compactness and the dispersion are both optimal, the clustering cluster to which each pixel point in the target image finally belongs is determined.
[0098] In steps S13-S14, the compactness of the pixel points and the clustering center and the dispersion between different clustering clusters are considered simultaneously by the first distance and the second distance, which can improve the accuracy of image segmentation.
[0099] In the embodiments of the present application, a plurality of sub-images are obtained based on a sub-image acquisition mode matched with a use scenario, and a multi-dimensional array corresponding to the sub-images is constructed, then initial clustering processing is performed on pixel points in a target image based on the multi-dimensional array, a first distance and a second distance are determined, finally, the clustering clusters obtained by the initial clustering are adjusted according to a target function determined based on a difference and / or a ratio of the first distance and the second distance, and a segmentation result is obtained. The process realizes the improvement of the segmentation speed of the target image through the multi-dimensional histogram, and realizes the improvement of the segmentation accuracy of the target image through the difference and / or the ratio of the first distance and the second distance, so that the segmentation speed and the accuracy are both realized, and the robustness of the image segmentation is improved.
[0100] In a possible implementation manner, the constructing the multi-dimensional array according to the pixel information of each of the sub-images at the same pixel point comprises:
[0101] selecting a target sub-image to be dilated from the sub-images, and constructing a one-dimensional histogram with pixel information of pixels in the target sub-image as abscissa and with a number of pixels contained in each of the pixel information as ordinate;
[0102] performing dilation processing on target pixels corresponding to valleys in the one-dimensional histogram in the target sub-image to obtain a dilated sub-image, the dilation processing being used to make pixels adjacent to the target pixels have the same pixel information as the target pixels;
[0103] constructing the multi-dimensional array according to the dilated sub-image and the pixel information of each of the sub-images at the same pixel point.
[0104] In the embodiments of the present application, a plurality of sub-images are obtained based on a sub-image acquisition mode matched with a use scenario, and a multi-dimensional array corresponding to the sub-images is constructed, then initial clustering processing is performed on pixel points in a target image based on the multi-dimensional array, a first distance and a second distance are determined, finally, the clustering clusters obtained by the initial clustering are adjusted according to a target function determined based on a difference and / or a ratio of the first distance and the second distance, and a segmentation result is obtained. The process realizes the improvement of the segmentation speed of the target image through the multi-dimensional histogram, and realizes the improvement of the segmentation accuracy of the target image through the difference and / or the ratio of the first distance and the second distance, so that the segmentation speed and the accuracy are both realized, and the robustness of the image segmentation is improved.
[0105] The threshold method is a direct segmentation method based on a histogram, which selects a threshold according to a valley position of the histogram, and each peak corresponds to a class of pixels in the image. The threshold method is simple and efficient, but it cannot guarantee the continuity of the segmentation region.
[0106] Since the valleys in the histogram correspond to the threshold, in an example, dilation processing can be performed on the pixel points corresponding to the valleys in the histogram to improve the continuity of the segmentation region. Specifically, a target sub-image to be dilated can be first selected from the target sub-images, a one-dimensional histogram corresponding to the target sub-image is constructed, then the pixels corresponding to the valleys in the one-dimensional histogram are determined as target pixels, and then dilation processing is performed based on the target pixels.
[0107] In a possible implementation, the expanding the target pixel corresponding to the valley in the one-dimensional histogram in the target sub-image to obtain an expanded sub-image includes:
[0108] determining, in the target sub-image, an expanded pixel corresponding to the target pixel with the target pixel as the center and a preset distance as the radius;
[0109] taking pixel information of the target pixel corresponding to the expanded pixel in the target sub-image as pixel information of the expanded pixel to implement the expanding to obtain the expanded sub-image.
[0110] The expanded pixel is a pixel whose pixel information is changed based on the target pixel. Specifically, the pixels in a circle drawn with the target pixel as the center in the target sub-image can be taken as the expanded pixels, except the target pixel. The radius of the circle can be n pixels, and the value of n is not limited in the specification and can be determined according to actual conditions. In an example, the value of n can be determined based on the resolution of the target image, for example, n can be larger when the resolution is larger, and n can be smaller when the resolution is smaller.
[0111] After the expanded pixel is determined, the pixel information of the target pixel can be taken as the pixel information of the corresponding expanded pixel to implement the expansion of the target pixel in the target sub-image and obtain the expanded sub-image.
[0112] Further, the expanded sub-image can be used as a supplement to the sub-images separated from the target image attribute, and the expanded sub-image and the sub-images are combined to construct the multi-element array and the multi-dimensional histogram.
[0113] In the embodiments of the specification, the target sub-image is selected from the sub-images, and then the target sub-image is expanded to obtain the expanded sub-image, and the expanded sub-image and the sub-images are combined to construct the multi-element array. In this process, the continuity of the segmented region is improved by constructing the expanded sub-image, and the shortcomings of image segmentation based on the histogram are compensated, and the accuracy of image segmentation is improved.
[0114] As described above, the sub-images corresponding to different use scenarios can be different. In a possible implementation, in the case where the use scenario is real-time tracking, the use of the sub-image acquisition mode matched with the use scenario to perform attribute separation processing on the target image to obtain a plurality of sub-images includes:
[0115] performing grayscale processing on the target image to obtain a grayscale image of the target image as a first sub-image;
[0116] The target image is filtered using a preset smoothing filter to obtain a filtered image of the target image as a second sub-image.
[0117] Specifically, since the real-time tracking use scenario such as automatic driving has a higher requirement on the segmentation speed, in an example, the two types of simple attribute separation processing, i.e., grayscale processing and filtering processing, can be selected to obtain the sub-image, thereby simplifying the obtaining process of the sub-image and improving the segmentation speed.
[0118] Specifically, the target image can be subjected to grayscale processing, and the obtained grayscale image of the target image is taken as a first sub-image. Further, the target image can be filtered using a preset smoothing filter, and the obtained filtered image of the target image is taken as a second sub-image. Through the filtering operation, the pixel information of the pixel points in the second sub-image can contain the pixel information of adjacent pixel points. The smoothing filter can be a mean filter and a Gaussian filter, etc.
[0119] It is considered that the multi-light use scenario has a higher requirement on the segmentation accuracy than the real-time tracking use scenario. In a possible implementation, in the case where the use scenario is multi-light, the attribute separation processing is performed on the target image using the sub-image obtaining manner matched with the use scenario to obtain a plurality of sub-images, including:
[0120] The target image is converted from an RGB space to an HSV space to obtain an HSV image.
[0121] The HSV image is subjected to channel separation processing to obtain an H channel image, an S channel image, and a V channel image as a first sub-image, a second sub-image, and a third sub-image, respectively.
[0122] The multi-light use scenario is a scenario in which multiple lightings with different intensities and brightnesses are used.
[0123] Since the target image corresponding to the multi-light use scenario is prone to have noise such as shadow, and compared with the RGB space, the HSV space is more suitable for image processing under varying lighting conditions, in an example, the target image in the RGB space can be converted to the HSV space to obtain an HSV image. The HSV image is subjected to channel separation processing to obtain images of three channels of H, S, and V, and these images are taken as sub-images, thereby obtaining a more reliable image segmentation result than the RGB space.
[0124] In the H channel image, the S channel image and the V channel image, the H channel image is not affected by the illumination transformation, and thus the image segmentation can be mainly relied on the H channel. In a possible implementation, the constructing a multi-element array according to the pixel information of each of the sub-images at the same pixel point, and constructing a multi-dimensional histogram with each pixel information in the multi-element array and the number of multi-element arrays in the target image as dimensions, comprises:
[0125] constructing a first multi-element array according to the pixel information of the H channel image and the S channel image at the same pixel point, and constructing a first multi-dimensional histogram with each pixel information in the first multi-element array and the number of multi-element arrays in the target image as dimensions;
[0126] constructing a second multi-element array according to the pixel information of the H channel image and the V channel image at the same pixel point, and constructing a second multi-dimensional histogram with each pixel information in the second multi-element array and the number of multi-element arrays in the target image as dimensions;
[0127] the initial clustering processing of the pixel points in the target image according to the multi-dimensional histogram, to obtain a plurality of clustering clusters, comprises:
[0128] the initial clustering processing of the pixel points in the target image according to the first multi-dimensional histogram, to obtain a plurality of first clustering clusters;
[0129] the initial clustering processing of the pixel points in the target image according to the second multi-dimensional histogram, to obtain a plurality of second clustering clusters;
[0130] fusing the first clustering cluster and the second clustering cluster corresponding to the first clustering cluster, to obtain the clustering cluster.
[0131] Specifically, the H channel image can be combined with the S channel image and the V channel image respectively to construct a multi-element array, and then a multi-dimensional histogram is constructed. The multi-element array constructed based on the H channel image and the S channel image is a first multi-element array, and the multi-dimensional histogram constructed based on the H channel image and the S channel image is a first multi-dimensional histogram. The multi-element array constructed based on the H channel image and the V channel image is a second multi-element array, and the multi-dimensional histogram constructed based on the H channel image and the V channel image is a second multi-dimensional histogram. In the first multi-element array and the second multi-element array, the pixel information corresponding to the dilated sub-image can be included.
[0132] After obtaining two multidimensional histograms (a first multidimensional histogram and a second multidimensional histogram), the corresponding clustering results, i.e., multiple clusters, can be obtained based on these two histograms respectively. The cluster corresponding to the first multidimensional histogram is the first cluster, and the cluster corresponding to the second multidimensional histogram is the second cluster. Since the two multidimensional histograms use information from different target images, in one example, the corresponding clusters from both can be fused to obtain the cluster corresponding to the target image. Besides fusing the first and second clusters, either the first or second cluster can also be used as a separate cluster.
[0133] In the embodiments of this specification, by mapping the target image located in the RGB space to the HSV space and performing the above processing, the influence of noise such as shadows on the image segmentation results in multi-light source usage scenarios can be reduced, and the reliability of the image segmentation results in multi-light source usage scenarios can be improved.
[0134] In one possible implementation, determining the first distance between pixels in the same cluster and the cluster center, and the second distance between cluster centers of different clusters, includes:
[0135] Using a preset kernel function, feature transformation is performed on the image information corresponding to the pixels in the cluster to obtain transformation information;
[0136] The first distance is determined based on the transformation information corresponding to the pixels and cluster centers in the same cluster.
[0137] The second distance is determined based on the transformation information corresponding to the cluster centers of different clusters.
[0138] Here, the kernel function is the function used for feature transformation. Specifically, the introduction of the kernel function can transform the nonlinear problem in the original input space into a linear problem in a high-dimensional space. This amplifies the feature differences between samples, thereby improving the clustering effect. The kernel function can be defined as shown in Equation 1:
[0139] K(x k ,v i )= <Φ(x k ),Φ(v i )> (Formula 1)
[0140] Where <·> represents the inner product, Φ(·) represents the eigenvalue transformation corresponding to the kernel function, and x k Represents a pixel, v i K(x) represents the cluster center. k ,v i ) represents the kernel function.
[0141] After the change information of the clustering cluster and the clustering center is obtained based on the kernel function, the first distance and the second distance can be determined based on the change information. The type of the kernel function is not specifically limited in the specification, and can be determined according to actual conditions. In an example, the kernel function can be a Gaussian kernel function.
[0142] In the above process, by introducing a kernel function that limits the operation to a smaller local area of the image in the clustering process, local operation of the target image can be achieved, multi-level and multi-aspect information support can be provided, the robustness of the segmentation process to noise and outliers can be improved, and then the boundary and texture information of the target image can be accurately identified, and the segmentation precision can be improved.
[0143] It should be noted that the image segmentation method of the embodiments of the present specification is not limited to the above two use scenarios, and can be applied to any use scenario, which is not limited in the present specification.
[0144] It can be understood that the above-mentioned various method embodiments mentioned in the present specification can be combined with each other to form combined embodiments without violating the principle logic. Limited to the length of the specification, the present specification will not be repeated. Those skilled in the art can understand that in the above-mentioned method of the specific implementation, the specific execution order of each step should be determined according to its function and possible internal logic.
[0145] In addition, the present specification also provides an image segmentation device, an electronic device, a computer readable storage medium, and a program, which can be used to implement any of the image segmentation methods provided by the present specification. The corresponding technical solutions and descriptions are described in the method part and are not repeated.
[0146] Figure 2 A block diagram of an image segmentation device according to an embodiment of the present specification is shown. The image segmentation device can be a terminal device, a server, or other processing devices, etc. Among them, the terminal device can be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc.
[0147] In some possible implementations, the image segmentation device can be implemented by a processor invoking computer readable instructions stored in a memory.
[0148] As Figure 2 shown, the image segmentation device 20 can include:
[0149] Sub-image module 21 is used to acquire a target image and the usage scenario of the target image, and to perform attribute separation processing on the target image using a sub-image acquisition method that matches the usage scenario to obtain multiple sub-images, wherein the sub-images have the same size as the target image;
[0150] Histogram module 22 is used to construct a multivariate array based on the pixel information of each of the sub-images at the same pixel point, and to construct a multidimensional histogram using the pixel information in the multivariate array and the number of multivariate arrays in the target image as dimensions;
[0151] The initial clustering module 23 is used to perform initial clustering processing on the pixels in the target image according to the multidimensional histogram to obtain multiple clusters, and to determine the first distance between the pixels in the same cluster and the cluster center and the second distance between the cluster centers of different clusters.
[0152] The segmentation module 24 is used to determine an objective function based on the difference and / or ratio of the first distance and the second distance, and to adjust the pixels contained in the cluster by minimizing the objective function, so as to obtain the segmentation result of the target image based on the adjusted cluster.
[0153] In one possible implementation, the histogram module 22 includes:
[0154] A one-dimensional histogram unit is used to select a target sub-image to be dilated from the sub-image, and construct a one-dimensional histogram with the pixel information of the pixels in the target sub-image as the horizontal axis and the number of pixels contained in each pixel information as the vertical axis.
[0155] The dilation processing unit is used to dilate the target pixel corresponding to the valley in the one-dimensional histogram in the target sub-image to obtain a dilated sub-image. The dilation processing is used to make the pixel information of the pixel adjacent to the target pixel the same as that of the target pixel.
[0156] A multivariate array unit is used to construct the multivariate array based on the pixel information of the dilated sub-image and the sub-image at the same pixel point.
[0157] In one possible implementation, the step of dilating the target pixels corresponding to the valleys in the one-dimensional histogram in the target sub-image to obtain a dilated sub-image includes:
[0158] In the target sub-image, with the target pixel as the center and a preset distance as the radius, the dilated pixel corresponding to the target pixel is determined;
[0159] The pixel information of a target pixel corresponding to the dilated pixel in the target sub-image is taken as the pixel information of the dilated pixel to realize the dilating processing, and the dilated sub-image is obtained.
[0160] In a possible implementation, in the case where the use scenario is real-time tracking, the sub-image module 21 comprises:
[0161] A first sub-image unit is configured to perform a grayscale processing on the target image to obtain a grayscale image of the target image as a first sub-image.
[0162] A second sub-image unit is configured to perform a filtering processing on the target image using a preset smoothing filter to obtain a filtered image of the target image as a second sub-image.
[0163] In a possible implementation, in the case where the use scenario is multi-illumination, the sub-image module 21 comprises:
[0164] An HSV image unit is configured to convert the target image from an RGB space to an HSV space to obtain an HSV image.
[0165] An HSV channel separation unit is configured to perform a channel separation processing on the HSV image to obtain an H channel image, an S channel image and a V channel image as a first sub-image, a second sub-image and a third sub-image respectively.
[0166] In a possible implementation, the histogram module 22 comprises:
[0167] A first histogram unit is configured to construct a first multi-element array according to the pixel information of the same pixel point in the H channel image and the S channel image, and construct a first multi-dimensional histogram with each pixel information in the first multi-element array and the number of multi-element arrays in the target image as dimensions.
[0168] A second histogram unit is configured to construct a second multi-element array according to the pixel information of the same pixel point in the H channel image and the V channel image, and construct a second multi-dimensional histogram with each pixel information in the second multi-element array and the number of multi-element arrays in the target image as dimensions.
[0169] The initial clustering module 23 comprises:
[0170] A first clustering cluster unit is configured to perform an initial clustering processing on the pixel points in the target image according to the first multi-dimensional histogram to obtain a plurality of first clustering clusters.
[0171] A second clustering cluster unit is configured to perform an initial clustering processing on the pixel points in the target image according to the second multi-dimensional histogram to obtain a plurality of second clustering clusters.
[0172] a clustering unit, configured to fuse the first clustering cluster with a second clustering cluster corresponding to the first clustering cluster, to obtain the clustering cluster.
[0173] In a possible implementation, the initial clustering module 23 comprises:
[0174] a function unit, configured to perform feature transformation on image information corresponding to the pixel points in the clustering cluster by using a preset kernel function, to obtain transformation information.
[0175] a first changing unit, configured to determine the first distance according to transformation information corresponding to the pixel points and the clustering center in the same clustering cluster.
[0176] a second changing unit, configured to determine the second distance according to transformation information corresponding to the clustering centers of different clustering clusters.
[0177] The embodiments of the present specification also provide a computer readable storage medium, which stores computer program instructions. The computer program instructions are executed by a processor to implement the above method. The computer readable storage medium can be a non-volatile computer readable storage medium.
[0178] The embodiments of the present specification also provide an electronic device, which comprises a processor, a memory for storing processor-executable instructions, wherein the processor is configured to invoke the instructions stored in the memory to execute the above method.
[0179] The embodiments of the present specification also provide a computer program product, which comprises computer readable code. When the computer readable code is run on a device, a processor in the device executes instructions for implementing the image segmentation method provided in any of the above embodiments.
[0180] The embodiments of the present specification also provide another computer program product for storing computer readable instructions. The instructions are executed to make a computer perform the operations of the image segmentation method provided in any of the above embodiments.
[0181] The electronic device can be provided as a terminal, a server or other forms of devices.
[0182] Figure 3 A block diagram of an electronic device 800 according to an embodiment of the present specification is shown. For example, the electronic device 800 can be a terminal such as a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0183] Reference Figure 3The electronic device 800 can include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.
[0184] The processing component 802 usually controls overall operations of the electronic device 800, such as operations associated with displaying, making phone calls, data communications, camera operations and recording operations. The processing component 802 can include one or more processors 820 to execute instructions to complete all or part of steps of the methods described above. In addition, the processing component 802 can include one or more modules to facilitate
[0185] The memory 804 is configured to store various types of data to support operations of the electronic device 800. Examples of these data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage devices 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 storage, flash memory, magnetic or optical disk.
[0186] The power supply component 806 provides power for the various components of the electronic device 800. The power supply component 806 can include a power supply management system, one or more power supplies, and other components associated with generating, managing and distributing power for the electronic device 800.
[0187] The multimedia component 808 includes a screen to provide an output interface between the electronic device 800 and a user. In some embodiments, the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense a touch, a slide, and a gesture on the touch panel. The touch sensor can not only sense a boundary of a touching or a sliding action, but also detect duration and pressure related to the touching or sliding action. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.
[0188] The audio component 810 is configured to output and / or input an audio signal. For example, the audio component 810 includes a microphone (MIC) to receive an external audio signal when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 further includes a speaker to output an audio signal.
[0189] The I / O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which can be a keypad, a click wheel, buttons, and the like. The buttons can include, but are not limited to, a home button, a volume button, a start button, and a lock button.
[0190] The sensor component 814 includes one or more sensors to provide various state assessments for the electronic device 800. For example, the sensor component 814 can detect an open / closed state of the electronic device 800, a relative positioning of components, such as a display and a keypad of the electronic device 800, a change in position of the electronic device 800 or a component of the electronic device 800, a presence or absence of user contact with the electronic device 800, a direction or acceleration / deceleration of the electronic device 800, and a change in temperature of the electronic device 800. The sensor component 814 can include a proximity sensor configured to detect presence of a nearby object without any physical touch. The sensor component 814 can further include a light sensor, such as a CMOS or CCD image sensor, for use in an imaging application. In some embodiments, the sensor component 814 can further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0191] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 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 816 further 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.
[0192] In an exemplary embodiment, the electronic device 800 can 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, micro-controllers, microprocessors, or other electronic elements, for performing the above-described methods.
[0193] In an exemplary embodiment, a non-transitory computer-readable storage medium, such as the memory 804 including computer program instructions, is also provided, which can be executed by the processor 820 of the electronic device 800 to complete the above-described methods.
[0194] Figure 4 A block diagram of another electronic device 1900 according to an embodiment of the present specification is shown. For example, the electronic device 1900 can be provided as a server. Referring to Figure 4 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932, for storing instructions executable by the processing component 1922, such as an application program. The application program stored in the memory 1932 can include one or more than one module each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute the instructions to perform the above-described methods.
[0195] The electronic device 1900 can also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 can operate based on an operating system stored in the memory 1932, such as Windows Server TM , Mac OS X TM , UnixTM, Linux TMFreeBSD TM or the like.
[0196] In an example embodiment, there is also provided a non-transitory computer- readable storage medium, such as the memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to implement the above-described method.
[0197] The present specification can be a system, a method, and / or a computer program product. The computer program product can include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present specification.
[0198] The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium can be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium include the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or punched tape, a
[0199] The computer readable program instructions described herein can be downloaded to respective computing / processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and / or a wireless network. The network can comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and / or edge servers. A network adapter card or network interface in each computing / processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing / processing device.
[0200] Computer program instructions used to perform the operations described herein may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing status information from the computer-readable program instructions. This electronic circuitry can execute the computer-readable program instructions to implement various aspects of this specification.
[0201] Various aspects of this specification are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this specification. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0202] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0203] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer, other programmable data processing apparatus, or other device implement the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0204] The flow diagrams and the block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flow diagrams and the block diagrams can represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logic functions. In some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks can sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flow diagrams, and combinations thereof, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and
[0205] The computer program product can be embodied by a hardware, software or a combination thereof. In an optional embodiment, the computer program product is embodied by a computer storage medium. In another optional embodiment, the computer program product is embodied by a software product, such as a software development kit (SDK) or the like.
[0206] The above description has described various embodiments of the present disclosure. The above description is exemplary and not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes are obvious to those skilled in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles, practical application or improvement of technology in the market of the embodiments, or to enable other ordinary skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for image segmentation based on fuzzy clustering, characterized in that, The method comprises the following steps: acquiring a target image and a use scenario of the target image, and performing attribute separation processing on the target image by using a sub-image acquisition mode matched with the use scenario to obtain a plurality of sub-images, the sub-images being the same in size as the target image, including: in the case that the use scenario is multi-illumination, converting the target image from an RGB space to an HSV space to obtain an HSV image; performing channel separation processing on the HSV image to obtain an H channel image, an S channel image and a V channel image as a first sub-image, a second sub-image and a third sub-image respectively; constructing a multi-element array according to pixel information of each of the sub-images at the same pixel point, including: selecting a target sub-image to be dilated from the sub-images, and constructing a one-dimensional histogram by taking pixel information of pixels in the target sub-image as abscissa and taking a number of pixels contained in each of the pixel information as ordinate; performing dilation processing on target pixels corresponding to troughs in the one-dimensional histogram in the target sub-image to obtain a dilated sub-image, the dilation processing being used to make pixels adjacent to the target pixels have the same pixel information as the target pixels; constructing the multi-element array according to the dilated sub-image and the pixel information of each of the sub-images at the same pixel point; constructing a multi-dimensional histogram by taking each of the pixel information in the multi-element array and a number of multi-element arrays in the target image as dimensions, including: constructing a first multi-element array according to pixel information of the H channel image and the S channel image at the same pixel point, and constructing a first multi-dimensional histogram by taking each of the pixel information in the first multi-element array and a number of multi-element arrays in the target image as dimensions; constructing a second multi-element array according to pixel information of the H channel image and the V channel image at the same pixel point, and constructing a second multi-dimensional histogram by taking each of the pixel information in the second multi-element array and a number of multi-element arrays in the target image as dimensions; performing initial clustering processing on pixel points in the target image according to the multi-dimensional histogram to obtain a plurality of clustering clusters, including: performing initial clustering processing on pixel points in the target image according to the first multi-dimensional histogram to obtain a plurality of first clustering clusters; performing initial clustering processing on pixel points in the target image according to the second multi-dimensional histogram to obtain a plurality of second clustering clusters; performing fusion processing on the first clustering clusters and the second clustering clusters corresponding to the first clustering clusters to obtain the clustering clusters; determining a first distance between pixel points in a same one of the clustering clusters and a clustering center and a second distance between clustering centers of different ones of the clustering clusters; determining a target function according to a difference and / or a ratio of the first distance and the second distance, and adjusting pixel points contained in the clustering clusters by minimizing the target function to obtain a segmentation result of the target image according to the adjusted clustering clusters.
2. The fuzzy clustering based image segmentation method according to claim 1, characterized in that, The dilation processing on target pixels corresponding to troughs in the one-dimensional histogram in the target sub-image to obtain a dilated sub-image comprises: In the target sub-image, the target pixel is taken as the center and a preset distance is taken as the radius to determine the corresponding dilated pixel of the target pixel; The pixel information of the target pixel corresponding to the dilated pixel in the target sub-image is taken as the pixel information of the dilated pixel to realize the dilated processing and obtain the dilated sub-image. 3.The fuzzy clustering based image segmentation method according to claim 1, characterized in that, In the case that the use scenario is real-time tracking, the target image is subjected to attribute separation processing using a sub-image acquisition mode matched with the use scenario to obtain multiple sub-images, including: The target image is subjected to grayscale processing to obtain a grayscale image of the target image as a first sub-image; The target image is subjected to filter processing using a preset smoothing filter to obtain a filter image of the target image as a second sub-image.
4. The fuzzy clustering based image segmentation method of claim 1, wherein, The first distance between the pixel points and the cluster center in the same cluster and the second distance between the cluster centers of different clusters are determined, including: The image information corresponding to the pixel points in the cluster is subjected to feature transformation using a preset kernel function to obtain transformation information; The first distance is determined according to the transformation information corresponding to the pixel points and the cluster center in the same cluster; The second distance is determined according to the transformation information corresponding to the cluster centers of different clusters.
5. An image segmentation apparatus based on fuzzy clustering, characterized by, Including: The sub-image module is configured to acquire a target image and a use scenario of the target image, and to subject the target image to attribute separation processing using a sub-image acquisition mode matched with the use scenario to obtain multiple sub-images, the sub-images having the same size as the target image, including: converting the target image from an RGB space to an HSV space to obtain an HSV image; subjecting the HSV image to channel separation processing to obtain an H channel image, an S channel image and a V channel image as a first sub-image, a second sub-image and a third sub-image, respectively; The histogram module is configured to construct a multi-dimensional array according to pixel information of each of the sub-images at the same pixel point, including: selecting a target sub-image to be dilated from the sub-images, and constructing a one-dimensional histogram by taking pixel information of pixels in the target sub-image as abscissa and taking a number of pixels contained in each of the pixel information as ordinate; performing dilation processing on target pixels corresponding to troughs in the one-dimensional histogram in the target sub-image to obtain a dilated sub-image, the dilation processing being configured to make pixels adjacent to the target pixels have the same pixel information as the target pixels; constructing the multi-dimensional array according to the dilated sub-image and the pixel information of each of the sub-images at the same pixel point; and constructing a multi-dimensional histogram by taking each of the pixel information in the multi-dimensional array and a number of multi-dimensional arrays in the target image as dimensions, including: constructing a first multi-dimensional array according to pixel information of the H channel image and the S channel image at the same pixel point, and constructing a first multi-dimensional histogram by taking each of the pixel information in the first multi-dimensional array and a number of multi-dimensional arrays in the target image as dimensions; and constructing a second multi-dimensional array according to pixel information of the H channel image and the V channel image at the same pixel point, and constructing a second multi-dimensional histogram by taking each of the pixel information in the second multi-dimensional array and a number of multi-dimensional arrays in the target image as dimensions. The initial clustering module is configured to perform initial clustering processing on pixel points in the target image according to the multi-dimensional histogram to obtain a plurality of clustering clusters, including: performing initial clustering processing on pixel points in the target image according to the first multi-dimensional histogram to obtain a plurality of first clustering clusters; performing initial clustering processing on pixel points in the target image according to the second multi-dimensional histogram to obtain a plurality of second clustering clusters; fusing the first clustering clusters and second clustering clusters corresponding to the first clustering clusters to obtain the clustering clusters; and determining a first distance between pixel points in a same one of the clustering clusters and a clustering center and a second distance between clustering centers of different ones of the clustering clusters. The segmentation module is configured to determine a target function according to a difference and / or a ratio of the first distance and the second distance, and to adjust pixel points contained in the clustering clusters by minimizing the target function to obtain a segmentation result of the target image according to the adjusted clustering clusters.
6. An electronic device, comprising: The apparatus includes: a processor; a memory configured to store processor-executable instructions; wherein the processor is configured to invoke the instructions stored in the memory to perform the method of any one of claims 1 to 4.
Citation Information
Patent Citations
Image segmentation method based on adaptive feature perception
CN117765008A
A full automatic soft segmentation method of characters in texture background
CN109241973A
Otsu threshold segmentation method based on grey wolf and particle swarm collaborative optimization algorithm
CN116433690A