Image processing method and device, equipment and medium
By iteratively segmenting and clustering the multiple sample points of the image to be processed, the problem of high image processing time complexity in the prior art is solved, and more efficient image processing is achieved.
Patent Information
- Application Number
- CN202311055146.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-21
- Publication Date
- 2025-02-21
AI Technical Summary
In the prior art, the time complexity of image processing is high, resulting in a long execution time.
By determining multiple sample points from the image to be processed, performing an iterative segmentation operation until the number of sample points in each point cluster is less than the preset number, and then clustering the multiple point clusters to obtain the clustering results of the image.
This reduces the time complexity, reduces the clustering time of sample points in the image to be processed, and improves processing efficiency.
Smart Images

Figure CN119494977A_ABST
Abstract
Description
Background Art
[0002] With the development of artificial intelligence technology, replacing the current video surveillance system with a highly autonomous robot vision system has gradually been put on the agenda. However, robots do not have the complex and sophisticated perception and control systems of humans, so designing an actual object recognition algorithm based on visual images has important theoretical basis and practical significance.
[0003] In the related art, there are some basic hierarchical clustering algorithms for image processing, such as the top-down divisive ANAlysis (DIANA) algorithm and the bottom-up condensed agglomerative nesting (AGGES) algorithm, which have high computational time complexity and long execution time for image processing.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The purpose of the present disclosure is to provide an image processing method, apparatus, device and medium, which can at least solve the problem of high time complexity of calculation in related technologies.
[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0007] According to a first aspect of the present disclosure, there is provided an image processing method, the method comprising:
[0008] Determine a plurality of sample points from the acquired image to be processed;
[0009] An iterative segmentation operation is performed on the multiple sample points, wherein the process of one iterative segmentation operation includes: selecting a first sample point from the multiple sample points, determining a second sample point that is farthest from the first sample point; determining a third sample point that is farthest from the second sample point; using the distance between the second sample point and the third sample point as a segmentation diameter, segmenting the multiple sample points to obtain two point clusters after segmentation; the two point clusters after segmentation are centered on the second sample point and the third sample point respectively;
[0010] Repeating the iterative segmentation operation on the two point clusters obtained until the number of sample points in each point cluster among the multiple point clusters obtained by the iterative segmentation operation is less than a preset number, then stopping the segmentation operation to obtain the multiple point clusters that have been segmented;
[0011] Clustering is performed on the multiple point clusters to obtain a clustering result of the image to be processed.
[0012] In a possible embodiment, clustering the multiple point clusters to obtain a clustering result of the image to be processed includes:
[0013] Determine the partition density of each point cluster, and sort the partition density of each point cluster from large to small to obtain a point cluster partition density list;
[0014] According to the point cluster partition density list and the inter-class distance between each point cluster, each point cluster is clustered, and the point clusters whose inter-class distance is less than a preset distance are merged into new point clusters until the point cluster partition density list is empty, thereby obtaining the clustering result of the image to be processed.
[0015] In a possible embodiment, clustering is performed on each point cluster according to the point cluster partition density list and the inter-class distance between each point cluster, and point clusters whose inter-class distance is less than a preset distance are merged into a new point cluster until the point cluster partition density list is empty, thereby obtaining a clustering result of the image to be processed, including:
[0016] The process of a clustering process based on the point cluster partition density list and the inter-class distances between point clusters includes:
[0017] From the point cluster partition density list, select a first target point cluster with the largest partition density, and determine a set of second target point clusters; the set of second target point clusters includes point clusters other than the first target point cluster whose partition density is greater than the median of the partition density;
[0018] Determine whether there is a third target point cluster; the third target point cluster is a second target point cluster whose inter-class distance with the first target point cluster is less than the preset distance;
[0019] If it exists, merge it with the third target point cluster and the first target point cluster to form a new point cluster;
[0020] If it does not exist, the first target point cluster is used as a new point cluster;
[0021] The point cluster partition density list is updated to obtain an updated point cluster partition density list; wherein the updated point cluster partition density list does not include new point clusters obtained by clustering processing;
[0022] The clustering process is repeated according to the updated point cluster partition density list until the updated point cluster partition density list is empty, thereby obtaining a clustering result of the image to be processed.
[0023] In a possible embodiment, clustering the multiple point clusters to obtain a clustering result of the image to be processed includes:
[0024] Determine the minimum spanning tree and edge set standard deviation of each point cluster; the edge set standard deviation is the standard deviation of the edge weight values corresponding to the edges included in the minimum spanning tree;
[0025] According to the standard deviation of the edge set of each point cluster, the plurality of point clusters are divided into a set of first sample point uniform point clusters and a set of sample point non-uniform point clusters;
[0026] According to the set of sample point inhomogeneous point clusters, each sample point inhomogeneous point cluster is segmented according to the edge weight value and point density of each sample point inhomogeneous point cluster to obtain a set of second sample point uniform point clusters; wherein the point density is the density of each sample point in the plurality of sample points included in the sample point inhomogeneous point cluster;
[0027] The sample point uniform point clusters are clustered to obtain a clustering result of the image to be processed; the sample point uniform point clusters include the first sample point uniform point cluster and the second sample point uniform point cluster.
[0028] In a possible embodiment, dividing the multiple point clusters into a set of first sample point uniform point clusters and a set of sample point non-uniform point clusters according to the edge set standard deviation of each point cluster includes:
[0029] The judgment process for any point cluster includes:
[0030] If the edge set standard deviation of any point cluster is greater than the median of the edge set standard deviation, then the any point cluster is regarded as an uneven point cluster of sample points;
[0031] If the edge set standard deviation of any one of the point clusters is less than the median of the edge set standard deviation, the any one of the point clusters is used as a uniform point cluster of sample points;
[0032] Each of the point clusters is judged to obtain a set of uniform point clusters of the first sample points and a set of non-uniform point clusters of the sample points.
[0033] In a possible embodiment, the process of determining the point density of the non-uniform point cluster of sample points includes:
[0034] For any sample point inhomogeneous point cluster, determine k nearest neighbors between sample points in the any sample point inhomogeneous point cluster;
[0035] For any sample point in the inhomogeneous point cluster of any sample point, determine the sum of distances between the any sample point and k nearest neighbors corresponding to the any sample point to obtain a sum of k nearest neighbor distances;
[0036] The reciprocal of the sum of the k nearest neighbor distances is used as the point density of any sample point;
[0037] The point density of the non-uniform point cluster of each sample point is determined.
[0038] In a possible embodiment, the step of segmenting each sample point uneven point cluster according to the edge weight value and point density of each sample point uneven point cluster in the set of sample point uneven point clusters to obtain a set of second sample point uniform point clusters includes:
[0039] The segmentation operation for any sample point inhomogeneous point cluster includes:
[0040] Determine an edge weight average value according to the edge weight values in any one of the sample point uneven point clusters;
[0041] Determine whether there is a target edge; the absolute value of the difference between the edge weight value of the target edge and the edge weight average value is greater than a preset weight value;
[0042] If the target edge exists, segmenting the any one sample point uneven point cluster based on the target edge to obtain at least two second sample point even point clusters;
[0043] The segmentation operation is performed on each of the non-uniform point clusters of the sample points to obtain a set of the second uniform point clusters of the sample points.
[0044] In a possible embodiment, the method further includes:
[0045] If the target edge does not exist, dividing the sample points in the any one sample point uneven point cluster into dense area points and sparse area points according to the point density median of the any one sample point uneven point cluster and the point density;
[0046] According to the dense region points and the sparse region points, the any one sample point non-uniform point cluster is segmented to obtain at least two of the second sample point uniform point clusters.
[0047] According to another aspect of the present disclosure, there is provided an image processing apparatus, comprising:
[0048] An acquisition unit, used for determining a plurality of sample points from the acquired image to be processed;
[0049] A segmentation unit, configured to perform an iterative segmentation operation on the plurality of sample points, wherein the process of one iterative segmentation operation comprises: selecting a first sample point from the plurality of sample points, determining a second sample point that is farthest from the first sample point; determining a third sample point that is farthest from the second sample point; using the distance between the second sample point and the third sample point as a segmentation diameter, segmenting the plurality of sample points to obtain two segmented point clusters; the two segmented point clusters are centered on the second sample point and the third sample point respectively;
[0050] The segmentation unit is further configured to repeatedly perform the iterative segmentation operation on the two obtained point clusters until the number of sample points in each point cluster among the multiple point clusters obtained by the iterative segmentation operation is less than a preset number, then stop the segmentation operation, and obtain the multiple point clusters that have been segmented;
[0051] The clustering processing unit is used to perform clustering processing on the multiple point clusters to obtain a clustering result of the image to be processed.
[0052] According to another aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the above method by executing the executable instructions.
[0053] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented.
[0054] The embodiment of the present disclosure provides an image processing method, device, equipment and medium, the method comprising: determining multiple sample points from an acquired image to be processed; performing an iterative segmentation operation on the multiple sample points, wherein the process of one iterative segmentation operation comprises: selecting a first sample point from the multiple sample points, determining a second sample point with the farthest distance from the first sample point; determining a third sample point with the farthest distance from the second sample point; using the distance between the second sample point and the third sample point as the segmentation diameter, segmenting the multiple sample points to obtain two point clusters after segmentation; repeatedly performing the iterative segmentation operation on the obtained two point clusters until the number of sample points in each point cluster in the multiple point clusters obtained by the iterative segmentation operation is less than a preset number, then stopping the segmentation operation to obtain multiple point clusters after segmentation; performing clustering processing on the multiple point clusters to obtain a clustering result of the image to be processed. Through the segmentation method for sample points in the present disclosure, the time complexity can be reduced, the clustering time of sample points in the image to be processed can be reduced, and the efficiency can be improved.
[0055] 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
[0056] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0057] Figure 1 A schematic diagram showing a clustering process of an agglomerative nested algorithm in an embodiment of the present disclosure;
[0058] Figure 2 A schematic diagram showing a clustering process of a partition analysis algorithm in an embodiment of the present disclosure;
[0059] Figure 3 A flowchart of an image processing method according to an embodiment of the present disclosure is shown;
[0060] Figure 4 A schematic diagram showing a real scene picture in an embodiment of the present disclosure;
[0061] Figure 5 A schematic diagram of segmenting point clusters in an embodiment of the present disclosure is shown;
[0062] Figure 6 One of the flow charts showing a clustering process of an image to be processed in an embodiment of the present disclosure;
[0063] Figure 7 A second flowchart showing a clustering process of an image to be processed in an embodiment of the present disclosure is shown;
[0064] Figure 8 A schematic diagram showing a uniform point cluster of sample points in an embodiment of the present disclosure is shown;
[0065] Fig. 9 One of the schematic diagrams showing an uneven point cluster of sample points in an embodiment of the present disclosure;
[0066] Fig.10 A second schematic diagram showing an uneven point cluster of sample points in an embodiment of the present disclosure;
[0067] Fig.11 A third schematic diagram showing an uneven point cluster of sample points in an embodiment of the present disclosure;
[0068] Fig.12 A fourth schematic diagram showing an uneven point cluster of sample points in an embodiment of the present disclosure;
[0069] Fig.13 A flowchart of an image processing method according to an embodiment of the present disclosure is shown;
[0070] Fig.14 A schematic diagram showing a sample point clustering process in an embodiment of the present disclosure is shown;
[0071] Fig.15 A schematic diagram showing a group of clustering results in an embodiment of the present disclosure;
[0072] Fig.16 A schematic diagram showing the structure of an image processing device according to an embodiment of the present disclosure is shown;
[0073] Fig.17 A schematic structural diagram of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0074] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0075] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0076] In the related art, there are some basic hierarchical clustering algorithms for processing images, for example, a top-down divisive ANAlysis (DIANA) algorithm and a bottom-up agglomerative nesting (AGGES) algorithm.
[0077] The following is a detailed explanation. The AGNES algorithm repeatedly merges the most similar data objects until the user-defined number of clusters or a user-defined clustering termination condition is reached. The clustering process is as follows: Figure 1 As shown in the figure. Taking a data set with 7 points as an example, the distance between all points is calculated in the initial stage, and then the two closest (most similar) points are selected for merging, namely sample points P5 and P6. Then, one of the three inter-class similarity measurement methods mentioned above is used to continue merging, and finally a hierarchical clustering tree is formed.
[0078] The DIANA algorithm is opposite to the AGNES algorithm. The DIANA algorithm first considers all points as one class, then finds the two points with the largest distance in the cluster, that is, the two points with the largest average dissimilarity, and assigns the remaining points to them according to the nearest neighbor assignment principle to form two clusters. This process is repeated until the number of clusters specified by the user is reached. Figure 2 The specific process is shown in the figure, and no further description is given.
[0079] Whether it is the bottom-up condensed AGNES algorithm or the top-down split DIANA algorithm, the algorithm time complexity is O(kdn 2 ), where k represents the algorithm iteration round, d is the dimension of the data set, and n is the number of sample points contained in the data set. The high time complexity of the calculation can be understood as n 2 , the execution time of image processing is long.
[0080] Based on this consideration, the present disclosure provides an image processing method, which includes: performing an iterative segmentation operation on multiple sample points of an image to be processed, the process of one iterative segmentation operation is: selecting a first sample point from multiple sample points, determining a second sample point that is farthest from the first sample point, determining a third sample point that is farthest from the second sample point, using the distance between the second sample point and the third sample point as a segmentation diameter, segmenting the multiple sample points to obtain two point clusters after segmentation, iteratively segmenting in this manner until the number of sample points in each point cluster is less than a preset number and the segmentation is completed, clustering the multiple point clusters to obtain a clustering result of the image to be processed. The above method can reduce the time complexity for the segmentation method of sample points, reduce the clustering time of sample points in the image to be processed, and improve efficiency.
[0081] In the following, each step of the image processing method in this example implementation will be described in more detail with reference to the accompanying drawings and embodiments.
[0082] In a possible embodiment, the execution subject may be any electronic device. In the following embodiment, the electronic device is taken as a robot processor as an example. Figure 3 A schematic flow chart of an image processing method is shown, which may specifically include the following steps:
[0083] S302: Determine a plurality of sample points from the acquired image to be processed.
[0084] In a possible embodiment, any image can be used as an image to be processed, and multiple sample points in the image can be obtained as a sample data set to be processed. From the multiple sample points determined in the image to be processed, it can be initially considered that the multiple sample points belong to the same point cluster.
[0085] For example, taking an actual scenario as an example, suppose a robot is used to take photos of a section of a library road, simulating the perspective of a robot standing in the middle of the road of the library's outer loop and facing the front, and collecting image information containing section information, i.e., roads, buildings, trees, etc. By distinguishing the pixel data of the photo, the section information is identified to guide the robot to move along the road. By actually traveling around the loop, 35 photos that meet the above requirements are taken, and one image is selected as the image to be processed in this disclosure, such as Figure 4 As shown, it should be understood that the original image is a color image.
[0086] Figure 4 The main notable features in the photos include five categories: trees and grass, road surface, shadows, buildings, steps and other obstacles.
[0087] S304: performing an iterative segmentation operation on the multiple sample points, wherein the process of one iterative segmentation operation includes: selecting a first sample point from the multiple sample points, determining a second sample point that is farthest from the first sample point, determining a third sample point that is farthest from the second sample point, using the distance between the second sample point and the third sample point as a segmentation diameter, segmenting the multiple sample points, and obtaining two point clusters after segmentation.
[0088] The two point clusters after segmentation are centered on the second sample point and the third sample point respectively.
[0089] In a possible embodiment, segmentation is performed on multiple sample points through an iterative segmentation method. Segmentation is performed once on sample points of the same point cluster to obtain two point clusters, and then the sample points in the two point clusters are segmented in the same manner.
[0090] An example process of performing an iterative segmentation operation is shown by taking the initial multiple sample points belonging to the same point cluster as an example.
[0091] For example, an iterative segmentation operation for sample points of the same point cluster can be performed as follows: Figure 5 As shown: the first sample point is randomly selected from multiple sample points in a point cluster A, that is, Figure 5 Point 1 in the , determine the second sample point farthest from the first sample point, that is Figure 5 Point 2 in the graph, the distance between point 1 and point 2 is a, and then determine the third sample point that is farthest from the second sample point, that is, Figure 5 From point 3 in cluster A, we can get the approximate maximum diameter in cluster A, which is the distance b between the second sample point and the third sample point.
[0092] After determining the two center points of the two point clusters after segmentation and obtaining point 2 and point 3, the sample points in the above point cluster A are assigned to point 2 and point 3 through the nearest neighbor principle, and the two point clusters after segmentation are obtained.
[0093] After one point cluster is divided into two point clusters in the above steps, S306 is executed.
[0094] S306: Repeat the iterative segmentation operation on the two obtained point clusters until the number of sample points in each point cluster among the multiple point clusters obtained by the iterative segmentation operation is less than a preset number, then stop the segmentation operation to obtain multiple segmented point clusters.
[0095] In a possible embodiment, the two point clusters obtained above are further segmented in the manner of step S304, and a segmentation stop condition with a preset number as a threshold is pre-set to obtain a plurality of segmented point clusters.
[0096] For example, in order to minimize the time complexity of the calculation process, the preset number can be set to Among them, n represents the number of initial sample points of the point cluster when the iterative segmentation operation is performed.
[0097] S308: performing clustering processing on the multiple point clusters to obtain a clustering result of the image to be processed.
[0098] In a possible embodiment, after obtaining multiple point clusters, each of the above multiple point clusters can be regarded as a class. The traditional agglomerative hierarchical clustering algorithm can be used to find the two classes with the largest inter-class similarity through the inter-class distance measurement during the merging process to merge and obtain the clustering result of the image to be processed.
[0099] After obtaining the clustering results, we can Figure 4 Distinguish between several categories of obstacles, determine the differences between each category of obstacles, and the distribution location of each obstacle.
[0100] Through the above method, the time complexity of the calculation in the clustering process of the processing process of the image to be processed in the present disclosure is reduced from O(n 2 ) becomes O(2n), the execution time is shortened, the efficiency is higher, and the processing speed is faster.
[0101] In a possible embodiment, the concept of partition density of point clusters can be introduced to coordinate with each point cluster to measure whether two point clusters should be merged. Specifically, multiple point clusters can be clustered in the following manner, such as Figure 6 As shown, the following steps are included:
[0102] S602: Determine the partition density of each point cluster, and sort the partition density of each point cluster from large to small to obtain a point cluster partition density list.
[0103] In a possible embodiment, after the concept of partition density is introduced, each point cluster is sorted according to the size of the partition density, so as to facilitate judging whether the point clusters belong to a category and merging them in order.
[0104] S604: Perform clustering processing on each point cluster according to the point cluster partition density list and the inter-class distance between each point cluster, merge the point clusters whose inter-class distance is less than the preset distance into new point clusters, until the point cluster partition density list is empty, and obtain the clustering result of the image to be processed.
[0105] In a possible embodiment, the distance between point clusters can be calculated by any one of the following formulas:
[0106] dist min (C1,C2)=min pi∈C1,pj∈C2 dist(pi,pj)
[0107] dist max (C1,C2)=max pi∈C1,pj∈C2 dist(pi,pj)
[0108]
[0109] Among them, C1 and C2 represent two point clusters for inter-class distance calculation; pi is the i-th sample point in partition C1; pj is the j-th sample point in partition C2. The above three formulas are commonly used formulas for calculating inter-class distance, and no redundant description is given.
[0110] In a possible embodiment, each point cluster in the partition density list can be clustered in the following manner: from the point cluster partition density list, select the first target point cluster with the largest partition density, and determine the set of second target point clusters; the set of second target point clusters includes point clusters other than the first target point cluster whose partition density is greater than the median of the partition density; determine whether there is a third target point cluster; the third target point cluster is a second target point cluster whose inter-class distance with the first target point cluster is less than a preset distance; if it exists, merge it with the third target point cluster and the first target point cluster into a new point cluster; if it does not exist, take the first target point cluster as the new point cluster; update the point cluster partition density list to obtain an updated point cluster partition density list; wherein the updated point cluster partition density list does not include the new point cluster obtained by clustering processing; repeat the clustering processing according to the updated point cluster partition density list until the updated point cluster partition density list is empty, and obtain the clustering result of the image to be processed.
[0111] The above method can be understood as: starting from the first target point cluster with the largest partition density, it and all second target point clusters with partition densities greater than the median of the partition density are regarded as partitions with similar density, and the inter-class distance between the second target point cluster and the first target point cluster is calculated. The inter-class distance can be calculated using the above three inter-class distance formulas.
[0112] If the calculated inter-class distances between all second target point clusters and the first target point cluster do not meet the conditions, that is, they do not match the inter-class distances between the first target point clusters, the first target point cluster will be treated as a new point cluster and form a new cluster by itself.
[0113] If the inter-class distance calculated between the second target point cluster and the first target point cluster meets the conditions, the two point clusters are merged into the same new point cluster, and the partition density of the new point cluster is recalculated. The inter-class distance is calculated with the second target point cluster using the new partition density, and the merging continues until all the second target point clusters that meet the conditions are merged with the first target point cluster to obtain a cluster.
[0114] The cluster obtained after merging based on the first target point cluster is deleted from the partition list, and the above process is repeated to continue clustering until the point cluster partition density list is empty.
[0115] In the present disclosure, in the process of processing the image to be processed and in the process of clustering the sample points, the conditions for stopping clustering can be automatically formed without manual setting. In order to prevent the algorithm from over-splitting or over-merging the sample points, it is necessary to manually specify the clustering termination conditions and the final number of clusters. However, the manually set clustering termination conditions are anyway set based on human subjective experience, and are not adaptive clustering termination conditions that are achieved based on the characteristics of the point clusters formed by the sample points themselves. The method in the present disclosure has higher accuracy and is more intelligent for the clustering process of sample points.
[0116] In a possible embodiment, after the multiple sample points of the image to be processed are segmented to obtain multiple point clusters, the multiple point clusters are clustered in S308 to obtain a clustering result of the image to be processed. Figure 7 is processed in this way.
[0117] Figure 7 A flow chart of the clustering process of the image to be processed is shown in FIG. Figure 7 As shown, the following steps are included:
[0118] S702: Determine the minimum spanning tree and edge set standard deviation of each point cluster.
[0119] The edge set standard deviation is the standard deviation of the edge weight values corresponding to the edges included in the minimum spanning tree.
[0120] In a possible embodiment, a minimum spanning tree is calculated for each point cluster obtained, and the standard deviation of the edge set of the point cluster is obtained based on the minimum spanning tree.
[0121] Since a preset number is set as the threshold when dividing the point clusters, the size of each point cluster obtained in the end is comparable, and there will not be a situation where the number of sample points in two point clusters is very different (unless the partition is composed of outliers alone). In other words, there is no situation where the standard deviations of the edge sets of two minimum spanning trees are similar because the number of edges in the minimum spanning tree of a relatively uneven point cluster is much larger than the number of edges in the minimum spanning tree of another relatively even partition.
[0122] Therefore, the edge set standard deviation can be used to assist in screening out clusters with relatively uneven partition density. The theoretical basis for using the edge set standard deviation as a criterion for judging whether the partition density of a point cluster is uniform in the present disclosure is that the goal of clustering is to make the intra-class similarity of the point cluster as large as possible and the inter-class similarity of the point cluster as small as possible, that is, the distances between sample points in a certain point cluster should be similar. Therefore, the smaller the value of the edge set standard deviation, the more balanced the weight of each edge of the minimum spanning tree in the point cluster is in the entire minimum spanning tree. The weight of the edge can be expressed by the length of the edge in the present disclosure. That is, the density of the point cluster is relatively uniform.
[0123] Figure 8 An example of a point cluster with uniform density is shown. Figure 8 It can be seen that the length of each edge is the same, which is 7, and the standard deviation of the edge set is very small.
[0124] Fig. 9 An example of a point cluster with uneven density is shown. Fig. 9 It can be seen that the lengths of the edges are 3, 7, and 13, respectively. The gap between the minimum and maximum edge lengths is relatively large, and the value of the edge set standard deviation is relatively large.
[0125] S704: Divide the multiple point clusters into a set of first sample point uniform point clusters and a set of sample point non-uniform point clusters according to the edge set standard deviation of each point cluster.
[0126] In a possible embodiment, a method for judging whether any point cluster is an inhomogeneous point cluster of sample points or a uniform point cluster of sample points can be as follows: if the edge set standard deviation of any point cluster is greater than the median of the edge set standard deviation, then any point cluster is regarded as an inhomogeneous point cluster of sample points; if the edge set standard deviation of any point cluster is less than the median of the edge set standard deviation, then any point cluster is regarded as a uniform point cluster of sample points; each point cluster is judged to obtain a set of uniform point clusters of the first sample points and a set of inhomogeneous point clusters of sample points.
[0127] In a possible embodiment, the uneven distribution of sample points in several point clusters that may be obtained after segmentation can be shown as follows:
[0128] (1) Two dense regions connected by a long edge, such as Fig.10 In the minimum spanning tree of this type of partition, the edge connecting two points belonging to different dense areas in the point cluster is significantly longer than the other edges in the minimum spanning tree edge set.
[0129] (2) Two sparse regions connected by a short edge, such as Fig.11 As shown, the length of the shortest edge is 10, and the length of the edges in the other two sparse areas is 50. In the minimum spanning tree of this type of point cluster, the edge connecting two points in different sparse clusters in the sample point set is significantly shorter than other edges in the minimum spanning tree edge set.
[0130] (3) Two dense areas and a sparse area connected by a long edge or a short edge, such as Fig.12 This type of point cluster is composed of a mixture of points in dense clusters and points in sparse clusters in the sample point set. Therefore, the number of long edges and short edges in the edge set of the minimum spanning tree of this type of point cluster is equal.
[0131] Further analysis shows that there may be two situations:
[0132] (1) For the case of two sparse areas connected by a long edge. Due to the nearest neighbor assignment principle adopted in the segmentation operation, this situation will not occur. This situation can also be regarded as a point cluster with relatively uniform density.
[0133] (2) Two dense areas connected by a short edge. This is a point cluster with uniform density, because when two dense areas are close to each other, their inter-class similarity is equal to their intra-class similarity, so it can be regarded as a point cluster with uniform point distribution.
[0134] These two situations can be regarded as the situation where the partition density of the point cluster is relatively uniform, that is, they can be classified as the uniform point cluster of the first sample point.
[0135] After the sample point non-uniform point cluster and the first sample point uniform point cluster are determined in the above manner, S706 is executed.
[0136] S706: According to the set of sample point inhomogeneous point clusters, each sample point inhomogeneous point cluster is segmented according to the edge weight value and point density of each sample point inhomogeneous point cluster to obtain a set of second sample point uniform point clusters.
[0137] The point density is the density of each sample point in the plurality of sample points included in the sample point inhomogeneous point cluster.
[0138] In a possible embodiment, uniform point clusters of sample points do not need to be processed any further, while non-uniform point clusters of sample points need to be processed further.
[0139] For the above three cases of uneven clusters of sample points, in cases (1) and (2), it is necessary to re-segment the uneven clusters of sample points based on the weight of each edge in the edge set, that is, the edge length.
[0140] Exemplarily, according to the edge weight value in any sample point uneven point cluster, the edge weight average value is determined to determine whether there is a target edge, wherein the absolute value of the difference between the edge weight value of the target edge and the edge weight average value is greater than a preset weight value; if there is a target edge, then based on the target edge, any sample point uneven point cluster is segmented to obtain at least two second sample point uniform point clusters, and the segmentation operation is performed on each sample point uneven point cluster to obtain a set of second sample point uniform point clusters.
[0141] It can be understood that after determining the average edge weight, if the absolute value of the difference between the weight of a certain edge in the edge set of the point cluster and the average edge weight is greater than the preset weight value, for example, the weight of a certain edge is much greater than the average edge weight, or the weight of a certain edge is much smaller than the average edge weight, then it means that the point cluster is one of the above cases (1) or (2), then the point cluster can be split twice according to the two sample points that constitute the target edge as endpoints.
[0142] Example 1: If the weight of a certain edge is much greater than the average edge weight, then this uneven cluster of sample points can be regarded as case (1). By directly using the two sample points of the edge with the largest weight in the edge set as endpoints, the uneven cluster of sample points can be split to obtain two second uniform clusters of sample points.
[0143] Example 2: Similar to Example 1, if there is an edge in a certain point cluster whose weight is much smaller than the average edge weight, then this uneven point cluster of sample points can be regarded as case (2). The uneven point cluster of sample points can be directly divided according to the two sample points of the edge with the smallest weight in the edge set as endpoints to obtain two second uniform point clusters of sample points.
[0144] For the above two cases, it is only necessary to disconnect the corresponding long edges and short edges to complete the secondary segmentation of the point cluster.
[0145] For case (3), after determining whether there is a target edge, if there is no target edge, the sample points in any sample point uneven point cluster are divided into dense area points and sparse area points according to the point density median and point density of any sample point uneven point cluster. According to the dense area points and sparse area points, any sample point uneven point cluster is segmented to obtain at least two second sample point uniform point clusters.
[0146] It is necessary to introduce the concept of point density to assist in segmenting point clusters. The point density is determined as follows:
[0147] Exemplarily, for any non-uniform point cluster of sample points, the k nearest neighbors between the sample points in the non-uniform point cluster of sample points are determined; for any sample point in the non-uniform point cluster of sample points, the sum of the distances between any sample point and the k nearest neighbors corresponding to the any sample point is determined to obtain the sum of the k nearest neighbor distances; the inverse of the sum of the k nearest neighbor distances is used as the point density of any sample point to determine the point density of each non-uniform point cluster of sample points.
[0148] Exemplarily, the point density may also be determined according to the following formula:
[0149]
[0150] Among them, p i represents the point density of the i-th sample point; k represents the number of neighbors of sample point i; C i’ represents the uneven point cluster of the i'th sample point; dist(i,j) represents the distance between sample point i and sample point j; j is C i’ The sample points in .
[0151] The point density of sample point i is determined by the above formula. After the point density is determined, the points in the point cluster whose point density is greater than the median of the point density can be classified as dense areas, and the points whose point density is less than the median of the point density can be classified as sparse areas.
[0152] It should be noted that the present disclosure may introduce the concept of point density to perform secondary segmentation on the point clusters only for the sample point inhomogeneous point clusters in case (3). It is not necessary to solve the point density for all the sample point inhomogeneous point clusters, and the calculation method is simpler.
[0153] The original uneven point cluster of sample points is divided into dense area and sparse area by point density, so as to perform secondary segmentation on the uneven point cluster of sample points and obtain the second uniform point cluster of sample points.
[0154] Through the above-mentioned secondary segmentation process of the non-uniform point clusters of sample points for cases (1) to (3), a plurality of second uniform point clusters of sample points can be obtained.
[0155] Through the secondary segmentation of the non-uniform point clusters of sample points in the present disclosure, the obtained multiple point clusters can all belong to the uniform point clusters of sample points, thereby improving the accuracy of the clustering process.
[0156] Moreover, the algorithms in the related art segment the sample points in a one-time segmentation manner. However, due to various reasons, errors are inevitable in the process of segmenting the sample points using the algorithms. However, the algorithms in the related art cannot segment the sample points a second time. Regardless of whether the segmentation is right or wrong, and regardless of the result, a sample point can only be segmented once. Even if an error occurs, it cannot be segmented again to correct the error.
[0157] However, the method disclosed in the present invention provides two segmentation processes in total during the clustering process. When the sample points are segmented for the first time, the sample points that may have problems are segmented for the second time, which can improve the accuracy of the clustering process.
[0158] S708: Perform clustering processing on the uniform point clusters of the sample points to obtain a clustering result of the image to be processed.
[0159] The sample point uniform point cluster includes a first sample point uniform point cluster and a second sample point uniform point cluster.
[0160] In a possible embodiment, after obtaining the uniform point cluster of the sample points, the Figure 6 ,as well as Figure 6 In the embodiment of the step in the embodiment, clustering processing is performed on the uniform point clusters of the sample points.
[0161] It should be noted that in the segmentation process, if after a certain point cluster is segmented, one of the two new point clusters contains far more sample points than the other, the points in the new partition with fewer points will be regarded as outliers and added to the outlier point set.
[0162] The algorithm finally treats all outliers obtained in the segmentation process as a separate cluster. The theoretical basis for identifying outliers in this way is that the algorithm uses the nearest neighbor assignment principle in the segmentation process. Since outliers significantly deviate from the normal sample points in the data set, when the point cluster is segmented, if the point cluster contains outliers, then the outliers are often used as the endpoints of the current point cluster diameter. Therefore, the minimum spanning tree must have a long edge connecting the outliers and normal points in the current partition, which belongs to the case of uneven sample point clusters (1). Then, after the point cluster is split twice by disconnecting the long edges, the global outliers in the sample points can be separated.
[0163] In a possible embodiment, the present disclosure provides a flowchart of an image processing method, such as Fig.13 As shown, the following steps are included:
[0164] S1302: Determine a plurality of sample points from the acquired image to be processed.
[0165] S1304: Select a first sample point from a plurality of sample points belonging to the same point cluster, and determine a second sample point that is farthest from the first sample point.
[0166] S1306: Determine a third sample point that is farthest from the second sample point.
[0167] S1308: Using the distance between the second sample point and the third sample point as the segmentation diameter, segmenting the multiple sample points to obtain two segmented point clusters, wherein the two segmented point clusters are centered on the second sample point and the third sample point, respectively.
[0168] S1310: Determine whether the number of sample points in the point cluster obtained after segmentation is less than a preset number; if so, execute S1312; if not, return to execute S1304.
[0169] S1312: Determine the minimum spanning tree and edge set standard deviation of each point cluster.
[0170] S1314: Determine whether the edge set standard deviation of the point cluster is greater than the median of the edge set standard deviation; if not, execute S1316; if so, execute S1318.
[0171] S1316: Determine that the point cluster is a first sample point uniform point cluster.
[0172] S1318: Determine that the point cluster is an inhomogeneous point cluster of sample points.
[0173] S1320: Determine an average edge weight value according to the edge weight values in the uneven point cluster of sample points.
[0174] S1322: Determine whether the target edge exists; if so, execute S1324; if not, execute S1326.
[0175] S1324: Segment the non-uniform point cluster of sample points based on the target edge to obtain at least two second uniform point clusters of sample points.
[0176] S1326: Divide the sample points in the sample point inhomogeneous point cluster into dense area points and sparse area points according to the point density median and the point density of the sample point inhomogeneous point cluster.
[0177] S1328: Segment the non-uniform point clusters of sample points according to the dense region points and the sparse region points to obtain at least two second uniform point clusters of sample points.
[0178] S1330: Taking the first sample point uniform point cluster and the second sample point uniform point cluster as sample point uniform point clusters, as a set of sample point uniform point clusters.
[0179] S1332: Determine the partition density of each sample point uniform point cluster, and sort the partition density of each sample point uniform point cluster from large to small to obtain a point cluster partition density list.
[0180] S1334: Perform clustering on each point cluster according to the point cluster partition density list and the inter-class distance between each point cluster. Starting from the point cluster with the largest partition density, point clusters with inter-class distances less than a preset distance are merged into new point clusters in sequence until the point cluster partition density list is empty, thereby obtaining the clustering result of the image to be processed.
[0181] The above method provided by the embodiment of the present disclosure can not only reduce the time complexity of calculation; in the process of algorithm clustering, compared with the single irreversibility of the algorithm clustering process in the related art, that is, once a sample point is divided, the division result cannot be modified regardless of whether it is correct or not, and after the method in the present disclosure divides the sample point once, there can be a second division to correct the uneven point clusters of the sample points that are not divided accurately; and the method provided by the embodiment of the present disclosure can also adaptively form clustering termination conditions, and the clustering termination conditions are very consistent with each clustering process. Clustering termination must be the process of clustering completion. Compared with the method of artificially giving clustering termination conditions in the related art, its clustering termination conditions are unclear and overly dependent on manual experience.
[0182] It should be noted that the method disclosed in the present invention can be used not only in image processing, but also in any process that requires clustering.
[0183] Fig.14 A schematic diagram of a clustering process in an embodiment of the present disclosure is shown; Fig.14 As shown, take any number of sample points as an example, Fig.14 a in the figure shows the initial state of the sample point; Fig.14 The b in the figure shows the uniform point clusters of all sample points obtained after the second segmentation; Fig.14 The c in the figure shows the process of merging point clusters according to the partition density and inter-class distance; Fig.14 The d in FIG. 4 shows that after the clustering process is completed, the final point clusters are merged, and finally there are two point clusters, that is, two different clusters.
[0184] In one possible embodiment, Figure 4Take the image to be processed as an example, through the method of the present disclosure, the DIANA algorithm, the AGNES algorithm, the Balanced Iterative Reducing and Clustering Using Hierarchies (BIRCH) algorithm, the Chameleon algorithm and the Hierarchical Density-Based Spatial Clustering of Applications with Noise (HDBSCAN) algorithm in the related art. Figure 4 Processing is performed to obtain clustering results and compare the effects.
[0185] Fig.15 A schematic diagram showing a group of clustering results provided by an embodiment of the present disclosure is shown; Fig.15 As shown, Fig.15 A in the figure shows a clustering result diagram obtained by the method provided in the embodiment of the present disclosure;
[0186] Fig.15 The clustering result diagram obtained by the DIANA algorithm is shown in b; Fig.15 The clustering result diagram obtained by the AGNES algorithm is shown in c; Fig.15 The clustering result diagram obtained by the BIRCH algorithm is shown in d; Fig.15 Figure e shows the clustering result obtained by the Chameleon algorithm; Fig.15 FIG. 5 shows the clustering result obtained by the HDBSCAN algorithm. FIG.
[0187] By comparison, it can be seen that the method provided in the present disclosure accurately identifies the trash can, steps, road surface, and the path on the left. The description of the tree shadows is also very detailed and the identification of the trees is also relatively accurate. The only shortcoming is that some steps and buildings on the left are identified as trees.
[0188] The DIANA algorithm failed to correctly identify trash cans, tree shadows and trees, and the recognition of steps was not complete. Only the road surface recognition effect was good.
[0189] The AGNES algorithm correctly identified the road surface and the trash can, and the trees were also well identified. However, it also identified some steps and buildings on the left as trees, and its effect on dividing tree shadows and steps was average.
[0190] The BIRCH algorithm has good recognition effects on roads and trees, but the segmentation effects of other objects are not ideal.
[0191] The Chameleon algorithm has average recognition results for trash cans and steps, but is better at describing tree shadows. It fails to recognize the path on the left and identifies some buildings on the right as trees.
[0192] The DBSCAN algorithm had a serious chain phenomenon and failed to divide the photos correctly, resulting in very poor clustering effect.
[0193] However, due to lighting reasons, the above methods all failed to successfully identify the manhole cover.
[0194] pass Fig.15 It can be seen that the clustering result graph of the method provided by the embodiment of the present disclosure has the best effect, and the DBSCAN algorithm has the worst effect.
[0195] Based on the same inventive concept as the above method embodiment, the embodiment of the present application also provides an image processing device. Fig.16 A schematic structural diagram of an image processing device provided in an embodiment of the present application is shown.
[0196] The image processing device, such as Fig.16 As shown, the same-screen interactive device 1600 includes: an acquisition unit 1601, which is used to determine multiple sample points from the acquired image to be processed; a segmentation unit 1602, which is used to perform an iterative segmentation operation on the multiple sample points, wherein the process of one iterative segmentation operation includes: selecting a first sample point from the multiple sample points, determining a second sample point that is farthest from the first sample point; determining a third sample point that is farthest from the second sample point; using the distance between the second sample point and the third sample point as the segmentation diameter, segmenting the multiple sample points to obtain two point clusters after segmentation; the two point clusters after segmentation are centered on the second sample point and the third sample point respectively; the segmentation unit 1602 is also used to repeatedly perform the iterative segmentation operation on the two obtained point clusters until the number of sample points in each point cluster in the multiple point clusters obtained by the iterative segmentation operation is less than a preset number, then stop the segmentation operation, and obtain multiple point clusters after segmentation; a clustering processing unit 1603, which is used to perform clustering processing on the multiple point clusters to obtain a clustering result of the image to be processed.
[0197] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0198] Refer to the following Fig.17 1700 according to this embodiment of the present invention will be described. Fig.17The electronic device 1700 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0199] like Fig.17 As shown, the electronic device 1700 is in the form of a general computing device. The components of the electronic device 1700 may include but are not limited to: at least one processing unit 1710, at least one storage unit 1720, and a bus 1730 connecting different system components (including the storage unit 1720 and the processing unit 1710).
[0200] The storage unit stores program codes, which can be executed by the processing unit 1710, so that the processing unit 1710 executes the steps of various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 1710 can execute the above-mentioned control method of the unmanned vehicle.
[0201] The storage unit 1720 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 17201 and / or a cache storage unit 17202 , and may further include a read-only storage unit (ROM) 17203 .
[0202] The storage unit 1720 may also include a program / utility 17204 having a set (at least one) of program modules 17205, such program modules 17205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0203] Bus 1730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0204] The electronic device 1700 may also communicate with one or more external devices 1740 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1700, and / or communicate with any device that enables the electronic device 1700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1750. Furthermore, the electronic device 1700 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1760. As shown, the network adapter 1760 communicates with other modules of the electronic device 1700 via a bus 1730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0205] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0206] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0207] A program product for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0208] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0209] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0210] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0211] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0212] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0213] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0214] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0215] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
Claims
1. An image processing method, characterized in that: The method comprises: Determine a plurality of sample points from the acquired image to be processed; An iterative segmentation operation is performed on the multiple sample points, wherein the process of one iterative segmentation operation includes: selecting a first sample point from the multiple sample points, determining a second sample point that is farthest from the first sample point; determining a third sample point that is farthest from the second sample point; using the distance between the second sample point and the third sample point as a segmentation diameter, segmenting the multiple sample points to obtain two point clusters after segmentation; the two point clusters after segmentation are centered on the second sample point and the third sample point respectively; Repeating the iterative segmentation operation on the two point clusters obtained until the number of sample points in each point cluster among the multiple point clusters obtained by the iterative segmentation operation is less than a preset number, then stopping the segmentation operation to obtain the multiple point clusters that have been segmented; Clustering is performed on the multiple point clusters to obtain a clustering result of the image to be processed.
2. The method according to claim 1, characterized in that: The clustering process is performed on the plurality of point clusters to obtain a clustering result of the image to be processed, including: Determine the partition density of each point cluster, and sort the partition density of each point cluster from large to small to obtain a point cluster partition density list; According to the point cluster partition density list and the inter-class distance between each point cluster, each point cluster is clustered, and the point clusters whose inter-class distance is less than a preset distance are merged into new point clusters until the point cluster partition density list is empty, thereby obtaining the clustering result of the image to be processed.
3. The method according to claim 2, characterized in that The step of clustering each point cluster according to the point cluster partition density list and the inter-class distance between each point cluster, merging the point clusters whose inter-class distance is less than a preset distance into a new point cluster until the point cluster partition density list is empty, and obtaining the clustering result of the image to be processed includes: The process of a clustering process based on the point cluster partition density list and the inter-class distances between point clusters includes: From the point cluster partition density list, select a first target point cluster with the largest partition density, and determine a set of second target point clusters; the set of second target point clusters includes point clusters other than the first target point cluster whose partition density is greater than the median of the partition density; Determine whether there is a third target point cluster; the third target point cluster is a second target point cluster whose inter-class distance with the first target point cluster is less than the preset distance; If it exists, merge it with the third target point cluster and the first target point cluster to form a new point cluster; If it does not exist, the first target point cluster is used as a new point cluster; The point cluster partition density list is updated to obtain an updated point cluster partition density list; wherein the updated point cluster partition density list does not include new point clusters obtained by clustering processing; The clustering process is repeated according to the updated point cluster partition density list until the updated point cluster partition density list is empty, thereby obtaining a clustering result of the image to be processed.
4. The method according to claim 1, characterized in that The clustering process is performed on the plurality of point clusters to obtain a clustering result of the image to be processed, including: Determine the minimum spanning tree and edge set standard deviation of each point cluster; the edge set standard deviation is the standard deviation of the edge weight values corresponding to the edges included in the minimum spanning tree; According to the edge set standard deviation of each point cluster, the plurality of point clusters are divided into a set of first sample point uniform point clusters and a set of sample point non-uniform point clusters; According to the set of sample point inhomogeneous point clusters, each sample point inhomogeneous point cluster is segmented according to the edge weight value and point density of each sample point inhomogeneous point cluster to obtain a set of second sample point uniform point clusters; wherein the point density is the density of each sample point in the plurality of sample points included in the sample point inhomogeneous point cluster; The sample point uniform point clusters are clustered to obtain a clustering result of the image to be processed; the sample point uniform point clusters include the first sample point uniform point cluster and the second sample point uniform point cluster.
5. The method according to claim 4, characterized in that The plurality of point clusters are divided into a set of first sample point uniform point clusters and a set of sample point non-uniform point clusters according to the standard deviation of the edge set of each point cluster, include: The judgment process for any point cluster includes: If the edge set standard deviation of any point cluster is greater than the median of the edge set standard deviation, then the any point cluster is regarded as an uneven point cluster of sample points; If the edge set standard deviation of any one of the point clusters is less than the median of the edge set standard deviation, the any one of the point clusters is used as a uniform point cluster of sample points; Each of the point clusters is judged to obtain a set of uniform point clusters of the first sample points and a set of non-uniform point clusters of the sample points.
6. The method according to claim 4, characterized in that The process of determining the point density of the non-uniform point cluster of the sample points includes: For any sample point inhomogeneous point cluster, determine k nearest neighbors between sample points in the any sample point inhomogeneous point cluster; For any sample point in the inhomogeneous point cluster of any sample point, determine the sum of distances between the any sample point and k nearest neighbors corresponding to the any sample point to obtain a sum of k nearest neighbor distances; The reciprocal of the sum of the k nearest neighbor distances is used as the point density of any sample point; The point density of the non-uniform point cluster of each sample point is determined.
7. The method according to claim 4, characterized in that The method of dividing each sample point uneven point cluster according to the edge weight value and point density of each sample point uneven point cluster in the set of sample point uneven point clusters to obtain a set of second sample point uniform point clusters includes: The segmentation operation for any sample point inhomogeneous point cluster includes: Determine an edge weight average value according to the edge weight values in any one of the sample point uneven point clusters; Determine whether there is a target edge; the absolute value of the difference between the edge weight value of the target edge and the edge weight average value is greater than a preset weight value; If the target edge exists, segmenting the any one sample point uneven point cluster based on the target edge to obtain at least two second sample point even point clusters; The segmentation operation is performed on each of the non-uniform point clusters of the sample points to obtain a set of the second uniform point clusters of the sample points.
8. The method according to claim 7, characterized in that The method further comprises: If the target edge does not exist, dividing the sample points in the any one sample point uneven point cluster into dense area points and sparse area points according to the point density median of the any one sample point uneven point cluster and the point density; According to the dense region points and the sparse region points, the any one sample point non-uniform point cluster is segmented to obtain at least two of the second sample point uniform point clusters.
9. An image processing device, characterized in that: include: An acquisition unit, used for determining a plurality of sample points from the acquired image to be processed; A segmentation unit, configured to perform an iterative segmentation operation on the plurality of sample points, wherein the process of one iterative segmentation operation comprises: selecting a first sample point from the plurality of sample points, determining a second sample point that is farthest from the first sample point; determining a third sample point that is farthest from the second sample point; using the distance between the second sample point and the third sample point as a segmentation diameter, segmenting the plurality of sample points to obtain two segmented point clusters; the two segmented point clusters are centered on the second sample point and the third sample point respectively; The segmentation unit is further configured to repeatedly perform the iterative segmentation operation on the two obtained point clusters until the number of sample points in each point cluster among the multiple point clusters obtained by the iterative segmentation operation is less than a preset number, then stop the segmentation operation, and obtain the multiple point clusters that have been segmented; The clustering processing unit is used to perform clustering processing on the multiple point clusters to obtain a clustering result of the image to be processed.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
11. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the method according to any one of claims 1 to 8.