A two-dimensional shape decomposition method and system based on salient branch detection
Through the method based on prominent branch detection, shape branches are extracted using highlighting functions and multi-label graph segmentation model, and combined with recursive spectral clustering for decomposition, the problems of instability and parameter sensitivity in the existing technology are solved, and the problems of complex shape decomposition in the existing technology are realized. The shape decomposition effect that is natural and in line with human cognitive rules.
Patent Information
- Application Number
- CN202310645198.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-02
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2043-06-02
AI Technical Summary
The existing two-dimensional shape decomposition methods are difficult to stabilize the complex shapes, especially the shapes with slender curved branches, which have problems with parameter sensitivity and unnecessary segmentation.
Using a method based on prominent branch detection, the prominent points on the shape are extracted by defining the highlighting function, the multi-label graph segmentation model is used to obtain prominent branches, and the shape decomposition is performed in combination with recursive spectral clustering to avoid specifying the number of decomposed parts in advance.
The stable decomposition of complex two-dimensional shapes is achieved, especially when dealing with slender curved branches, avoiding unnecessary segmentation, which improves the naturalness of the decomposition results and the degree to which human cognitive rules are met.
Smart Images

Figure CN116664841B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the intersection field of computer graphics and image and machine learning, and in particular relates to a two-dimensional shape decomposition method and system based on prominent branch detection. Background Art
[0002] Two-dimensional shape decomposition plays an important role in applications such as shape recognition, image retrieval, data compression, and computer animation, and is also an important problem in the field of computer vision. Although some meaningful rules and attempts have been made from psychology and computational geometry, it is still a challenging task to decompose an arbitrary two-dimensional shape into a set of visually natural parts.
[0003] In cognitive psychology research, the more commonly recognized two-dimensional shape decomposition rules are the minimum rule and the shortest path rule. The former believes that the ideal two-dimensional shape decomposition should separate shapes by the location of the negative minimum of the shape contour curvature, and the latter points out that humans prefer to use the shortest edge to separate shapes. Another widely used rule is the convexity rule, which comes from research in the field of computational geometry. Its view is that natural shapes are usually composed of several convex or nearly convex parts. However, these rules may sometimes conflict in practice, and it is difficult to merge them all into a simple computational model.
[0004] Based on the above three rules, the process commonly used by the current popular two-dimensional shape decomposition method is to extract the extreme (or critical) points of the shape contour through the minimum rule, such as the positions of negative minimum curvature, minimum visible range, minimum local charge, etc. as the endpoint candidate set of the segmentation line, and then based on these candidate points and the given shape convexity definition, combined with the shortest path rule and convex decomposition rule, through flexible divide-and-conquer strategies, combined optimization processes or shape medial axis assistance, seek visually natural shape decomposition results. However, due to the complexity and changeability of two-dimensional shapes in reality, there are often unavoidable problems such as noise, deformation and large-scale occlusion when imaging objects. The following problems of mainstream two-dimensional shape decomposition solutions need to be further solved:
[0005] (1) Most existing shape decomposition methods require the number of decomposition parts to be specified in advance. In fact, the number of decompositions for different shapes is often inconsistent, so it is impossible to give a priori value. At the same time, for some shapes, there may be more than one decomposition scheme that conforms to human cognition, that is, there is no optimal number of decomposition parts.
[0006] (2) The detection methods of extreme points are usually parameter-sensitive. To meet the requirements of human cognition, at least one of the endpoints of the segmentation line of a shape must be located in a deep concave part of the shape contour. Although many methods for detecting deep concave extreme points have been mentioned above, the estimation of such local geometric quantities is often very sensitive to parameters. There is also a class of methods that take all contour points as candidate segmentation points and formulate the shape decomposition problem as a discrete optimization problem under certain concave constraints, but this often introduces a lot of visually unnatural segmentations.
[0007] (3) The decomposition results for the thin and curved branches of the shape are unstable. The thin and curved branches violate the traditional convexity measurement and often produce multiple deep concave areas. Most decomposition methods will inevitably introduce segmentation at these locations, which is not in line with human cognitive rules. The convex decomposition rule believes that a shape should be composed of multiple approximately convex parts. The convexity measurement of a point set is the key to the convex decomposition method. For a shape subset (part), the traditional convexity measurement is based on the convex hull or its improved method. However, for the thin and curved branches of the shape, such as the tail of a lizard or the trunk of an elephant, the convexity measurement is often very small, so that the decomposition method based on the traditional convexity measurement will inevitably produce multiple redundant segmentations on these branches, which is obviously not in line with human cognitive rules.
[0008] In summary, for complex and diverse two-dimensional shapes in reality, especially those with slender and curved branches, it is difficult for existing technologies to achieve stable two-dimensional shape decomposition, and a flexible, robust and efficient method is needed as support. Summary of the invention
[0009] In order to overcome the deficiencies in the prior art, the present invention provides a two-dimensional shape decomposition method and system based on salient branch detection. Make full use of salient characteristic functions and shape decomposition based on recursive spectral clustering to improve the decomposition effect of complex two-dimensional shapes, especially shapes with multiple curved branches. First, by defining a new type of salient characteristic function, salient points on the shape are extracted; second, by solving a multi-label graph segmentation model, multiple salient branches on the shape are obtained; third, based on the shape branch information, the segmentation endpoint candidate set and the accompanying point set are determined; finally, the decomposition result of the shape is obtained through a recursive spectral clustering process. The two-dimensional shape decomposition method and system based on salient branch detection overcomes the defect that the prior art is difficult to achieve stable decomposition of complex two-dimensional shapes; it can identify the salient parts of the shape in advance, especially the salient parts that are slender and curved; it can help locate the endpoints of the shape segmentation in a more visually natural area, avoiding over-segmentation of the salient parts of the shape.
[0010] The technical solution of the present invention is:
[0011] A two-dimensional shape decomposition method based on salient branch detection, the method comprising the following steps:
[0012] Step 1, discretize and sample the shape contour, and extract and group the salient points on the shape contour by using the shape salient characteristic function;
[0013] Step 2, performing multi-label graph segmentation on the shape contour according to the salient points to obtain salient branches of the shape;
[0014] Step 3, extracting a segmentation endpoint candidate set and a companion point set of the salient point according to the salient branch;
[0015] Step 4: Decompose the shape based on shape decomposition of recursive spectral clustering according to the salient points, the segmentation endpoint candidate set and the companion point set to obtain a decomposition result of the shape.
[0016] Furthermore, the steps of discretizing and sampling the shape contour and extracting and grouping the salient points on the shape contour by using the shape salient characteristic function include:
[0017] The shape contour of shape P is discretized and uniformly sampled, expressed as P = {p1, p2, ..., p n}, where n is the number of sampling points;
[0018] For any two points p on the shape contour of the shape P i ,p j , the edge between the two points is represented by edge e ij ;
[0019] Construct the visible graph G′<P,E> ;
[0020] Where E is the edge set, which is the edge e located inside the shape P. ij A collection of;
[0021] The shortest path length between all the sampling point pairs is calculated by the visual graph G′, and the shortest path length is located inside the shape, and the shortest path length is the internal distance;
[0022] The prominence characteristic values of all points on the shape contour are calculated by the shape prominence characteristic function, and the shape prominence characteristic function is specifically expressed as:
[0023]
[0024] Among them, cf(p i ) represents a point p on the shape i The prominent indicative value of idist(p i ,p j ) is a point p on the shape i ,p jThe internal distance between; α is the distance control factor, α>0, and the smaller the value of α, the closer the distance to the observation point p i The farther away the point is, the greater its influence on the calculation of its salient characteristic value; n is the number of sampling points;
[0025] Taking the local maximum point of the salient indicative value as the candidate point of the salient point, and adding it to the candidate point set S;
[0026] The candidate point set S is grouped, and the candidate points whose distances are less than a given threshold are grouped together into a group G = {G1, G2, ..., G m}, where G i The following conditions are met:
[0027]
[0028] Among them, s j is the representative point in the candidate point set S, s k For the group G i The candidate points in T g is the average value of the internal distance between the candidate points; the value interval of the constant term β is (0,0.5], the smaller the value of β, the smaller the value of each group G i The fewer the number of elements in , the finer the grouping of the point set S;
[0029] Take the candidate point with the largest salient characteristic value as a representative from each of the divided groups to obtain the salient points on the shape contour to form a point set C, where C satisfies the following conditions:
[0030]
[0031] Among them, c i For group G i The candidate points with the largest highlight value are grouped as G i Any candidate point s in k The prominent indicative values are all less than or equal to c i The prominent indicative value of the point;
[0032] Obtain the point set C of the salient points = {c1, c2, ..., c m}.
[0033] Furthermore, the step of performing multi-label graph segmentation on the shape contour according to the salient points to obtain salient branches of the shape includes:
[0034] The shape contour is segmented using a multi-label graph segmentation model, wherein the multi-label graph segmentation model argmin g E(g) is specifically expressed as:
[0035]
[0036] Among them, E1(p i ,g(p i ))=idist(p i ,g(p i )) α ; E1(p i ,g(p i )) is the data item of the segmentation cost function E(g), which is used to measure g(p i ) as p i The approximation error of the point category center is p i The point is assigned to the nearest salient point as much as possible; the p i Point category center g(p i )∈C, is p i Classification function; idist(p i ,g(p i )) is the p i The point and the category center g(p i ), α is the distance control factor;
[0037] Among them, E2(p i ,p i+1 )=cf(p i )+cf(p i+1 ); E2(p i ,p i+1 ) is the regular term of the segmentation cost function E(g), which is used to measure the dividing point of the partition at p i and p i+1 The non-smooth error caused by the above-mentioned protrusion indicative value of the sampling point is low, that is, the deep concave shape is divided;
[0038] Wherein, λ=1 is the balance factor between the data term and the regularization term; the loop boundary of the multi-label graph segmentation model satisfies: if i+1>n, the value of i+1 is modulo n; argmin g E(g) represents the segmentation g corresponding to the minimum value of E(g) among all possible segmentations g of the graph;
[0039] The segmentation of the shape contour corresponds to the salient branches of the shape.
[0040] Furthermore, the step of extracting the companion point set of the salient point and the segmentation endpoint candidate set according to the salient branch includes:
[0041] The protruding branch The endpoints of the shape are added to the segmentation endpoint candidate set EP as the first segmentation endpoints; at the same time, the edge e located outside the shape is used ij , detect the extreme points of the deep concave area of the shape P, as the second segmentation endpoints, and add them to the segmentation endpoint candidate set EP;
[0042] The salient points correspond to the divided areas one by one, and the points falling in one of the divided areas are the companion point set corresponding to the salient points, which are used to determine whether the shape decomposition process is terminated in the fourth module; that is, for the set of salient points C = {c1, c2, ..., c m}, highlighting the branch set B = {B1, B2, ..., B m} is the companion point set corresponding to the prominent point.
[0043] Furthermore, the specific steps of decomposing the shape based on shape decomposition by recursive spectral clustering according to the salient points, the segmentation endpoint candidate set and the companion point set include:
[0044] The visibility of the shape is used to establish a visibility matrix V = {v ij};
[0045] Among them, if point p i and p j are mutually visible, then v ij =1; if point p i and p j are not visible to each other, then v ij =0;
[0046] For a strictly convex shape, any two points are visible to each other, then the decomposition solution is expressed as:
[0047]
[0048] Where T = {T1, T2, …, T t} represents the decomposition of shape P; C(T i ) is the decomposition sub-part T i The convexity measure of ; represents the one with the largest convexity measure among all possible decomposition schemes T; different shape decomposition methods use different convexity measures;
[0049] The convexity measure is designed based on shape visibility, namely |T i | refers to subsection T i The number of interior points, if T i is approximately convex, then C(T i ) is close to 1;
[0050] Among them, for a given convexity measure C(T i) and the number of decomposed parts t, through the visual graph<P,V> A decomposition solution T′ with the maximum convexity measure is obtained by minimizing the standard cut on it;
[0051] Recursive spectral clustering is used to solve the decomposition solution i′ with the maximum convexity measure, and the shape is decomposed into two parts in each iteration, and the decomposition number t=2, including the following steps: used to avoid specifying the decomposition number t in advance;
[0052] With the help of Gaussian kernel, a new similarity matrix A = {a ij}, to avoid grouping points that are visible to each other but far apart into one category, specifically expressed as:
[0053] a ij =v ij *exp(-idist(p i ,p j ) 2 / σ 2 )
[0054] Among them, σ is the scale of the Gaussian kernel, taking the average of the internal distances between all point pairs, that is,
[0055] Normalize the matrix A to Laplace to obtain the matrix L; and calculate the eigenvector η corresponding to the second smallest eigenvalue of the matrix L as the spectral coordinate representation of the sampling point on the shape;
[0056] The current shape is divided into two decomposition parts T1 and T2, and the shape decomposition scheme of the recursive spectral clustering is expressed as:
[0057]
[0058] in, vol(T1) and vol(T2) correspond to the visible volumes of the decomposed parts T1 and T2, respectively. is the mutual visible volume between the two decomposed parts T1 and T2; A(p i ,p j ) refers to p in the similarity matrix A i and p j The corresponding element value;
[0059] Candidate solutions for the shape decomposition scheme of recursive spectral clustering include:
[0060] According to the spectral coordinate representation η of the shape, the shape is segmented by taking the representation value of each point in the segmentation endpoint candidate set EP as a threshold;
[0061] Segment the shape using any two different points of the segmentation endpoint candidate set EP as segmentation endpoints;
[0062] The minimum value among the candidate solutions represents the minimum segmentation among all valid segmentations of the shape, that is, the decomposition result of the shape;
[0063] At the same time, after the shape decomposition is completed, the convexity evaluation value of each sub-part can be calculated to obtain the convexity evaluation value of the entire decomposition.
[0064] A two-dimensional shape decomposition system based on salient branch detection, the system comprising:
[0065] Adaptive extraction module of shape salient points: used to discretize and sample the contour of the shape, and extract and group the salient points on the shape contour through the shape salient characteristic function;
[0066] A module for extracting salient branches of a shape: performing multi-label graph segmentation on the shape contour according to the salient points to obtain salient branches of the shape;
[0067] A module for determining shape segmentation endpoints and accompanying points: extracting a segmentation endpoint candidate set and an accompanying point set of the salient point according to the salient branch;
[0068] Compared with the prior art, the present invention has the following beneficial effects:
[0069] (1) The two-dimensional shape decomposition method proposed in the present invention is highly intelligent and can provide decomposition results from coarse to fine, avoiding the need to specify parameters such as the number of prominent branches and the number of shape decomposition parts. In the present invention, the number of shape prominent branches is obtained by extracting and grouping the shape prominent points. It is a typical adaptive method and does not require the pre-specification of the number of prominent branches. For the near-convex decomposition of the shape, a recursive spectral clustering method is used, which also avoids specifying the number of shape decomposition parts. Instead, the recursive process can be terminated through intuitive convexity metrics such as whether all points in the current part are mutually visible, as well as information such as the shape branches obtained in advance. At the same time, the detected prominent branches only provide possible shape segmentation endpoints. The entire decomposition process is carried out in the spectral representation space of the shape data, which can produce semantically clearer decomposition results and improve the robustness of the algorithm parameters.
[0070] (2) The present invention proposes to treat the protruding branches and the shape as a whole differently, and detect the protruding branches of the shape in advance. Based on the information provided by the protruding branches, a shape segmentation endpoint set that conforms to human cognition is obtained, and then the shape is recursively decomposed by a spectral clustering method based on visibility measurement. Decomposing the shape in the spectral space improves the parameter robustness of the algorithm and avoids redundant segmentation at slender and curved branches. Complex two-dimensional shapes can be efficiently decomposed into multiple nearly convex parts. The shape decomposition results are natural and conform to human cognitive rules. In particular, shapes with multiple slender and curved branches can be effectively processed without generating redundant segmentation. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 It is an overall schematic diagram of a two-dimensional shape decomposition system based on prominent branch detection in an embodiment of the present invention.
[0072] Figure 2 It is a geometric flow chart of a two-dimensional shape decomposition method based on salient branch detection in an embodiment of the present invention.
[0073] Figure 3 It is a schematic diagram of the process of shape decomposition of recursive spectral clustering of the present invention. DETAILED DESCRIPTION
[0074] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0075] A two-dimensional shape decomposition method and system based on salient branch detection, such as Figure 1 As shown in FIG, the method is implemented based on four modules: an adaptive extraction module for shape salient points, an extraction module for shape salient branches, a determination module for shape segmentation endpoints and accompanying points, and a shape decomposition module based on recursive spectral clustering. Specifically,
[0076] (1) Adaptive extraction module of shape salient points
[0077] The adaptive extraction module of shape salient points needs to discretize and sample the shape contour, define the shape salient characteristic function, extract the local maximum points of the shape salient characteristic value, group the maximum points and obtain the final shape salient points.
[0078] In actual scenes, many natural shapes are composed of a main body and multiple branches surrounding the main body. The basic task of shape decomposition is to be able to stably obtain the main body and each branch decomposition result of the shape when the shape undergoes different posture changes. For a prominent branch, there is usually a most prominent point or area corresponding to it. Therefore, the present invention proposes a shape characteristic function to characterize the protruding properties and effectively detect the protruding part.
[0079] For a given shape P, the shape contour is first discretized and uniformly sampled, expressed as P = {p1, p2, ..., p n}, where n is the number of sampling points.
[0080] In the prior art, a shape characteristic function is usually defined as formula (1) to describe a point p on a shape P. i Prominence of the place:
[0081]
[0082] Among them, dist(p i ,p j ) is a point p on the shape i ,p j The more prominent a point on a shape is, the greater the sum of its distances from the other points on the shape should be.
[0083] The shortcoming of the existing shape characteristic function is that when the shape undergoes posture changes, such as when an animal stretches its upper limbs or walks, the Euclidean distance between its contour points is not stable.
[0084] The present invention proposes to construct a shape highlighting characteristic function using the internal distance on the shape, as shown in formula (2):
[0085]
[0086] Among them, cf(p i ) represents a point p on the shape i The prominent indicative value of idist(p i ,p j ) is a point p on the shape i ,p j The internal distance between; α is the distance control factor, α>0, and the smaller the value of α, the closer the distance to the observation point p i The farther the point is, the greater its influence on the calculation of its prominence value. As a preferred embodiment of this embodiment, α=0.1.
[0087] It should be noted that the introduction of α in the present invention can obtain a more effective shape highlighting characteristic, further improving the robustness to noise on the shape and the ability to describe geometric properties such as deep concave parts of the shape.
[0088] Based on the proposed shape highlighting function, for the shape P = {p1, p2, ..., p n}, the shape salient point adaptive extraction process of this module is as follows:
[0089] First, construct the visibility graph G′=<P,E> , where E is the edge set, which is the edge e between all sampling points in shape P that are located inside shape P ij A collection of;
[0090] Secondly, the shortest path length between all point pairs is calculated through graph G′, which is the internal distance.
[0091] Again, the prominence value of all points is calculated by formula (2), as Figure 2 As shown in the first column above, the local maximum point of the salient characteristic value is taken as the candidate point of the salient point and added to the candidate point set S.
[0092] For some branches with wider ends, multiple salient points may coexist. The present invention proposes to group the candidate point set S of salient points, grouping the candidate points whose distances are less than a given threshold into one group, and obtaining the partition G of the candidate point set S = {G1, G2, ..., G m},like Figure 2 The first column is shown in the colored dots in the figure below, where G i Satisfies formula (3):
[0093]
[0094] Among them, s j is the representative point in the candidate point set S, s k For the group G i The candidate points in T g is the average internal distance between all candidate points in the set S. The reasonable value range of β is (0,0.5]. Intuitively, the smaller the value of β, the smaller the internal distance between each group G. i The fewer the number of elements in , that is, the finer the grouping of the point set S, as the preferred embodiment, β = 0.2;
[0095] Then, we take the candidate point with the largest salient characteristic value from each group as the representative, and obtain the point set C of the salient points on the shape contour = {c1, c2, ..., c m}, C satisfies formula (4):
[0096]
[0097]
[0098]
[0099] Algorithm 1 describes the adaptive extraction process of salient points of a shape. Lines 1 to 6 give the calculation method of the internal distance on the shape; lines 7 to 9 calculate the salient characteristic value of each point on the shape; lines 10 to 14 obtain the salient points on the shape based on the salient characteristic value; line 11 N(pi ) is the sampling point p i 's neighborhood.
[0100] (2) Shape-prominent branch extraction module
[0101] The module for extracting the salient branches of the shape first uses the salient points obtained in the previous module to construct data items with the help of internal distances on the shape, and constructs regularization items based on the salient characteristic representation of the shape, and then establishes a multi-objective graph segmentation model. The shape is divided along the contour through the optimal solution of the model, thereby obtaining the salient branches of the shape.
[0102] A prominent point of a shape often corresponds to a prominent branch of the shape. Based on this, the present invention proposes a multi-label graph segmentation model, whose solution is the optimal division of the shape contour. The contour fragments obtained by division correspond to each branch of the shape. The multi-label graph segmentation model is shown in formula (5):
[0103]
[0104] Among them, E1(p i ,g(p i ))=idist(p i ,g(p i )) α ; E1(p i ,g(p i )) is the data item of the segmentation cost function E(g), which is used to measure g(p i ) as p i The approximation error of the point category center is p i The point is assigned to the nearest salient point as much as possible; the p i Point category center g(p i )∈C, is p i Classification function; idist(p i ,g(p i )) is the p i The point and the category center g(p i ), α is the distance control factor;
[0105] E2(p i ,p i+1 )=cf(p i )+cf(p i+1 ) is the regular term of the segmentation cost function E(g), which is used to measure the dividing point of the partition at p i and p i+1 The roughness error caused by the sampling point is reduced to produce divisions as much as possible in the deep concave parts of the shape (the positions where the prominence of the sampling point is low).
[0106] λ=1 is the balance factor between the data term and the regularization term.
[0107] At the same time, formula (5) assumes the situation of loop boundary, that is, if i+1>n, the value of i+1 needs to be modulo n.
[0108] It should be noted that Figure 2 It can be seen from the second column of the upper figure that when λ=0, the shape branch extraction obtained only by the data item, the dividing points of different branches sometimes do not fall in the deep concave area of the shape; when λ=1 in the second column of the lower figure, this situation is improved by introducing the regularization term.
[0109] (3) Module for determining shape segmentation endpoints and accompanying points
[0110] The module for determining the shape segmentation endpoints and accompanying points not only uses the endpoints of the protruding branches as possible endpoints for shape segmentation, but also adds the local minimum points of the protruding characteristic values to the candidate set of shape segmentation endpoints. In addition, the protruding branches are used as the accompanying point set of their corresponding protruding points to improve the robustness of the subsequent shape recursive decomposition.
[0111] The salient branch extracts a candidate set of shape segmentation endpoints and a companion point set of salient points based on the obtained salient branch through a shape segmentation endpoint and a companion point determination module, thereby solving the parameter sensitivity problem of traditional shape decomposition. The specific steps are as follows:
[0112] First, provide a candidate set of segmentation endpoints for the next step of shape decomposition. The endpoints of can be added to the segmentation endpoint candidate set EP as the first segmentation line endpoints. The reason why the detected protruding branches are not directly used as part of the shape decomposition is that the protruding branches are obtained by segmenting adjacent endpoints, and the segmentation composed of non-adjacent endpoints can sometimes be considered as a more semantic decomposition. Therefore, this part only selects the endpoints of the protruding branches, and leaves the specific decomposition task to the shape decomposition module based on recursive spectral clustering.
[0113] In addition, since the deep concave areas in the main part of the shape can often produce some meaningful decompositions, and from the outside of the shape, the original deep concave areas become protruding branches, so the second line of Algorithm 1 is changed to determine whether the edge is outside the shape, and the extreme points of the deep concave areas can be detected as the second segmentation endpoints and added to the segmentation endpoint candidate set eP. Figure 2 The upper figure in the third column of gives schematic diagrams of the two segmentation endpoints.
[0114] At the same time, the extraction module of the shape salient branch has obtained the optimal division of the shape contour, and each shape salient point corresponds to a divided area of the contour.
[0115] The points falling within a partitioned area are regarded as the companion point set of the corresponding salient point, which is used to determine whether the shape decomposition process is terminated in the shape decomposition module based on recursive spectral clustering. That is, for the set of salient points C = {c1, c2, …, c m}, highlighting the branch set B = {B1, B2, ..., B m} is the companion point set corresponding to the salient point.
[0116] (4) Shape decomposition module based on recursive spectral clustering:
[0117] A shape decomposition module based on recursive spectral clustering is used to decompose the shape according to the salient points, the segmentation endpoint candidate set and the companion point set, so as to obtain a decomposition result of the shape.
[0118] After obtaining the salient points C of the shape, its accompanying point set B and the segmented endpoint candidate set EP, the present invention proposes to implement the decomposition of the two-dimensional shape based on recursive spectral clustering to solve the problem that the number of decomposed parts of a given shape is often unknown. For each recursive process, the similarity matrix is first defined by the visibility of the points on the shape (sub-parts), and then the current shape is decomposed into two parts based on the segmented endpoint candidate set using spectral clustering technology until the decomposition reaches the termination condition. The specific process is as follows:
[0119] The visibility matrix V is constructed by the visibility of the shape. ij}. If you click p i and p j are mutually visible, then v ij =1, otherwise, v ij =0.
[0120] Since any two points of a strictly convex shape are visible to each other, the convex decomposition problem of the general shape can be expressed as formula (6):
[0121]
[0122] Where T = {T1, T2, …, T t} is a decomposition of shape P, C(T i ) is the decomposition sub-part T i ; T′ represents the one with the largest convexity measure among all possible decomposition schemes T.
[0123] Different shape decomposition methods use different convexity metrics;
[0124] The present invention chooses to design a convexity measure based on shape visibility, namely |T i | refers to subsection T i The number of interior points, if Ti is approximately convex, then C(T i ) is close to 1.
[0125] For a given convexity measure C(T i ) and the number of decomposed parts t, the solution of formula (6) can be transformed into the solution of the visible graph<P,V> A minimization standard cut (N-cut) problem on<P,V> A decomposition solution T′ with the largest convexity measure is obtained by minimizing the standard cut on it.
[0126] The present invention uses recursive spectral clustering to solve the decomposition solution T′ with the largest convexity measure, that is, decomposing the shape into two parts in each iteration, thereby avoiding specifying the decomposition number t in advance, including the following steps:
[0127] In order to avoid classifying mutually visible but far-flung points into one category, a new similarity matrix A = {a ij}, avoid grouping points that are visible to each other but far apart into one category, a ij Specifically expressed as:
[0128] a ij =v ij *exp(-idist(p i ,p j ) 2 / σ 2 ) (7)
[0129] Among them, σ is the scale of the Gaussian kernel, taking the average of the internal distances between all point pairs, that is,
[0130] Normalize the matrix A to Laplace to obtain the matrix L; and calculate the eigenvector η corresponding to the second smallest eigenvalue of the matrix L as the spectral coordinate representation of the sampling point on the shape;
[0131] The decomposition T is divided into two parts T1 and T2, then formula (6) is transformed into formula (8). At this time, the shape decomposition scheme of the recursive spectral clustering is shown in formula (8). Solving formula (8) obtains the segmentation c:
[0132]
[0133] in, vol(T1) and vol(T2) correspond to the visible volumes of decomposed parts T1 and T2, respectively; is the mutual visible volume between the two decomposed parts T1 and T2; A(p i ,p j ) refers to p in the similarity matrix A i and p jThe corresponding element value.
[0134] Formula (8) is a combinatorial optimization problem, and it is difficult to solve it directly. Since the visually natural shape segmentation edge must have at least one point in a deep concave (a point in the segmentation endpoint set EP) as an endpoint, the present invention proposes two candidate solutions of formula (8): (1) based on the spectral representation η of the shape, the representation value of each point in the endpoint set EP is used as the threshold to segment the shape; (2) any two different points in the endpoint set EP are used as segmentation endpoints to segment the shape. The solution corresponding to the minimum value among the above candidate solutions is the optimal solution of formula (8).
[0135] After obtaining a visually natural decomposition result, the convexity evaluation value of each decomposition sub-part can be calculated by formula (6), and then the convexity evaluation value of the entire decomposition can be obtained.
[0136] Algorithm 2 describes the process of recursive spectral decomposition of two-dimensional shapes, where line 4 is the termination condition of the recursive process. Intuitively, for the current shape subpart, ∑ i.j V ij ≥T v |P| 2 It means that most of the points on the shape are visible to each other. It means that most of the points on the shape overlap with a prominent branch, and the ratio has two thresholds T v and T m Control respectively. Lines 7 to 8 represent the spectral decomposition algorithm of the shape. All candidate solutions of formula (8) are obtained from the spectral representation of the shape and the segmentation endpoint set, and the optimal segmentation of the current shape is obtained by minimizing formula (8). Lines 9 to 12 represent the optimal segmentation c, which divides the shape into two parts and continues to perform the spectral decomposition process in each part. A flowchart of the recursive spectral decomposition algorithm is shown in Figure 3 For the current shape to be decomposed, the valid segmentation edges generated by all candidate endpoint sets are marked in blue, the optimal segmentation edges are marked in red, and the two parts of the generated shape after segmentation are marked in red and green respectively.
[0137]
[0138]
[0139] It should be noted that the decomposition method of the shape decomposition module based on recursive spectral clustering adopts a recursive decomposition strategy. Each recursive process divides the shape into two parts and ends the recursion when the termination condition is met, avoiding the need to specify the number of shape decomposition parts in advance. At the same time, decomposing the shape in the spectral space also improves the robustness of the algorithm and produces a more semantic decomposition.
[0140] Experimental example
[0141] The present invention conducted a shape decomposition experiment on the S&V dataset. A portion of the 88 shapes in the dataset was randomly selected by 201 volunteers and decomposed by manual line drawing. Taking the above manual decomposition results as the true value, this embodiment adopts the three quality evaluation indicators proposed by the CSR method (segmentation conformity μ m 、Incompleteness μ um and similarity r) are compared with existing popular shape methods, as shown in Table 1, where the value is the average of all shape corresponding indicators.
[0142] It can be seen that compared with other existing methods in the table, the two-dimensional shape decomposition method based on prominent branch detection in the embodiment of the present invention has improved the segmentation conformity and similarity, and also achieved the lowest incompleteness. It is proved that the pre-extraction of prominent branches of the shape can effectively improve the accuracy of shape decomposition.
[0143] Table 1
[0144]
[0145] The present invention can efficiently decompose complex two-dimensional shapes into multiple approximately convex parts, especially can well handle shapes with multiple slender curved branches. At the same time, it can avoid specifying parameters such as the number of protruding branches and the number of shape decomposition parts, and the entire decomposition process is carried out in the spectral representation space, which improves the robustness of the algorithm parameters.
[0146] The above invention is a two-dimensional shape decomposition method based on salient branch detection. However, for those skilled in the art, without departing from the concept of the invention, the adaptive extraction module of shape salient points and the extraction module of shape salient branches can be used for various applications of shape data, such as shape simplification, editing, compression, etc. In addition, the present invention can also be extended to three-dimensional geometric data, such as point clouds and meshes, and several improvements and deformations can be made to the method for decomposition and compression of three-dimensional data.
[0147] This article uses specific examples to illustrate the principles and implementation schemes of the present invention. The above examples are only used to help understand the method and core ideas of the present invention. At the same time, for those skilled in the art, according to the ideas of the present invention, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A two-dimensional shape decomposition method based on salient branch detection, characterized in that: The method comprises the following steps: Step 1, discretize and sample the shape contour, and extract and group the salient points on the shape contour by using the shape salient characteristic function; Step 2, performing multi-label graph segmentation on the shape contour according to the salient points to obtain salient branches of the shape; Step 3, extracting a segmentation endpoint candidate set and a companion point set of the salient point according to the salient branch; Step 4, decomposing the shape based on shape decomposition of recursive spectral clustering according to the salient points, the segmentation endpoint candidate set and the companion point set, to obtain a decomposition result of the shape; The steps of discretizing and sampling the shape contour and extracting and grouping the salient points on the shape contour by using the shape salient characteristic function include: The shape contour of shape P is discretized and uniformly sampled, expressed as P = {p1, p2, ..., p n }, where n is the number of sampling points; For any two points p on the shape contour of the shape P i ,p j , the edge between the two points is represented by edge e ij ; Construct the visible graph G'<P,E> ; Where E is the edge set, which is the edge e located inside the shape P. ij A collection of; The shortest path length between all sampling point pairs is calculated by the visual graph G', and the shortest path length is located inside the shape, and the shortest path length is the internal distance; The prominence characteristic values of all points on the shape contour are calculated by the shape prominence characteristic function, and the shape prominence characteristic function is specifically expressed as: Among them, cf(p i ) represents a point p on the shape i The prominent indicative value of idist(p i ,p j ) is a point p on the shape i ,p j The internal distance between; α is the distance control factor, α>0, and the smaller the value of α, the closer the distance to the observation point p i The farther away the point is, the greater its influence on the calculation of its salient characteristic value; n is the number of sampling points; Taking the local maximum point of the salient indicative value as the candidate point of the salient point, and adding it to the candidate point set S; The candidate point set S is grouped, and the candidate points whose distances are less than a given threshold are grouped together into a group G = {G1, G2, ..., G m }, where G i The following conditions are met: Among them, s j is the representative point in the candidate point set S, s k For the group G i The candidate points in T g is the average value of the internal distance between the candidate points; the value interval of the constant term β is (0,0.5], the smaller the value of β, the smaller the value of each group G i The fewer the number of elements in , the finer the grouping of the point set S; From each partition group, select the candidate point with the largest salient characteristic value as a representative to obtain the salient points on the shape contour to form a point set C, which satisfies the following conditions: Among them, c i For group G i The candidate points with the largest highlight value are grouped as G i Any candidate point s in k The prominent indicative values are all less than or equal to c i The prominent indicative value of the point; Obtain the point set C of the salient points = {c1, c2, ..., c m }; The step of performing multi-label graph segmentation on the shape contour according to the salient points to obtain salient branches of the shape comprises: The shape contour is segmented using a multi-label graph segmentation model. Specifically expressed as: Among them, E1(p i ,g(p i ))=idist(p i ,g(p i )) α ; E1(p i ,g(p i )) is the data item of the segmentation cost function E(g), which is used to measure g(p i ) as p i The approximation error of the point category center is p i The point is assigned to the nearest salient point as much as possible; the p i Point category center g(p i )∈C, is p i Classification function; idist(p i ,g(p i )) is the p i The point and the category center g(p i ), α is the distance control factor; Among them, E2(p i ,p i+1 )=cf(p i )+cf(p i+1 ); E2(p i ,p i+1 ) is the regular term of the segmentation cost function E(g), which is used to measure the dividing point of the partition at p i and p i+1 The non-smooth error caused by the above-mentioned protrusion indicative value of the sampling point is low, that is, the deep concave shape is divided; Wherein, λ=1 is a balance factor between the data term and the regular term; the loop boundary of the multi-label graph segmentation model satisfies: if i+1>n, the value of i+1 is modulo n; represents the segmentation g corresponding to the minimum value of E(g) among all possible segmentations g of the graph; The segmentation of the shape contour corresponds to a prominent branch of the shape; The step of extracting the companion point set of the salient point and the segmentation endpoint candidate set according to the salient branch comprises: The protruding branch The endpoints of the shape are added to the segmentation endpoint candidate set EP as the first segmentation endpoints; at the same time, the edge e located outside the shape is used ij , detect the extreme points of the deep concave area of the shape P as the second segmentation endpoints, and add them to the segmentation endpoint candidate set EP; The salient points correspond to the divided areas one by one, and the points falling within one of the divided areas are the companion point set corresponding to the salient point; that is, for the set of salient points C = {c1, c2, ..., c m }, highlighting the branch set B = {B1, B2, ..., B m } is the companion point set corresponding to the prominent point; The specific steps of decomposing the shape based on shape decomposition by recursive spectral clustering according to the salient points, the segmentation endpoint candidate set and the companion point set include: The visibility of the shape is used to establish a visibility matrix V = {v ij }; Among them, if point p i and p j are mutually visible, then v ij =1; if point p i and p j are not visible to each other, then v ij =0; For a strictly convex shape, any two points are visible to each other, then the decomposition solution is expressed as: Where T = {T1, T2, …, T t } represents the decomposition of shape P; C(T i ) is the decomposition sub-part T i The convexity measure of ; T' represents the one with the largest convexity measure among all possible decomposition schemes T; The convexity measure designed based on shape visibility is expressed as: Among them, |T i | refers to subsection T i The number of interior points, if T i is approximately convex, then C(T i ) is close to 1; Among them, for a given convexity measure C(T i ) and the number of decomposed parts t, through the visual graph<P,V> A decomposition solution T' with the maximum convexity measure is obtained by minimizing the standard cut on it; Recursive spectral clustering is used to solve the decomposition solution T' with the maximum convexity measure. The shape is decomposed into two parts in each iteration. The number of decompositions is t=2, including the following steps: With the help of Gaussian kernel, a new similarity matrix A = {a ij }, specifically expressed as: and ij =in ij *exp(-idist(p i ,p j ) 2 / σ 2 ) Among them, σ is the scale of the Gaussian kernel, taking the average of the internal distances between all point pairs, that is, Normalize the matrix A to Laplace to obtain the matrix L; and calculate the eigenvector η corresponding to the second smallest eigenvalue of the matrix L as the spectral coordinate representation of the sampling point on the shape; The current shape is divided into two decomposition parts T1 and T2, and the shape decomposition scheme of the recursive spectral clustering is expressed as: in, vol(T1) and vol(T2) correspond to the visible volumes of the decomposed parts T1 and T2, respectively. is the mutual visible volume between the two decomposed parts T1 and T2; A(p i ,p j ) refers to p in the similarity matrix A i and p j The corresponding element value; Candidate solutions for the shape decomposition scheme of recursive spectral clustering include: According to the spectral coordinate representation η of the shape, the shape is segmented by taking the representation value of each point in the segmentation endpoint candidate set EP as a threshold; Segment the shape using any two different points of the segmentation endpoint candidate set EP as segmentation endpoints; The minimum value among the candidate solutions represents the minimum segmentation among all valid segmentations of the shape, that is, the decomposition result of the shape.
2. A two-dimensional shape decomposition system based on salient branch detection, characterized in that: The system comprises: Adaptive extraction module of shape salient points: used to discretize and sample the contour of the shape, and extract and group the salient points on the shape contour through the shape salient characteristic function; A module for extracting salient branches of a shape: performing multi-label graph segmentation on the shape contour according to the salient points to obtain salient branches of the shape; A module for determining shape segmentation endpoints and accompanying points: extracting a segmentation endpoint candidate set and an accompanying point set of the salient point according to the salient branch; A shape decomposition module based on recursive spectral clustering: decomposing the shape based on shape decomposition based on recursive spectral clustering according to the salient points, the segmentation endpoint candidate set and the companion point set to obtain a decomposition result of the shape; The steps of discretizing and sampling the shape contour and extracting and grouping the salient points on the shape contour by using the shape salient characteristic function include: The shape contour of shape P is discretized and uniformly sampled, expressed as P = {p1, p2, ..., p n }, where n is the number of sampling points; For any two points p on the shape contour of the shape P i ,p j , the edge between the two points is represented by edge e ij ; Construct the visible graph G'<P,E> ; Where E is the edge set, which is the edge e located inside the shape P. ij A collection of; The shortest path length between all sampling point pairs is calculated by the visual graph G', and the shortest path length is located inside the shape, and the shortest path length is the internal distance; The prominence characteristic values of all points on the shape contour are calculated by the shape prominence characteristic function, and the shape prominence characteristic function is specifically expressed as: Among them, cf(p i ) represents a point p on the shape i The prominent indicative value of idist(p i ,p j ) is a point p on the shape i ,p j The internal distance between; α is the distance control factor, α>0, and the smaller the value of α, the closer the distance to the observation point p i The farther away the point is, the greater its influence on the calculation of its salient characteristic value; n is the number of sampling points; Taking the local maximum point of the salient indicative value as the candidate point of the salient point, and adding it to the candidate point set S; The candidate point set S is grouped, and the candidate points whose distances are less than a given threshold are grouped together into a group G = {G1, G2, ..., G m }, where G i The following conditions are met: Among them, s j is the representative point in the candidate point set S, s k For the group G i The candidate points in T g is the average value of the internal distance between the candidate points; the value interval of the constant term β is (0,0.5], the smaller the value of β, the smaller the value of each group G i The fewer the number of elements in , the finer the grouping of the point set S; From each partition group, select the candidate point with the largest salient characteristic value as a representative to obtain the salient points on the shape contour to form a point set C, which satisfies the following conditions: Among them, c i For group G i The candidate points with the largest highlight value are grouped as G i Any candidate point s in k The prominent indicative values are all less than or equal to c i The prominent indicative value of the point; Obtain the point set C of the salient points = {c1, c2, ..., c m }; The step of performing multi-label graph segmentation on the shape contour according to the salient points to obtain salient branches of the shape comprises: The shape contour is segmented using a multi-label graph segmentation model. Specifically expressed as: Among them, E1(p i ,g(p i ))=idist(p i ,g(p i )) α ; E1(p i ,g(p i )) is the data item of the segmentation cost function E(g), which is used to measure g(p i ) as p i The approximation error of the point category center is p i The point is assigned to the nearest salient point as much as possible; the p i Point category center g(p i )∈C, is p i Classification function; idist(p i ,g(p i )) is the p i The point and the category center g(p i ), α is the distance control factor; Among them, E2(p i ,p i+1 )=cf(p i )+cf(p i+1 ); E2(p i ,p i+1 ) is the regular term of the segmentation cost function E(g), which is used to measure the dividing point of the partition at p i and p i+1 The non-smooth error caused by the above-mentioned protrusion indicative value of the sampling point is low, that is, the deep concave shape is divided; Wherein, λ=1 is a balance factor between the data term and the regular term; the loop boundary of the multi-label graph segmentation model satisfies: if i+1>n, the value of i+1 is modulo n; represents the segmentation g corresponding to the minimum value of E(g) among all possible segmentations g of the graph; The segmentation of the shape contour corresponds to a prominent branch of the shape; The step of extracting the companion point set of the salient point and the segmentation endpoint candidate set according to the salient branch comprises: The protruding branch The endpoints of the shape are added to the segmentation endpoint candidate set EP as the first segmentation endpoints; at the same time, the edge e located outside the shape is used ij , detect the extreme points of the deep concave area of the shape P as the second segmentation endpoints, and add them to the segmentation endpoint candidate set EP; The salient points correspond to the divided areas one by one, and the points falling within one of the divided areas are the companion point set corresponding to the salient point; that is, for the set of salient points C = {c1, c2, ..., c m }, highlighting the branch set B = {B1, B2, ..., B m } is the companion point set corresponding to the prominent point; The specific steps of decomposing the shape based on shape decomposition by recursive spectral clustering according to the salient points, the segmentation endpoint candidate set and the companion point set include: The visibility of the shape is used to establish a visibility matrix V = {v ij }; Among them, if point p i and p j are mutually visible, then v ij =1; if point p i and p j are not visible to each other, then v ij =0; For a strictly convex shape, any two points are visible to each other, then the decomposition solution is expressed as: Where T = {T1, T2, …, T t } represents the decomposition of shape P; C(T i ) is the decomposition sub-part T i The convexity measure of ; T' represents the one with the largest convexity measure among all possible decomposition schemes T; The convexity measure designed based on shape visibility is expressed as: Among them, |T i | refers to subsection T i The number of interior points, if T i is approximately convex, then C(T i ) is close to 1; Among them, for a given convexity measure C(T i ) and the number of decomposed parts t, through the visual graph<P,V> A decomposition solution T' with the maximum convexity measure is obtained by minimizing the standard cut on it; Recursive spectral clustering is used to solve the decomposition solution T' with the maximum convexity measure. The shape is decomposed into two parts in each iteration. The number of decompositions is t=2, including the following steps: With the help of Gaussian kernel, a new similarity matrix A = {a ij }, specifically expressed as: and ij =in ij *exp(-idist(p i ,p j ) 2 / σ 2 ) Among them, σ is the scale of the Gaussian kernel, taking the average of the internal distances between all point pairs, that is, Normalize the matrix A to Laplace to obtain the matrix L; and calculate the eigenvector η corresponding to the second smallest eigenvalue of the matrix L as the spectral coordinate representation of the sampling point on the shape; The current shape is divided into two decomposition parts T1 and T2, and the shape decomposition scheme of the recursive spectral clustering is expressed as: in, vol(T1) and vol(T2) correspond to the visible volumes of the decomposed parts T1 and T2, respectively. is the mutual visible volume between the two decomposed parts T1 and T2; A(p i ,p j ) refers to p in the similarity matrix A i and p j The corresponding element value; Candidate solutions for the shape decomposition scheme of recursive spectral clustering include: According to the spectral coordinate representation η of the shape, the shape is segmented by taking the representation value of each point in the segmentation endpoint candidate set EP as a threshold; Segment the shape using any two different points of the segmentation endpoint candidate set EP as segmentation endpoints; The minimum value among the candidate solutions represents the minimum segmentation among all valid segmentations of the shape, that is, the decomposition result of the shape.
Citation Information
Patent Citations
Spectral clustering method for automatically determining number of clusters based on neighboring point method
CN106991430A
Workpiece model contour line shape self-adaptive decomposition method and device
CN110276095A