Image processing method, device, equipment and storage medium
By determining the influence area and sampling point position of the wire on the scalp model, and calculating the interpolation weight of the target wire, and constructing a special-effect image for growing hair, the problem of heavy workload in the prior art is solved and more efficient image processing is achieved.
Patent Information
- Application Number
- CN202210872074.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-22
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2042-07-22
AI Technical Summary
In the prior art, when constructing special effects images of growing hair, it is necessary to pre-construct hair at the vertices of each triangle area, resulting in a large workload.
By determining the wire-influence area corresponding to the initial conductor for guiding hair growth on the scalp model, the sampling point position for hair growth is determined on the scalp model, and the interpolation weight of the target conductor corresponding to the sampling point position in the initial conductor is determined based on the wire-influence area, thereby constructing a special effect image of growing hair from the sampling point position.
The limitations on the position and number of initial wires are eliminated, reducing the number of initial wires, thereby reducing the workload of image processing.
Smart Images

Figure CN115131537B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer technology, and in particular, to an image processing method, apparatus, device, and storage medium. Background Art
[0002] With the development of image processing technology, image processing is often required to construct special effects images of growing hair in scenes such as game production and movie production.
[0003] At present, the image processing method used to construct the special effects image of growing hair is as follows: first, import the scalp model represented by a triangular mesh. Then, construct the hair at the vertex of each triangular area. Then, randomly generate a large number of sampling point positions on the scalp model, and interpolate the hair at the three vertices of the triangular area where the sampling point position is located and its corresponding barycentric coordinates to generate the corresponding hair. It can be seen that in order to interpolate and generate hair, this image processing method needs to construct the hair at the vertex of each triangular area in advance, and usually the number of triangular areas on the scalp model is huge. Therefore, the number of hair that needs to be constructed in advance is huge, resulting in a large workload. Summary of the invention
[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the embodiments of the present disclosure provide an image processing method, apparatus, device and storage medium.
[0005] A first aspect of an embodiment of the present disclosure provides an image processing method, the method comprising:
[0006] Determining the wire influence area corresponding to the initial wire for guiding hair growth on the scalp model;
[0007] Determine sampling point positions for hair growth on the scalp model, and determine interpolation weights of target wires in the initial wires corresponding to the sampling point positions according to the wire influence area;
[0008] According to the interpolation weight of the target wire, a special effect image of growing hair from the sampling point position is constructed.
[0009] A second aspect of an embodiment of the present disclosure provides an image processing device, the device comprising:
[0010] A first determination module is used to determine a wire influence area corresponding to an initial wire for guiding hair growth on a scalp model;
[0011] A second determination module is used to determine the sampling point position for hair growth on the scalp model, and determine the interpolation weight of the target wire in the initial wire corresponding to the sampling point position according to the wire influence area;
[0012] A construction module is used to construct a special effect image of growing hair from the sampling point position according to the interpolation weight of the target wire.
[0013] A third aspect of an embodiment of the present disclosure provides an electronic device, comprising: a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the method in the above-mentioned first aspect.
[0014] A fourth aspect of an embodiment of the present disclosure provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method in the first aspect can be implemented.
[0015] In a fifth aspect, the present disclosure provides a computer program product, which includes a computer program / instructions. When the computer program / instructions are executed by a processor, the method in the first aspect is implemented.
[0016] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0017] In the embodiment of the present disclosure, by determining the wire influence area corresponding to the initial wire for guiding hair growth on the scalp model, the sampling point position for hair growth is determined on the scalp model, and the interpolation weight of the target wire corresponding to the sampling point position in the initial wire is determined according to the wire influence area, so that a special effect image of hair growing from the sampling point position can be constructed according to the interpolation weight of the target wire. It can be seen that in the embodiment of the present disclosure, the target wire corresponding to the sampling point position and the interpolation weight of the target wire can be determined from the initial wire according to the wire influence area, instead of fixing the hair constructed at the three vertices of the triangular area where the sampling point position is located as the target wire and using the centroid coordinates as the interpolation weight as in the prior art. In this way, the restrictions on the position and number of the initial wires are eliminated, and there is no need to construct the initial wire at the vertex of each triangular area as in the prior art, which is conducive to reducing the number of initial wires, thereby reducing the workload of image processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0019] 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 or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0020] Figure 1 A flowchart of an image processing method provided by an embodiment of the present disclosure;
[0021] Figure 2 A schematic diagram of a 3D scalp model with an initial wire provided in an embodiment of the present disclosure;
[0022] Figure 3 A schematic diagram of a special effect image provided by an embodiment of the present disclosure;
[0023] Figure 4 A flowchart of another image processing method provided by an embodiment of the present disclosure;
[0024] Figure 5 A schematic diagram of the structure of a Voronoi diagram provided in an embodiment of the present disclosure;
[0025] Figure 6 A schematic diagram of the structure of a wire influence area provided in an embodiment of the present disclosure;
[0026] Figure 7 A flowchart of another image processing method provided by an embodiment of the present disclosure;
[0027] Figure 8 A flowchart of another image processing method provided by an embodiment of the present disclosure;
[0028] Fig. 9 A schematic diagram of the structure of an image processing device provided by an embodiment of the present disclosure;
[0029] Fig.10 It is a structural schematic diagram of an electronic device in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0031] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0032] Figure 1 The present invention provides a flowchart of an image processing method according to an embodiment of the present invention. The method can be performed by an electronic device. The electronic device can be exemplarily understood as a device such as a mobile phone, a tablet computer, a laptop computer, a desktop computer, a smart TV, etc. Figure 1As shown, the method provided in this embodiment includes the following steps:
[0033] S110: Determine a guide wire influence area corresponding to an initial guide wire for guiding hair growth on the scalp model.
[0034] In the disclosed embodiments, the image processing method can be applied to application scenarios such as video creation or image processing that require growing hair on a scalp model, wherein the scalp model can be a two-dimensional (2Dimension) scalp model or a three-dimensional (3Dimension) scalp model, without limitation. For example, in 3D application scenarios, such as the production process of 3D games and 3D movies, it is often necessary to build multiple virtual models, such as 3D digital humans, and it is usually necessary to build a special effect image of growing hair for the scalp model on the 3D digital human to dress up the digital human. However, this is not convenient.
[0035] For example, Figure 2 A schematic diagram of a 3D scalp model with an initial wire provided in an embodiment of the present disclosure. Figure 2 , a plurality of initial wires 220 are pre-constructed on the 3D scalp model 210 .
[0036] Specifically, the initial wires are wires pre-built on the scalp model, and the wires can be understood as hair. The number, shape, and root point positions of the initial wires can be set by those skilled in the art according to actual conditions and are not limited here.
[0037] The initial guide wire can be constructed as follows: first construct a line segment (usually a straight line segment), and then shape the line segment by modifying the number and position of key points on the line segment to make it become or approach the desired hair shape, thereby obtaining the initial guide wire, but it is not limited to this.
[0038] Specifically, the wire influence area is used to characterize the area influenced by the initial wire. In other words, the initial wire has an influence on the shape of the wire to be added at the sampling point position under the wire influence area.
[0039] In some embodiments, S110 may include: taking an area formed by points on the scalp model whose distance from the root point of the initial guide wire is less than a preset distance as the influence area of the initial guide wire, but is not limited thereto.
[0040] Specifically, the root point position of the initial wire is the position of the root point (or growth point) of the initial wire on the scalp model.
[0041] In some other embodiments, S110 may also include: determining the root point positions of N (N is an integer greater than 2) initial wires on the scalp model that are closest to the root point position of the initial wire; connecting the root point positions of the N initial wires to form an influence area of the initial wire, but is not limited to this.
[0042] S120: Determine sampling point positions for hair growth on the scalp model, and determine interpolation weights of target wires in the initial wires corresponding to the sampling point positions according to the wire influence area.
[0043] Specifically, the sampling point position is the position (eg coordinate) of the sampling point on the scalp model, and the sampling point position is used to grow the wire to be added, which is the wire interpolated according to the interpolation weight of the target wire corresponding to the sampling point position.
[0044] In some embodiments, determining the sampling point locations for hair growth may include: randomly generating sampling point locations on a scalp model, but is not limited thereto.
[0045] Specifically, the target wire corresponding to the sampling point position is an initial wire that has an influence on the shape of the wire to be added at the sampling point position.
[0046] Specifically, the interpolation weight is used to characterize the influence of the target wire on the shape of the wire to be added.
[0047] In some embodiments, determining the interpolation weight of the target wire corresponding to the sampling point position in the initial wire according to the wire influence area may include: determining the initial wire corresponding to the wire influence area where the sampling point position is located as the target wire corresponding to the sampling point position; and determining the interpolation weight of the target wire based on the principle that the distance between the root point position of the target wire and the sampling point position is positively correlated with the interpolation weight of the target wire, but is not limited thereto.
[0048] S130. Construct a special effects image of hair growing from the sampling point position according to the interpolation weight of the target wire.
[0049] Specifically, the special effect image is an image after adding the wire to be added at at least one sampling point position of the scalp model.
[0050] In some embodiments, S130 may include: constructing a special effect image of growing hair from the sampling point position according to the interpolation weight of the target wire and the key point position of the target wire, but is not limited thereto.
[0051] In other embodiments, S130 may include: constructing a special effects image of hair growing from the sampling point position according to the interpolation weight of the target wire and the shape of a preset reference segment of the target wire (such as the tip of the hair, the middle section of the hair, the whole hair, etc.), but is not limited to this.
[0052] In one example, the logic of the image processing process may be as follows: determining the wire influence area corresponding to each initial wire on the scalp model; determining multiple sampling point positions on the scalp model; for each sampling point position, determining the target wire corresponding to the sampling point position and the interpolation weight of the target wire according to the guide influence area corresponding to each initial wire, and constructing the wire to be added at the sampling point position according to the interpolation weight of the target wire corresponding to the sampling point position.
[0053] For example, Figure 3 A schematic diagram of a special effect image provided by an embodiment of the present disclosure. Figure 2 and Figure 3 , using the image processing method described in any of the above embodiments Figure 2 Growing hair on the 3D scalp model 210 can obtain Figure 3 The special effects image shown, Figure 3 In order to distinguish the initial wire 210 from the hair 230 growing from the sampling point, a thinner curve is used to represent the initial wire 210, and a thicker curve is used to represent the hair 230 growing from the sampling point.
[0054] It is understandable that the hair on the scalp model has a complex direction and a huge number of hairs, which is very difficult to produce manually. In the prior art, it is necessary to manually produce wires at the vertices of each triangular area of the scalp model, and then generate wires at the sampling point position through barycentric coordinate interpolation to obtain a special effect image of growing hair. Since the quality of the special effect image of growing hair is closely related to the number and shape of the wires, when you want to get a high-quality special effect image, the number of triangular areas on the scalp model is usually huge, which makes the number of wires that need to be manually produced huge, resulting in a large workload.
[0055] After analyzing the prior art, the applicant found that the prior art simply uses the barycentric coordinates as the interpolation weight, and is unable to calculate the interpolation weight for the wires outside the triangular area where the sampling point is located, resulting in the target wire corresponding to the sampling point being fixed as the wire on the vertex of the triangular area where it is located, which in turn results in the need to pre-build the initial wire at the vertex of each triangular area. In view of this, a new interpolation weight calculation method is adopted in the embodiment of the present disclosure, which can determine the interpolation weight of the target wire according to the wire influence area of the initial wire, so that the interpolation weight of any position and any number of target wires can be calculated, eliminating the number and position restrictions of the initial wires. In this way, it is not necessary to build the initial wire at the vertex of each triangular area as in the prior art, which is conducive to reducing the number of initial wires.
[0056] In the embodiment of the present disclosure, by determining the wire influence area corresponding to the initial wire for guiding hair growth on the scalp model, the sampling point position for hair growth is determined on the scalp model, and the interpolation weight of the target wire corresponding to the sampling point position in the initial wire is determined according to the wire influence area, so that a special effect image of hair growing from the sampling point position can be constructed according to the interpolation weight of the target wire. It can be seen that in the embodiment of the present disclosure, the target wire corresponding to the sampling point position and the interpolation weight of the target wire can be determined from the initial wire according to the wire influence area, instead of fixing the hair constructed at the three vertices of the triangular area where the sampling point position is located as the target wire and using the centroid coordinates as the interpolation weight as in the prior art. In this way, the restrictions on the position and number of the initial wires are eliminated, and there is no need to construct the initial wire at the vertex of each triangular area as in the prior art, which is conducive to reducing the number of initial wires, thereby reducing the workload of image processing.
[0057] Figure 4 A flowchart of another image processing method provided by an embodiment of the present disclosure. The embodiment of the present disclosure is optimized on the basis of the above embodiment, and the embodiment of the present disclosure can be combined with various optional solutions in one or more of the above embodiments.
[0058] like Figure 4 As shown, the image processing method may include the following steps.
[0059] S410: Determine the tangent plane corresponding to the root point position of the initial wire on the scalp model.
[0060] Specifically, the normal vector corresponding to the root point position of the initial wire on the scalp model may be determined, and the tangent plane may be determined according to the normal vector.
[0061] S420: Determine a plurality of adjacent wires on the scalp model that are adjacent to the initial wire.
[0062] Specifically, a plurality of initial wires are added to the scalp model, and for each initial wire, an adjacent wire having an adjacent relationship with the initial wire can be determined from a plurality of other initial wires except the initial wire.
[0063] In some embodiments, S420 may include: constructing a Voronoi diagram based on the root point position of the initial conductor; wherein the Voronoi diagram includes multiple polygonal areas; determining at least one adjacent polygonal area adjacent to the polygonal area corresponding to the root point position of the initial conductor; and determining the initial conductor corresponding to the root point position in at least one adjacent polygonal area as an adjacent conductor.
[0064] Specifically, the construction of the Voronoi diagram belongs to the prior art, and those skilled in the art may refer to the prior art to construct the Voronoi diagram according to the root point position of the initial wire, which will not be described in detail here.
[0065] Specifically, the Voronoi diagram includes a plurality of polygonal areas, and the root point position of each initial conductor corresponds to one polygonal area. For each initial conductor, at least one adjacent polygonal area adjacent to the polygonal area corresponding to the root point position of the initial conductor can be determined from the polygonal areas corresponding to the root point positions of multiple other initial conductors other than the initial conductor, and the initial conductor corresponding to the root point position in the at least one adjacent polygonal area is determined as the adjacent conductor.
[0066] For example, Figure 5 A schematic diagram of the structure of a Voronoi diagram provided by an embodiment of the present disclosure. Figure 5 As shown, the root point position of a certain initial wire (i.e., the black dot in the figure) corresponds to polygonal area A. Since polygonal area A is adjacent to polygonal area B, polygonal area C, polygonal area D, polygonal area E, polygonal area F, polygonal area G, and polygonal area H, the adjacent wire of the initial wire is the initial wire corresponding to polygonal area BG. The same is true for other initial wires, which will not be repeated here.
[0067] It is understandable that determining the adjacent wires of the initial wire by constructing a Voronoi diagram can make the method of determining the adjacent wires simple and easy to implement, which is conducive to improving the efficiency of determining the adjacent wires of each initial wire, thereby improving the image processing efficiency.
[0068] In some other embodiments, S420 may include: determining the root point positions of M (M is an integer greater than 2) initial wires on the scalp model that are closest to the root point position of the initial wire; and determining the M initial wires as adjacent wires of the initial wire.
[0069] S430 , projecting the root point positions of a plurality of adjacent conductive lines onto a tangent plane to obtain corresponding first projection point positions.
[0070] Specifically, the root point position of the adjacent wire is the position (for example, coordinate) of the root point of the adjacent wire on the scalp model.
[0071] Specifically, each initial wire has multiple adjacent wires. For each initial wire, the root point positions of each adjacent wire of the initial wire are projected onto the tangent plane, and since the root point position of each adjacent wire corresponds to a first projection point position, multiple first projection point positions can be obtained.
[0072] S440, connecting the positions of the multiple first projection points to form a wire influence area corresponding to the initial wire.
[0073] Specifically, each initial wire corresponds to a plurality of first projection point positions. For each initial wire, the plurality of first projection point positions corresponding to the initial wire are sequentially connected to form a wire influence area corresponding to the initial wire.
[0074] It should be noted that when connecting the positions of the multiple first projection points, a curve connection can be used, wherein the radius of the wire influence area is obtained by interpolation. Of course, when connecting the positions of the multiple first projection points, a straight line connection can also be used. But it is not limited to this.
[0075] For example, Figure 6 A schematic diagram of a wire influence area provided by an embodiment of the present disclosure. Figure 6 A root point position 620 of an initial wire corresponds to a cutting plane 610 on the scalp model. The initial wire has 6 adjacent wires. The root point positions of the adjacent wires are projected onto the cutting plane 610 to obtain 6 first projection point positions 630. The 6 first projection point positions 630 are connected in sequence to form a wire influence area 640 corresponding to the initial wire.
[0076] It is understandable that for a 3D scalp model, since it has a higher dimension than a 2D scalp model, it is more complicated to determine the influence area corresponding to the initial wire. However, in the embodiment of the present disclosure, the root point positions of multiple adjacent wires of the initial wire are projected onto the tangent plane corresponding to the initial wire, and the multiple first projection point positions obtained by the projection are connected to form the wire influence area, so that the method for determining the wire influence area is simple and easy to implement. In addition, since the multiple adjacent wires are wires that have an adjacent relationship with the initial wire in the 3D scalp model, that is, the multiple adjacent wires are located around the initial wire in three-dimensional space and are relatively close to the initial wire, the wire influence area determined based on the first projection point of the root point position of the multiple adjacent wires on the tangent plane is more reasonable.
[0077] S450: Determine sampling point positions for hair growth on the scalp model, and determine interpolation weights of target wires in the initial wires corresponding to the sampling point positions according to the wire influence area.
[0078] Specifically, S460 is similar to S120 and will not be described in detail here.
[0079] S460: construct a special effects image of hair growing from the sampling point position according to the interpolation weight of the target wire.
[0080] Specifically, S460 is similar to S130 and will not be described in detail here.
[0081] In the embodiment of the present disclosure, by determining the tangent plane corresponding to the root point position of the initial wire on the scalp model, and determining a plurality of adjacent wires on the scalp model that are adjacent to the initial wire, the root point positions of the plurality of adjacent wires are projected onto the tangent plane to obtain a plurality of corresponding first projection point positions, and the plurality of first projection point positions are connected to form a wire influence area corresponding to the initial wire, so that the method for determining the wire influence area is simple and easy to implement, and the wire influence area is determined by the projection point positions of the root point positions of the adjacent wires on the tangent plane, which is conducive to avoiding setting the wire influence area too large, thereby facilitating the rationality of the wire influence area.
[0082] In another embodiment of the present disclosure, the method further includes: dividing the scalp model into a plurality of triangular areas; and determining the number of corresponding sampling points in the triangular area according to a preset total number of sampling points, an area of the triangular area, and an area of the scalp model.
[0083] Specifically, the number of triangular regions and the area of each triangular region can be set by those skilled in the art according to actual conditions and are not limited here.
[0084] It should be noted that the embodiments of the present disclosure are not limited to dividing the scalp model into a plurality of triangular areas, but may also be divided into a plurality of polygonal areas such as quadrilateral areas, pentagonal areas, etc., and those skilled in the art may set the areas according to actual conditions.
[0085] Specifically, the preset total number of sampling points is the number of sampling points expected to be generated, and its specific value is not limited here.
[0086] In some embodiments, the number of sampling points corresponding to the triangular area can be determined as follows: determine the ratio of the area of the triangular area to the area of the scalp model to obtain the sampling probability corresponding to the triangular area; determine the product of the sampling probability and the total number of preset sampling points to obtain the number of sampling points corresponding to the triangular area.
[0087] In one example, the scalp model is divided into I (I is a positive integer) triangular regions, the area of the triangular region Ti (i is the triangular region serial number, which is an integer between [1, I]) is calculated, and the area Ai is obtained. The area of each triangular region is accumulated to obtain the area of the scalp model S = A1 + A2 + ... + AI. The sampling probability value Pi = Ai / S of the triangular region Ti is calculated, and the number of sampling points Mi = Pi*M (M is the total number of preset sampling points) on the triangular region Ti is determined.
[0088] It can be understood that by determining the number of corresponding sampling points in the triangular area based on the preset total number of sampling points, the area of the triangular area, and the area of the scalp model, the sampling points can be distributed more evenly on the scalp model, which is beneficial to improving the uniformity of hair distribution in the final special effects image, thereby improving the image processing quality.
[0089] In another embodiment of the present disclosure, determining the sampling point position for hair growth may include: uniformly sampling in a preset interval to obtain three random numbers; determining the centroid coordinates corresponding to the sampling point in a triangular area based on the three random numbers; and determining the sampling point position corresponding to the sampling point according to the centroid coordinates and the vertex positions of the triangular area.
[0090] Specifically, the probability of each value in the preset interval being randomly sampled is the same, and three random numbers can be obtained by randomly and uniformly sampling in the preset interval.
[0091] In some embodiments, the centroid coordinates may be determined as follows: taking logarithms of three random numbers respectively to obtain three logarithmic values; adding the three logarithmic values to obtain a logarithmic sum; and determining the ratio of the three logarithmic values to the logarithmic sum to obtain the centroid coordinates.
[0092] In an example, for the j-th (j is the sampling point number and is an integer between [1, Mi]) sampling point Vij in the triangular area Ti, three random numbers R1, R2, and R3 are uniformly sampled in the interval [0, 1]. The logarithms of R1, R2, and R3 are taken respectively to obtain LR1=log(R1), LR2=log(R2), and LR3=log(R3). LR1, LR2, and LR3 are added to obtain SLR=LR1+LR2+LR3. The centroid coordinates of the sampling point Vij are [u, v, w]=[LR1 / SLR, LR2 / SLR, LR3 / SLR].
[0093] In some embodiments, the sampling point position may be determined as follows: weighted sum of the vertex positions of the three vertices of the triangular region according to the barycentric coordinates to obtain the sampling point position corresponding to the sampling point.
[0094] Specifically, the vertex positions are positions (eg coordinates) of the vertices of the triangular region on the scalp model.
[0095] In an example, the three vertices of the triangular area Ti are Vi1, Vi2, and Vi3, the vertex coordinates of vertex Vi1 are (Xi1, Yi1, Zi1), the vertex coordinates of vertex Vi2 are (Xi2, Yi2, Zi2), and the vertex coordinates of vertex Vi3 are (Xi3, Yi3, Zi3). Then the sampling point position of sampling point Vij is Vi1*u+Vi2*v+Vi3*w=(Xi1*u+Xi2*v+Xi3*w, Yi1*u+Yi2*v+Yi3*w, Zi1*u+Zi2*v+Zi3*w).
[0096] It can be understood that by determining the centroid coordinates corresponding to the sampling points in the triangular area based on random numbers, and determining the sampling point positions corresponding to the sampling points according to the centroid coordinates and the vertex positions of the triangular area, the sampling points in each triangular area can be distributed more evenly, thereby making the distribution of the sampling points on the scalp model more uniform, which is conducive to further improving the uniformity of hair distribution in the final special effects image generated, thereby further improving the image processing quality.
[0097] Figure 7 A flowchart of another image processing method provided by the embodiment of the present disclosure is provided. The embodiment of the present disclosure is optimized on the basis of the above embodiment, and the embodiment of the present disclosure can be combined with various optional solutions in one or more of the above embodiments.
[0098] like Figure 7 As shown, the image processing method may include the following steps.
[0099] S710: Determine a guide wire influence area corresponding to an initial guide wire for guiding hair growth on a scalp model.
[0100] Specifically, S710 is similar to S110 and will not be described in detail here.
[0101] S720: Determine sampling point locations for hair growth on the scalp model.
[0102] Specifically, S720 is similar to "determining the sampling point positions for hair growth on the scalp model" in S120, and will not be repeated here.
[0103] S730: Project the sampling point position onto the plane where the wire influence area is located to obtain a corresponding second projection point position.
[0104] Specifically, the sampling point position is projected onto the plane where at least one wire influence area is located to obtain at least one corresponding second projection point position. For example, the sampling point position can be projected onto the plane where each wire influence area is located to obtain multiple second projection point positions.
[0105] S740: When the second projection point is located within the wire influence area, determine the initial wire corresponding to the wire influence area as the target wire corresponding to the sampling point.
[0106] Specifically, when the second projection point position is within the wire influence area, it indicates that the initial wire corresponding to the wire influence area has an influence on the wire to be added that grows at the sampling point position corresponding to the second projection point position. Therefore, the initial wire corresponding to the wire influence area can be determined as the target wire corresponding to the sampling point position.
[0107] Specifically, when the second projection point is located outside the wire influence area, it is determined that the initial wire corresponding to the wire influence area is not the target wire corresponding to the sampling point.
[0108] Specifically, when the sampling point position corresponds to at least one target wire, a wire to be added can be added at the sampling point position subsequently; when the sampling point position corresponds to zero target wire, no wire to be added needs to be added at the sampling point position subsequently.
[0109] S750: Determine an interpolation weight corresponding to the target wire according to the distance from the second projection point position corresponding to the target wire to the boundary of the wire influence area and the sum of the distances to the boundaries corresponding to the wire influence areas of each target wire.
[0110] Specifically, the sum of the distances to the boundaries of the wire influence regions corresponding to the target wires is the sum of the distances from the second projection point positions corresponding to the target wires to the boundaries of the wire influence regions.
[0111] In some embodiments, the interpolation weight corresponding to the target wire can be determined as follows: determine the ratio of the distance from the second projection point position corresponding to the target wire to the boundary of the wire influence area to the sum of the distances corresponding to the boundaries of the wire influence areas of each target wire, and obtain the interpolation weight corresponding to the target wire.
[0112] In one example, for the sampling point position Vij, it is projected to each wire influence area to obtain multiple second projection point positions, wherein K second projection point positions are located in the wire influence area, that is, the sampling point Vij corresponds to K target wires, and the distance Dijk (k is the sequence number of the target wire, k is an integer between [1, K]) from the second projection point position corresponding to the kth target wire to the boundary of the wire influence area is calculated, and the distances corresponding to the boundaries of the wire influence areas of the K target wires are accumulated to obtain the sum of the distances SDij=Dij1+Dij2+…+DijK, then the interpolation weight of the kth target wire is Wijk=Dijk / SDij.
[0113] It can be understood that by projecting the sampling point position onto the plane where the wire influence area corresponding to each target wire is located to obtain the corresponding second projection point position, and determining the interpolation weight corresponding to the target wire according to the distance from the second projection point position corresponding to the target wire to the boundary of the wire influence area and the sum of the distances to the boundary corresponding to the wire influence area of each target wire, the interpolation weight corresponding to the target wire can be made as large as possible on the 3D scalp model, while the interpolation weight of the target wire far from the sampling point position can be made as small as possible. In this way, the closer the target wire to the sampling point position is, the greater the influence on the shape of the hair growing at the sampling point position is, and the hair growing at the sampling point position is more harmonious and more matched with the shape of the target wire corresponding to the sampling point position, which is beneficial to improving the special effect quality of the special effect image.
[0114] S760: Construct a special effects image of hair growing from the sampling point position according to the interpolation weight of the target wire.
[0115] Specifically, S760 is similar to S130 and will not be described in detail here.
[0116] In the disclosed embodiment, the interpolation weight corresponding to the target wire is determined according to the distance from the second projection point position corresponding to the target wire to the boundary of the wire influence area and the sum of the distances to the boundaries corresponding to the wire influence areas of each target wire. The interpolation weight of the target wire having a greater influence on the wire to be added at the sampling point position can be greater, which is beneficial to improving the quality of the wire to be added at the sampling point position, thereby achieving the effect of obtaining a high-quality special effect image with less workload.
[0117] Figure 8 A flowchart of another image processing method provided by the embodiment of the present disclosure is provided. The embodiment of the present disclosure is optimized on the basis of the above embodiment, and the embodiment of the present disclosure can be combined with various optional solutions in one or more of the above embodiments.
[0118] like Figure 8 As shown, the image processing method may include the following steps.
[0119] S810: Determine a guide wire influence area corresponding to an initial guide wire for guiding hair growth on the scalp model.
[0120] Specifically, S810 is similar to S110 and will not be described in detail here.
[0121] S820: Determine sampling point positions for hair growth on the scalp model, and determine interpolation weights of target wires in the initial wires that correspond to the sampling point positions according to the wire influence area.
[0122] Specifically, S820 is similar to S120 and will not be described in detail here.
[0123] S830: Determine the key point position of the wire to be added corresponding to the sampling point position according to the key point position of the target wire and the interpolation weight of the target wire.
[0124] Specifically, the target wire includes key points, the key point positions are the positions (such as coordinates) of the key points, and the shape of the target wire is determined by the number of key points and the positions of the key points.
[0125] In some embodiments, S830 may include: determining two adjacent key point positions on each target wire corresponding to the current key point position of the wire to be added; determining the difference between the two adjacent key point positions to obtain the position difference corresponding to each target wire; weighted summing the position difference corresponding to each target wire according to the interpolation weight of each target wire to obtain a position sum value; summing the position sum value and the current key point position of the wire to be added to obtain the next key point position of the wire to be added.
[0126] Specifically, the two adjacent key point positions corresponding to the current key point position include two key point positions, wherein the position of one key point position on the target wire (i.e., the nth key point position on the target wire) is the same as the position of the current key point position on the wire to be added, and the other key point position is the next key point position of the key point position that is the same as the position of the current key point position on the wire to be added.
[0127] Specifically, when the sampling point position corresponds to at least one target wire, the wire to be added can be added at the sampling point position. For each target wire, two adjacent key point positions on the target wire corresponding to the current key point position of the wire to be added are determined, and the difference between the two adjacent key point positions is determined to obtain the position difference corresponding to the target wire, and the product of the position difference and the interpolation weight corresponding to the target wire is determined, so that the product of the position difference corresponding to each target wire and the corresponding interpolation weight can be obtained, and then each product is added to obtain a position sum value, and the position sum value is added to the current key point position of the wire to be added to obtain the next key point position of the wire to be added.
[0128] In one example, for the sampling point position Vij, it corresponds to the target wire line1 and the target wire line2, the target wire line1 has key point positions v11, v12, v13, v14, and the interpolation weight corresponding to the target wire line1 is Wij1, the target wire line2 has key point positions v21, v22, v23, v24, and the interpolation weight corresponding to the target wire line2 is Wij2, then the wire to be added corresponding to the sampling point position Vij is Result1 ine should also have 4 key points vr1, vr2, vr3, vr4, among which, vr1 = Vij, vr2 = vr1 + (v12-v11) * Wij1 + (v22-v21) * Wij2, vr3 = vr2 + (v13-v12) * Wij1 + (v23-v22) * Wij2, vr4 = vr3 + (v14-v13) * Wij1 + (v24-v23) * Wij2, for v12-v11, if the coordinates of the key point position v11 are (Xv 11 , Yv 11 , Zv 11 ), the coordinates of the key point position v12 are (Xv 12 , Yv 12 , Zv 12 ) then v12-v11=(Xv 12 -Xv 11 , Yv 12 -Yv 11 , Zv 12 -Zv 11 ), the addition and subtraction of other key point positions can be understood similarly and will not be elaborated here.
[0129] It can be understood that by determining the next key point position of the wire to be added based on the current key point position of the wire to be added, the two adjacent key point positions corresponding to the current key point position of the wire to be added on the target wire, and the interpolation weight of the target wire, the calculation method of the key point position of the wire to be added can be simple and easy to implement, and the calculation of the key point position of the wire to be added can be made more accurate.
[0130] S840: Add the wire to be added for guiding hair growth from the sampling point position according to the key point position of the wire to be added.
[0131] Specifically, the wire to be added is a wire constructed by interpolation according to the interpolation weight of the target wire.
[0132] Specifically, the key point positions of the wire to be added are connected in sequence to obtain the wire to be added.
[0133] In the disclosed embodiment, the key point position of the wire to be added corresponding to the sampling point position is determined according to the key point position of the target wire and the interpolation weight of the target wire, and the key point position of the wire to be added corresponding to the sampling point position is determined according to the key point position of the target wire and the interpolation weight of the target wire. This can make the calculation of the key point position of the wire to be added more accurate, so that the shape of the wire to be added is more matched with the shapes of the wires around it, which is beneficial to improve the quality of the special effect image finally generated.
[0134] In another disclosed embodiment, the method further includes: detecting whether the number of key points between different initial conductors is the same; and when it is known that the number of key points between different initial conductors is not the same, resampling the initial conductors, wherein the number of key points between different initial conductors after resampling is the same, and the key points of the same initial conductor are equidistant.
[0135] Specifically, the initial uniform resampling is performed to uniformize the initial wires, and wires with equal distances between vertices and shapes close to those before sampling are obtained.
[0136] It can be understood that by resampling the initial wires, the number of key points of each target wire corresponding to the sampling point position can be made the same and the key points can be equally spaced, which is beneficial to improving the calculation accuracy of the key point position on the wire to be added, thereby further improving the matching degree between the shape of the wire to be added and the shapes of the wires around it, and further improving the quality of the special effect image finally generated.
[0137] Fig. 9 Schematic diagram of the structure of an image processing device provided by an embodiment of the present disclosure, the image processing device can be understood as the above electronic device or a part of the functional modules in the above electronic device. Fig. 9 As shown, the image processing device 900 includes:
[0138] A first determination module 910 is used to determine a wire influence area corresponding to an initial wire for guiding hair growth on a scalp model;
[0139] A second determination module 920 is used to determine the sampling point position for hair growth on the scalp model, and determine the interpolation weight of the target wire in the initial wire corresponding to the sampling point position according to the wire influence area;
[0140] The construction module 930 is used to construct a special effect image of hair growing from the sampling point position according to the interpolation weight of the target wire.
[0141] In the embodiment of the present disclosure, by determining the wire influence area corresponding to the initial wire for guiding hair growth on the scalp model, the sampling point position for hair growth is determined on the scalp model, and the interpolation weight of the target wire corresponding to the sampling point position in the initial wire is determined according to the wire influence area, so that a special effect image of hair growing from the sampling point position can be constructed according to the interpolation weight of the target wire. It can be seen that in the embodiment of the present disclosure, the target wire corresponding to the sampling point position and the interpolation weight of the target wire can be determined from the initial wire according to the wire influence area, instead of fixing the hair constructed at the three vertices of the triangular area where the sampling point position is located as the target wire and using the centroid coordinates as the interpolation weight as in the prior art. In this way, the restrictions on the position and number of the initial wires are eliminated, and there is no need to construct the initial wire at the vertex of each triangular area as in the prior art, which is conducive to reducing the number of initial wires, thereby reducing the workload of image processing.
[0142] In another embodiment of the present disclosure, the first determining module 910 includes:
[0143] The first determination submodule is used to determine the tangent plane corresponding to the root point position of the initial wire on the scalp model;
[0144] A second determination submodule is used to determine a plurality of adjacent wires on the scalp model that are adjacent to the initial wire;
[0145] A first projection submodule, used to project the root point positions of a plurality of adjacent conductive lines onto a tangent plane to obtain corresponding first projection point positions;
[0146] The connection submodule is used to connect the positions of the multiple first projection points to form a wire influence area corresponding to the initial wire.
[0147] In yet another embodiment of the present disclosure, the second determining submodule includes:
[0148] A first construction unit is used to construct a Voronoi diagram according to the root point position of the initial wire; wherein the Voronoi diagram includes a plurality of polygonal areas;
[0149] A first determining unit, configured to determine at least one adjacent polygonal area adjacent to the polygonal area corresponding to the root point position of the initial wire;
[0150] The second determining unit is configured to determine an initial conductive line corresponding to a root point position in at least one adjacent polygonal area as an adjacent conductive line.
[0151] In another embodiment of the present disclosure, the device further comprises:
[0152] A division module, used for dividing the scalp model into a plurality of triangular regions;
[0153] The third determination module is used to determine the number of corresponding sampling points in the triangular area according to the total number of preset sampling points, the area of the triangular area, and the area of the scalp model.
[0154] In yet another embodiment of the present disclosure, the second determining module 920 includes:
[0155] The first sampling submodule is used to uniformly sample in a preset interval to obtain three random numbers;
[0156] A third determination submodule, used to determine the centroid coordinates corresponding to the sampling points in the triangular area based on the three random numbers;
[0157] The fourth determination submodule is used to determine the sampling point position corresponding to the sampling point according to the centroid coordinates and the vertex positions of the triangular area.
[0158] In yet another embodiment of the present disclosure, the second determining module 920 includes:
[0159] A first projection module is used to project the sampling point position onto the plane where the wire influence area is located to obtain the corresponding second projection point position;
[0160] A fifth determination submodule, configured to determine, when the second projection point is located within the wire influence area, that the initial wire corresponding to the wire influence area is the target wire corresponding to the sampling point position;
[0161] The sixth determination submodule is used to determine the interpolation weight corresponding to the target wire according to the sum of the distance from the second projection point position corresponding to the target wire to the boundary of the wire influence area and the distance to the boundary corresponding to the wire influence area of each target wire.
[0162] In yet another embodiment of the present disclosure, the construction module 930 includes:
[0163] A fourth determination module is used to determine the key point position of the wire to be added corresponding to the sampling point position according to the key point position of the target wire and the interpolation weight of the target wire;
[0164] The adding module is used to add the wire to be added for guiding the hair growth from the sampling point position according to the key point position of the wire to be added.
[0165] In yet another embodiment of the present disclosure, the fourth determining module includes:
[0166] A seventh determination submodule is used to determine two adjacent key point positions on each target wire corresponding to the current key point position of the wire to be added;
[0167] An eighth determination submodule is used to determine the difference between the positions of two adjacent key points to obtain the position difference corresponding to each target wire;
[0168] A first summing submodule, configured to perform weighted summation on the position differences corresponding to the target conductors according to the interpolation weights of the target conductors to obtain a position sum value;
[0169] The second adding submodule is used to add the position sum value and the current key point position of the wire to be added to obtain the next key point position of the wire to be added.
[0170] In another embodiment of the present disclosure, the device further comprises:
[0171] A detection module, used for detecting whether the number of key points between different initial wires is the same;
[0172] The resampling module is used to resample the initial wires when it is known that the numbers of key points between different initial wires are different, wherein the numbers of key points between different initial wires after resampling are the same, and the key points of the same initial wire are equidistant.
[0173] The device provided in this embodiment can execute the method of any of the above embodiments, and its execution method and beneficial effects are similar, which will not be repeated here.
[0174] In addition to the above methods and apparatus, the embodiments of the present disclosure further provide a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device implements the method of any of the above embodiments.
[0175] The embodiments of the present disclosure further provide a computer program product, which includes a computer program / instructions. When the computer program / instructions are executed by a processor, the method of any of the above embodiments is implemented.
[0176] An embodiment of the present disclosure further provides an electronic device, which includes: a memory, in which a computer program is stored; and a processor, for executing the computer program. When the computer program is executed by the processor, the method of any of the above embodiments can be implemented.
[0177] For example, Fig.10 Schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Fig.10, which shows a schematic diagram of the structure of an electronic device 1000 suitable for implementing the embodiment of the present disclosure. The electronic device 1000 in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.10 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0178] like Fig.10 As shown, the electronic device 1000 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the electronic device 1000 are also stored. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0179] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.10 The electronic device 1000 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0180] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 1009, or installed from a storage device 1008, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0181] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0182] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0183] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0184] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: determines the wire influence area corresponding to the initial wire for guiding hair growth on the scalp model; determines the sampling point position for hair growth on the scalp model, and determines the interpolation weight of the target wire in the initial wire corresponding to the sampling point position according to the wire influence area; and constructs a special effect image of hair growing from the sampling point position according to the interpolation weight of the target wire.
[0185] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0186] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0187] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0188] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0189] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0190] The embodiments of the present disclosure also provide a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method of any of the above embodiments can be implemented. The execution method and beneficial effects are similar and will not be repeated here.
[0191] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0192] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An image processing method, characterized in that: include: Determining the wire influence area corresponding to the initial wire for guiding hair growth on the scalp model; Determining sampling point positions for hair growth on the scalp model, and determining interpolation weights of target wires in the initial wires corresponding to the sampling point positions according to the wire influence area; A special effects image of hair growing from the sampling point position is constructed according to the interpolation weight of the target wire.
2. The method according to claim 1, characterized in that The step of determining the wire influence area corresponding to the initial wire for guiding hair growth on the scalp model comprises: Determine a tangent plane corresponding to the root point position of the initial wire on the scalp model; determining a plurality of adjacent wires on the scalp model that are adjacent to the initial wire; Projecting the root point positions of the plurality of adjacent wires onto the tangent plane to obtain corresponding plurality of first projection point positions; The positions of the multiple first projection points are connected to form a wire influence area corresponding to the initial wire.
3. The method according to claim 2, characterized in that The step of determining an adjacent wire on the scalp model that is adjacent to the initial wire comprises: Constructing a Voronoi diagram according to the root point position of the initial wire; wherein the Voronoi diagram includes a plurality of polygonal areas; Determine at least one adjacent polygonal area adjacent to the polygonal area corresponding to the root point position of the initial wire; An initial conductive line corresponding to a root point position in the at least one adjacent polygonal area is determined as the adjacent conductive line.
4. The method according to claim 1, characterized in that Also includes: Dividing the scalp model into a plurality of triangular areas; The number of corresponding sampling points in the triangular area is determined according to the preset total number of sampling points, the area of the triangular area, and the area of the scalp model.
5. The method according to claim 4, characterized in that Determining the sampling point location for hair growth includes: Uniformly sample in the preset interval to obtain three random numbers; Based on the three random numbers, determine the centroid coordinates corresponding to the sampling points in the triangular area; The sampling point position corresponding to the sampling point is determined according to the barycenter coordinates and the vertex positions of the triangular area.
6. The method according to claim 1, characterized in that Determining the interpolation weight of the target wire corresponding to the sampling point position in the initial wire according to the wire influence area includes: Projecting the sampling point position onto the plane where the wire influence area is located to obtain a corresponding second projection point position; When the second projection point is located within the wire influence area, determining an initial wire corresponding to the wire influence area as a target wire corresponding to the sampling point; An interpolation weight corresponding to the target wire is determined according to the distance from the second projection point position corresponding to the target wire to the boundary of the wire influence area and the sum of the distances to the boundaries corresponding to the wire influence areas of the target wires.
7. The method according to claim 1, characterized in that According to the interpolation weight of the target wire, a special effect image of growing hair from the sampling point position is constructed, including: Determine the key point position of the wire to be added corresponding to the sampling point position according to the key point position of the target wire and the interpolation weight of the target wire; According to the key point position of the wire to be added, the wire to be added for guiding hair growth is added from the sampling point position.
8. The method according to claim 7, characterized in that Determining the key point position of the wire to be added corresponding to the sampling point position according to the key point position of the target wire and the interpolation weight of the target wire, including: Determine two adjacent key point positions on each of the target wires corresponding to the current key point position of the wire to be added; Determine the difference between the positions of the two adjacent key points to obtain the position difference corresponding to each of the target wires; Performing weighted summation on the position differences corresponding to the target wires according to the interpolation weights of the target wires to obtain a position sum value; The position sum value is added to the current key point position of the wire to be added to obtain the next key point position of the wire to be added.
9. The method according to any one of claims 1 to 8, characterized in that: Also includes: Detecting whether the number of key points between different initial wires is the same; When it is known that the numbers of key points between different initial wires are different, the initial wires are resampled, wherein the numbers of key points between different initial wires after resampling are the same, and the key points of the same initial wire are equidistant.
10. An image processing device, characterized in that: include: A first determination module is used to determine a wire influence area corresponding to an initial wire for guiding hair growth on a scalp model; a second determination module, configured to determine the sampling point positions for hair growth on the scalp model, and determine the interpolation weights of the target wires in the initial wires corresponding to the sampling point positions according to the wire influence area; A construction module is used to construct a special effect image of hair growing from the sampling point position according to the interpolation weight of the target wire.
11. An electronic device, characterized in that: include: A processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
13. A computer program product, characterized in that The computer program product comprises a computer program / instructions, which implement the method according to any one of claims 1 to 9 when executed by a processor.
Citation Information
Patent Citations
Personalized head portrait generation method, apparatus and device, and storage medium
CN110689546A
Data processing method and device based on hair image
CN112862807A