Mural pigment edge virtual fitting method, system and equipment based on superpixel segmentation and medium
Through differential evolution strategy and objective function optimization, the problems of poor fit and large computing resource consumption in the edge recognition of mural pigments are solved, and high-precision superpixel segmentation is achieved, which improves the accuracy and efficiency of mural repair.
Patent Information
- Application Number
- CN202411111548.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-12-13
AI Technical Summary
In the prior art, the superpixel segmentation method based on seed dots has problems such as poor fit and high computing resource consumption when identifying edges of mural pigments, which affects the applicability of large-scale images.
Using the superpixel segmentation method based on differential evolution strategy, the objective function of comprehensive in-superpixel error, boundary gradient and regular terms is constructed, and iterative updates are performed to optimize the superpixel segmentation effect, and initialize and adjust using mesh division and nearest neighbor allocation methods. Seed points to improve segmentation effect.
The recognition accuracy of complex edges of mural pigments is improved, the problem of poor edge fitting is solved, and the boundary fitting of superpixel pigment color block boundaries is achieved, which improves the accuracy of repair.
Smart Images

Figure CN119131055A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of digital image processing, and in particular relates to a method, system, device and medium for virtual fitting of mural pigment edges based on superpixel segmentation. Background Art
[0002] Ancient murals are very old and have been affected by environmental and human factors, causing the paint to fade. It is difficult to identify the real pigment edges of murals during restoration. At present, there are two main superpixel segmentation methods for accurately identifying image edges: seed point-based and seed-free segmentation methods. The process of constructing and processing superpixel segmentation algorithms based on seed points is complex and requires more computing resources, resulting in large memory consumption and slow algorithm speed, which affects its applicability to large-scale images. The seed point-based method mainly relies on local clustering strategies and simple distance metrics based on color and space, resulting in poor fit between superpixel segmentation boundaries and real edges, resulting in color mixing inside superpixels. Summary of the invention
[0003] The purpose of the present invention is to provide a method, system, device and medium for virtual fitting of mural pigment edges based on superpixel segmentation to solve the problems existing in the above-mentioned prior art.
[0004] To achieve the above object, the present invention provides a method for virtual fitting of mural pigment edges based on superpixel segmentation, comprising:
[0005] Initialize each superpixel seed point in the mural image, divide the mural image into a number of square areas, perform kernel point sampling on the superpixel seed points in each of the square areas, obtain a number of kernel points and construct a kernel point set; the kernel point is composed of the image plane coordinates and feature vectors of the corresponding superpixel seed point;
[0006] Based on the core point set, an initial population is constructed, each core point in the core point set is combined with an individual parameter vector of the population to obtain a number of candidate seed sets, and a candidate label matrix corresponding to each candidate seed set is generated based on a nearest neighbor assignment method; the candidate label matrix includes candidate seed points, a number of superpixel seed points and corresponding superpixel category labels;
[0007] The boundary gradient and regularization term are introduced to construct the superpixel segmentation effect objective function with the goal of minimizing the error within the superpixel.
[0008] The superpixel segmentation effect of each candidate label matrix on the superpixel segmentation effect objective function is calculated, and the initial population is iteratively updated based on the superpixel segmentation effect corresponding to each candidate label matrix. After iterative updating to a preset number of iterations, the optimal superpixel segmentation effect is output.
[0009] Optionally, the feature vector includes color features, texture features, spatial features and gradient features of the superpixel seed point.
[0010] Optionally, each core point in the core point set is combined with a population individual parameter vector to obtain several candidate seed sets, specifically including:
[0011] The position of each core point is adjusted based on the population individual parameter vector, the adjusted position of each core point on the image plane is updated, the updated position of each core point is used as a candidate seed point and a candidate seed set is constructed.
[0012] Optionally, generating a candidate label matrix corresponding to each candidate seed set based on a nearest neighbor assignment method specifically includes:
[0013] The metric distance between each superpixel seed point and each candidate seed point in the candidate seed set is calculated, and each superpixel seed point is assigned to the nearest candidate seed point based on the calculated metric distance, and a superpixel category label corresponding to the nearest candidate seed point is assigned.
[0014] Optionally, the metric distance between each superpixel seed point and each candidate seed point in the candidate seed set is calculated, and the specific calculation formula is:
[0015]
[0016] Where a is the candidate seed point, b is the superpixel seed point, and w s and w g is the distance relative importance coefficient, d c ,d s and d g are the color, spatial, and contour distance components, respectively.
[0017] Optionally, the superpixel segmentation effect objective function is specifically:
[0018] F(S i ,L i )=f1(S i ,L i )+λ·(-1)·f2(L i )+γ·f3(L i )
[0019] Where f1, f2 and f3 are the superpixel intra-error, boundary gradient and regularization terms respectively, S i is the candidate seed set, L i is the candidate label matrix, λ and γ are the relative influence parameters.
[0020] Optionally, the initial population is iteratively updated based on the superpixel segmentation effect corresponding to each of the candidate label matrices, specifically including:
[0021] Based on the superpixel segmentation effect corresponding to each candidate label matrix combined with the differential evolution algorithm, the initial population is iteratively updated through mutation, crossover and selection operations. After iterative updating to a preset number of iterations, the optimal superpixel segmentation effect is output.
[0022] A mural pigment edge virtual fitting system based on superpixel segmentation, comprising:
[0023] A seed point initialization module is used to initialize each superpixel seed point in the mural image, divide the mural image into a number of square areas, perform kernel point sampling on the superpixel seed points in each of the square areas, obtain a number of kernel points and construct a kernel point set; the kernel point is composed of the image plane coordinates and feature vectors of the corresponding superpixel seed point;
[0024] A label matrix initialization module is used to construct an initial population based on the core point set, so that each core point in the core point set is combined with the population individual parameter vector to obtain a number of candidate seed sets, and a candidate label matrix corresponding to each candidate seed set is generated based on the nearest neighbor assignment method; the candidate label matrix includes candidate seed points, a number of superpixel seed points and corresponding superpixel category labels;
[0025] The objective function construction and optimization module is used to introduce boundary gradients and regularization terms to construct a superpixel segmentation effect objective function with the goal of minimizing the error within the superpixel; calculate the superpixel segmentation effect of each candidate label matrix on the superpixel segmentation effect objective function, iteratively update the initial population based on the superpixel segmentation effect corresponding to each candidate label matrix, and after iteratively updating to a preset number of iterations, output the optimal superpixel segmentation effect.
[0026] An electronic device comprises a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute a mural pigment edge virtual fitting method based on superpixel segmentation.
[0027] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements a mural paint edge virtual fitting method based on superpixel segmentation.
[0028] The technical effects of the present invention are:
[0029] The method for virtual fitting of complex edges of mural pigments based on differential evolution superpixel segmentation of the present invention is based on differential evolution strategy, and constructs an objective function that integrates superpixel intra-error, boundary gradient and regularization term to improve the traditional superpixel segmentation method based on seed points, thereby realizing global optimization of superpixel segmentation area. The initial superpixel seed points are selected according to the grid division rules and local clustering is performed, and the segmentation effect is evaluated by calculating the objective function value of the current seed point set. The superpixel seed point area is iteratively updated and the effectiveness is evaluated according to the feedback of the objective function until the superpixel segmentation result with the best objective function evaluation is obtained. The problem of complex edges and uneven textures between different categories of pigments in mural images under the interference of diseases and poor edge fitting during restoration is solved, and the recognition accuracy of complex edges of mural pigments is effectively improved, providing regular and boundary-fitting superpixel pigment color block boundaries for virtual restoration. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0031] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0032] Figure 1 is a mural test data image in an embodiment of the present invention;
[0033] Figure 2 A comparison diagram of superpixel segmentation results of simulated murals in an embodiment of the present invention;
[0034] Figure 3 This is a comparison diagram of superpixel segmentation results of real murals in an embodiment of the present invention;
[0035] Figure 4 It is an implementation flow chart of an embodiment of the present invention. DETAILED DESCRIPTION
[0036] Various exemplary embodiments of the present invention will now be described in detail. This detailed description should not be considered as limiting the present invention, but should be understood as a more detailed description of certain aspects, features, and embodiments of the present invention.
[0037] It should be understood that the terms described in the present invention are only for describing special embodiments and are not intended to limit the present invention. In addition, for the numerical range in the present invention, it should be understood that each intermediate value between the upper and lower limits of the scope is also specifically disclosed. Each smaller range between the intermediate value in any stated value or stated range and any other stated value or intermediate value in the described range is also included in the present invention. The upper and lower limits of these smaller ranges can be independently included or excluded in the scope.
[0038] Unless otherwise indicated, all technical and scientific terms used herein have the same meanings as those of ordinary skill in the art generally understood by the present invention. Although the present invention describes only preferred methods, any method similar or equivalent to that described herein may also be used in the implementation or testing of the present invention. All documents mentioned in this specification are incorporated by reference to disclose and describe the methods related to the documents. In the event of a conflict with any incorporated document, the content of this specification shall prevail.
[0039] It will be apparent to those skilled in the art that various modifications and variations may be made to the specific embodiments of the present invention description without departing from the scope or spirit of the present invention. Other embodiments derived from the present invention description will be apparent to those skilled in the art. The present application description and examples are exemplary only.
[0040] The words “include,” “including,” “have,” “contain,” etc. used in this article are open-ended terms, meaning including but not limited to.
[0041] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0042] Embodiment 1
[0043] like Figure 1 - Figure 4As shown, in this embodiment, a method for virtual fitting of mural pigment edges based on superpixel segmentation is provided, including: initializing each superpixel seed point in the mural image, dividing the mural image into a number of square areas, performing kernel point sampling on the superpixel seed points in each of the square areas, obtaining a number of kernel points and constructing a kernel point set; the kernel point is composed of the image plane coordinates and feature vectors of the corresponding superpixel seed point; constructing an initial population based on the kernel point set, so that each kernel point in the kernel point set is combined with the individual parameter vector of the population to obtain a number of candidate seed sets, and generating a candidate label matrix corresponding to each of the candidate seed sets based on the nearest neighbor assignment method; the candidate label matrix includes candidate seed points, a number of superpixel seed points and corresponding superpixel category labels; introducing boundary gradients and regularization terms to construct a superpixel segmentation effect objective function with the goal of minimizing the error within the superpixel; calculating the superpixel segmentation effect of each of the candidate label matrices on the superpixel segmentation effect objective function, iteratively updating the initial population based on the superpixel segmentation effect corresponding to each of the candidate label matrices, and outputting the optimal superpixel segmentation effect after iteratively updating to a preset number of iterations.
[0044] The technical idea of this embodiment is to construct an objective function that integrates the intra-superpixel error, boundary gradient and regularization term based on the differential evolution strategy, improve the traditional superpixel segmentation method based on seed points, and achieve global optimization of the superpixel segmentation area. The superpixel seed point area is iteratively updated and evaluated for effectiveness using the feedback of the objective function until a superpixel segmentation result with the best objective function evaluation is obtained.
[0045] This embodiment provides a method for virtual fitting of complex edges of mural pigments based on differential evolution superpixel segmentation, comprising the following steps:
[0046] Step 1) Initialize superpixel seed points and generate corresponding feature vectors.
[0047] Step 2) construct an objective function that integrates the intra-superpixel error, boundary gradient and regularization term, and use the feedback of the objective function to iteratively update and evaluate the effectiveness of the superpixel seed point area until the superpixel segmentation result with the best objective function evaluation is obtained.
[0048] Step 3) Merge the isolated pixels into the superpixels with the closest surrounding feature distance and assign new class labels to strengthen the connectivity between superpixels.
[0049] According to this embodiment, the specific method of initializing superpixel seed points and generating corresponding feature vectors in step 1) is: first, the seed points are initialized by adopting a grid layout, and the feature vector of each seed point is formed by using information such as color and texture. Subsequently, the initialization of the core point set ensures uniform sampling from the image to form uniformly distributed core points, while adopting a strategy to avoid sampling on the edge of the image or noise pixels. Finally, the label matrix is initialized by performing nearest neighbor assignment on the candidate seed set to ensure that each pixel is correctly labeled to the nearest seed. The specific steps are as follows:
[0050] a) Initialize seed points and their feature vectors: Use grid layout to initialize seed points and generate candidate seed sets s for each superpixel block i =[s i,1 ,s i,2 ,…s i,K ], and the feature vector [l,a,b,x,y,δ] composed of color, texture and other information T To represent each seed point of the image, l, a, b represent the color components in the CIELAB space, x and y represent the pixel coordinates, i.e., the spatial features, and δ represents the pixel gradient features.
[0051] b) Initialize the evolution core point set: The core point set c consists of K points, each of which is represented by a feature vector [l k ,a k ,b k ,x k ,y k ,δ k ] T and the image plane coordinates (x k ,y k )(k=1,2,…,K) are used to represent the kernel points. During initialization, the kernel points are uniformly sampled from the image, that is, the image is divided into K uniform squares of size S×S, where The kth initial point is located at the center of the kth square (x k ,y k ) pixels. In order to reduce the risk of sampling kernel points on image edges or noise pixels, (x k ,y k ) moves to the position with the smallest gradient in its 3×3 neighborhood, and then retrieves c k In (x k ,y k ) is the eigenvector at .
[0052] The DE population consists of P individuals: X1, X2, …, X P ,Right now:
[0053] X i =[p i,1,p i,2 ,…,p i,D ],p i,j ∈[-S / 2,S / 2] (1)
[0054] Where D = 2K. For integer k∈{1,2,…,K}, X i (p i,2k-1 ,p i,2k ) represents the differential length of the coordinates of the kth kernel point in the vertical and horizontal directions on the image plane. Various candidate seed sets are obtained by combining individuals and kernel points. In initialization, the population of DE is randomly generated:
[0055] p i,j =-S / 2+rand i,j (0,1)·S (2)
[0056] Where i = 1, 2, ..., P, j = 1, 2, ..., D, rand i,j is a uniform random number between 0 and 1.
[0057] c) Initialize the label matrix: During the label assignment process, P individuals are decoded into P candidate seed sets. Perform nearest neighbor assignment on each candidate seed set to obtain P candidate label matrices. The specific steps are as follows:
[0058] Given a single X i , the candidate seed set is retrieved in the following way. For X i Each of the i,2k-1 ,p i,2k ), by calculating the k-th core point (x k ,y k ) to obtain its new position on the image plane:
[0059]
[0060] In the formula, i=1,2,…,P,j=1,2,…,D. Then use each Retrieve feature vectors Calculate the kth candidate seed of individual i as:
[0061]
[0062] Wherein, “⊕” is the addition of components, and q=0.1 is a constant, which indicates the correction rate of the core point.
[0063] In getting i =[s i,1 ,s i,2 ,…,s i,K], a superpixel labeling matrix L is obtained by pixel allocation i That is, each pixel of the image is assigned the value of its nearest seed in s i The distance metric used is defined as follows: Given two points a=[l a ,α a ,β a ,μ a ,ν a ,δ a ] T and b = [l b ,α b ,β b ,μ b ,ν b ,δ b ] T , the distance between the two points is:
[0064]
[0065] In the formula, the coefficient w s and w g The relative importance of the three distances was determined and set to 0.005 and 0.3, respectively. c d s and d g are the color, space and contour distance components, and the calculation formulas are:
[0066]
[0067] Furthermore, the specific method of constructing an objective function that integrates superpixel intra-error, boundary gradient and regularization term described in step 2) and using the feedback of the objective function to iteratively update and evaluate the effectiveness of the superpixel seed point area is as follows: first, a superpixel label matrix is generated using the nearest neighbor assignment method, and the quality of the generated superpixel label matrix is evaluated using the objective function that integrates superpixel intra-error, boundary gradient and regularization term. The local spatial similarity is enhanced by minimizing the error within the superpixel region, the boundary gradient is introduced to improve the accuracy of edge recognition between different pigments, and superpixel blocks of similar size are generated by regularization. Then, the differential evolution algorithm is applied to continuously update the evolution kernel point set and the differential evolution population through mutation, crossover and selection operations, thereby optimizing the superpixel segmentation effect. The specific steps are as follows:
[0068] a) For a given seed set S i and label matrix L i , the optimization objective function is defined as:
[0069] F(S i ,L i )=f1(S i ,Li )+λ·(-1)·f2(L i )+γ·f3(L i ) (7)
[0070] Where f1, f2, and f3 represent the intra-superpixel error, boundary gradient, and regularization term, respectively. Since f1 and f3 are minimized while maximizing f2, f2 is prefixed with a minus sign in the aggregation. The relative influence of the three terms is controlled by the parameters λ and γ, which are fixed to constant values.
[0071] (1) Error within a superpixel: The error within a superpixel region is defined as the mean square error (MSE) of assigning each pixel to its nearest seed:
[0072]
[0073] In the formula, p i is the feature vector of the i-th pixel, l = L i (j) is the pixel label, s i,l is the feature of the seed, d is the distance metric defined in Eq. (5), and f1 evaluates the local color uniformity within the superpixel.
[0074] (2) Boundary gradient: For each position in a superpixel, there are eight neighbors in its 3×3 neighborhood. If some of the neighboring labels are different from the label of the current position, then the position belongs to the superpixel boundary. For a given L i , shift the matrix by one unit in eight directions to generate eight adjacent matrices The true value of whether the jth position in belongs to the superpixel boundary can be calculated by formula (9), as follows:
[0075]
[0076] Where is the true value indicator function. Through the above calculation, the superpixel boundary map of individual i is obtained. Normalization is performed to obtain the gradient δ of each pixel, and the gradient map of the entire image I is represented as ΔI.
[0077] The calculation formula of the boundary gradient term in the objective function is:
[0078]
[0079] Where f2 is the average gradient value of the superpixel boundary, which indicates the edge fit of individual i.
[0080] (3) Regularization term: An image with N pixels is divided into K superpixels, so the expected number of pixels assigned to each superpixel is C m =N / K. Regularization penalizes the number of pixels that are far from C mThe superpixel is defined as:
[0081]
[0082] In the formula, Indicates the number of pixels assigned to each seed.
[0083] After evaluating P individuals in the population, the best individual with the smallest objective function value can be found in the population. The smaller the objective function value, the higher the evaluation score.
[0084] b) Maintain and evolve the superpixel seed set through a population-based differential evolution optimizer. Each individual i is a parameter vector X i , can be decoded as a candidate solution. At the same time, DE maintains a core point set c = [c1, c2, …c K The interaction between the parameter vector and the kernel point set is bidirectional: on the one hand, each individual i has its own parameter vector X i The candidate seed set s is retrieved by combining with the core point set c i On the other hand, the core point set c is updated according to the individual superpixel segmentation result with the best objective evaluation. The segmentation effect is evaluated according to the comprehensive evaluation objective function, and one of the three genetic operators, namely mutation, crossover and selection, is updated as a new individual in each iteration step.
[0085] (1) Mutation: In evolutionary biology, a “mutation” refers to a random and sudden perturbation of an individual’s genotype that subsequently changes the product of the gene. In DE mutation, for each individual i, a mutation vector V is created. i =[v i,1 ,v i,2 ,…,v i,D ]for:
[0086]
[0087] In the formula, X bsf =[p bsf,1 ,p bsf,2 ,…,p bsf,D ] is the optimal fitting individual, r1 and r2 are two randomly generated indicators, the coefficient 0.5 is a scalar factor, i = 1, 2,…, P, j = 1, 2,…, D.
[0088] (2) Crossover: Crossover is to combine the current individual with the mutation carrier to produce an offspring, called the test carrier. In DE, binomial crossover is used, X i =[p i,1 ,p i,2 ,…,p i,D ] with 90% probability from the mutation vector V iRandomly exchange some components in the test vector. Let the test vector be U i =[u i,1 ,u i,2 ,…,u i,D ], calculated as:
[0089]
[0090] In the formula, rand i,j (0,1) is a uniform random number generator, j rnd is a random dimension index to keep the trial vectors with a single X i At least one dimension is different.
[0091] (3) Selection: Select good genotypes and discard bad genotypes to the next generation. In this process, the fitness of the test vector generated in formula (13) is evaluated, and then the individual X i Updated to:
[0092]
[0093] The population will be preserved according to the individuals that are more suitable for the environment. When the number of individuals in the population remains unchanged, the seed point will develop towards the minimization of the objective function.
[0094] In order to verify the application effect of the virtual fitting method of complex edge of mural pigment based on differential evolution superpixel segmentation proposed in this paper in actual situations, the application effect test was carried out on a simulated mural and a real mural respectively. SEEDS, SNIC, NMI_SLIC, LSC, and SLIC0 methods were selected to compare the superpixel segmentation results of the mural. The results showed that the integrity of the segmentation results based on the differential evolution superpixel algorithm was high, the color and texture inside each superpixel were highly consistent, showing good regional uniformity, and overall better than the other five algorithms.
[0095] Figure 1 The mural test data images are shown, where (a) is a simulated mural of bird watching and cicada catching, and (b) is a local area image of the cuff of the right clothing of the image of Venerable Ingarata;
[0096] Figure 2 The following is a comparison of the superpixel segmentation results of the simulated mural. The superpixel segmentation scale of the first and third rows is 10×10, which divides the image into nearly 5000 superpixel blocks. (a) The SEEDS algorithm is used for local magnification. Figure 1 The edge of the eyebrows is not close enough, so it is necessary to enlarge the part Figure 2The segmentation effect of the bird’s wings and the background is good, but the recognition effect of the bird’s head boundary is poor; (b) is the test result of the SLIC0 algorithm; (c) is the test result of the SNIC algorithm; (d) is the test result of the NMI_SLIC algorithm. The NMI_SLIC algorithm has poor local Figure 1 The fit is high, but the shape of the superpixel block is irregular and the visual effect is messy; (e) is the test result of the LSC algorithm; (f) is the test result of the differential evolution superpixel segmentation algorithm. It can be seen that the color and texture inside each superpixel in the result image based on the differential evolution superpixel segmentation algorithm are highly consistent, showing good regional uniformity, which is generally better than the other five algorithms.
[0097] Figure 3 This is a comparison of the superpixel segmentation results of a real mural. The superpixel segmentation scale in the figure is 16×16, and the number of superpixels is about 5500. (a) is the test result of the SEEDS algorithm; (b) is the test result of the SLIC0 algorithm; (c) is the test result of the SNIC algorithm; (d) is the test result of the NMI_SLIC algorithm; (e) is the test result of the LSC algorithm; (f) is the test result of the differential evolution superpixel segmentation algorithm. It can be seen that the result of the differential evolution superpixel segmentation algorithm has a high integrity, the size of the superpixel block is relatively uniform and the shape is regular, and each superpixel block basically contains only one pigment, which effectively improves the segmentation accuracy.
[0098] A mural pigment edge virtual fitting system based on superpixel segmentation, comprising:
[0099] A seed point initialization module is used to initialize each superpixel seed point in the mural image, divide the mural image into a number of square areas, perform kernel point sampling on the superpixel seed points in each of the square areas, obtain a number of kernel points and construct a kernel point set; the kernel point is composed of the image plane coordinates and feature vectors of the corresponding superpixel seed point;
[0100] A label matrix initialization module is used to construct an initial population based on the core point set, so that each core point in the core point set is combined with the population individual parameter vector to obtain a number of candidate seed sets, and a candidate label matrix corresponding to each candidate seed set is generated based on the nearest neighbor assignment method; the candidate label matrix includes candidate seed points, a number of superpixel seed points and corresponding superpixel category labels;
[0101] The objective function construction and optimization module is used to introduce boundary gradients and regularization terms to construct a superpixel segmentation effect objective function with the goal of minimizing the error within the superpixel; calculate the superpixel segmentation effect of each candidate label matrix on the superpixel segmentation effect objective function, iteratively update the initial population based on the superpixel segmentation effect corresponding to each candidate label matrix, and after iteratively updating to a preset number of iterations, output the optimal superpixel segmentation effect.
[0102] An electronic device comprises a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute a mural pigment edge virtual fitting method based on superpixel segmentation.
[0103] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements a mural paint edge virtual fitting method based on superpixel segmentation.
[0104] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for virtual fitting of mural pigment edges based on superpixel segmentation, characterized in that: include: Initialize each superpixel seed point in the mural image, divide the mural image into a number of square areas, perform kernel point sampling on the superpixel seed points in each of the square areas, obtain a number of kernel points and construct a kernel point set; the kernel point is composed of the image plane coordinates and feature vectors of the corresponding superpixel seed point; Based on the core point set, an initial population is constructed, each core point in the core point set is combined with an individual parameter vector of the population to obtain a number of candidate seed sets, and a candidate label matrix corresponding to each candidate seed set is generated based on a nearest neighbor assignment method; the candidate label matrix includes candidate seed points, a number of superpixel seed points and corresponding superpixel category labels; The boundary gradient and regularization term are introduced to construct the superpixel segmentation effect objective function with the goal of minimizing the error within the superpixel. The superpixel segmentation effect of each candidate label matrix on the superpixel segmentation effect objective function is calculated, and the initial population is iteratively updated based on the superpixel segmentation effect corresponding to each candidate label matrix. After iterative updating to a preset number of iterations, the optimal superpixel segmentation effect is output.
2. The method for virtual fitting of mural pigment edges based on superpixel segmentation according to claim 1, characterized in that: The feature vector includes color features, texture features, spatial features and gradient features of the superpixel seed point.
3. The method for virtual fitting of mural pigment edges based on superpixel segmentation according to claim 1, characterized in that: Each core point in the core point set is combined with the population individual parameter vector to obtain several candidate seed sets, specifically including: The position of each core point is adjusted based on the population individual parameter vector, the adjusted position of each core point on the image plane is updated, the updated position of each core point is used as a candidate seed point and a candidate seed set is constructed.
4. The method for virtual fitting of mural pigment edges based on superpixel segmentation according to claim 1, characterized in that: Generating a candidate label matrix corresponding to each candidate seed set based on the nearest neighbor assignment method specifically includes: The metric distance between each superpixel seed point and each candidate seed point in the candidate seed set is calculated, and each superpixel seed point is assigned to the nearest candidate seed point based on the calculated metric distance, and a superpixel category label corresponding to the nearest candidate seed point is assigned.
5. The method for virtual fitting of mural pigment edges based on superpixel segmentation according to claim 4 is characterized in that: Calculate the metric distance between each superpixel seed point and each candidate seed point in the candidate seed set. The specific calculation formula is: Where a is the candidate seed point, b is the superpixel seed point, and w s and w g is the distance relative importance coefficient, d c ,d s and d g are the color, spatial and contour distance components, respectively.
6. The method for virtual fitting of mural pigment edges based on superpixel segmentation according to claim 1, characterized in that: The superpixel segmentation effect objective function is specifically: F(Si,Li)=f1(Si,Li)+λ·(-1)·f2(Li)+γ·f3(Li) Where f1, f2 and f3 are the superpixel intra-error, boundary gradient and regularization terms respectively, S i is the candidate seed set, L i is the candidate label matrix, λ and γ are the relative influence parameters.
7. The method for virtual fitting of mural pigment edges based on superpixel segmentation according to claim 1, characterized in that: The initial population is iteratively updated based on the superpixel segmentation effect corresponding to each candidate label matrix, specifically including: Based on the superpixel segmentation effect corresponding to each candidate label matrix combined with the differential evolution algorithm, the initial population is iteratively updated through mutation, crossover and selection operations. After iterative updating to a preset number of iterations, the optimal superpixel segmentation effect is output.
8. A mural pigment edge virtual fitting system based on superpixel segmentation, characterized in that: include: A seed point initialization module is used to initialize each superpixel seed point in the mural image, divide the mural image into a number of square areas, perform kernel point sampling on the superpixel seed points in each of the square areas, obtain a number of kernel points and construct a kernel point set; the kernel point is composed of the image plane coordinates and feature vectors of the corresponding superpixel seed point; A label matrix initialization module is used to construct an initial population based on the core point set, so that each core point in the core point set is combined with the population individual parameter vector to obtain a number of candidate seed sets, and a candidate label matrix corresponding to each candidate seed set is generated based on the nearest neighbor assignment method; the candidate label matrix includes candidate seed points, a number of superpixel seed points and corresponding superpixel category labels; The objective function construction and optimization module is used to introduce boundary gradients and regularization terms to construct a superpixel segmentation effect objective function with the goal of minimizing the error within the superpixel; calculate the superpixel segmentation effect of each candidate label matrix on the superpixel segmentation effect objective function, iteratively update the initial population based on the superpixel segmentation effect corresponding to each candidate label matrix, and after iteratively updating to a preset number of iterations, output the optimal superpixel segmentation effect.
9. An electronic device, characterized in that: It includes a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute a mural pigment edge virtual fitting method based on superpixel segmentation according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed by a processor, implements a mural pigment edge virtual fitting method based on superpixel segmentation as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Semi-supervised intuitive clustering method based on decomposition of multi-target differential evolution superpixels
CN113469270A
Method and apparatus for generating temporally consistent superpixels
EP2958077A1
