A shadow generation method and device

By determining the contour line of the target object in the two-dimensional image and performing grayscale gradient and affine transformation processing, the shadow area image is generated, which solves the problem of high resource consumption and low precision of shadow generation in the existing technology, and achieves efficient and accurate shadow image generation.

CN110717969BActive Publication Date: 2024-10-25ALIBABA GROUP HOLDING LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201810771391.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-07-13
Publication Date
2024-10-25
Estimated Expiration
2038-07-13

AI Technical Summary

Technical Problem

Existing shadow generation solutions require a large amount of computing resources and have low shadow accuracy. Especially in two-dimensional images, it is difficult to extract accurate depth information, resulting in inaccurate shadow image rendering.

Method used

By determining the contour line of the target object in the target image, performing grayscale gradient processing and affine transformation processing based on the area image within the contour line, a shadow area image is generated and merged into the target image to obtain a shadow image of the target image.

Benefits of technology

It reduces the computing resources required for the shadow generation process, improves the efficiency and accuracy of shadow generation, and avoids the need to build a three-dimensional model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110717969B_ABST
    Figure CN110717969B_ABST
Patent Text Reader

Abstract

The present application discloses a shadow generation method and device. The method comprises: determining the contour line of a target object in a target image; performing grayscale gradient processing and affine transformation processing based on a first region image to obtain a shadow region image; wherein the first region image is a region image within the contour line in the target image, and the affine transformation processing is performed based on the positional relationship of reference points before and after the affine transformation; performing image synthesis processing based on the shadow region image and the first region image to generate a shadow image of the target image. The present application determines the contour line of a target object in a two-dimensional image, and performs grayscale gradient processing and affine transformation processing based on the region image within the contour line to obtain a shadow region image. Compared with the prior art solution of constructing a three-dimensional model of the target object to obtain the spatial shadow of the target object, the present invention can reduce the computing resources required for the shadow generation process, improve the shadow generation efficiency, and improve the accuracy of the generated shadow.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a shadow generation method and device. Background Art

[0002] Shadows are of great significance for realistic scene rendering. They not only reflect the mutual occlusion relationship between objects in space, but also reflect the geometric information of the occluding objects and the receiving surface. Real-time rendering of shadows also greatly increases the realism of scene rendering.

[0003] Currently, shadow generation schemes rely on the depth information of objects and build three-dimensional models based on the depth information to render realistic shadows. However, for two-dimensional images, since their spatial information is hidden between pixels, it is difficult to extract accurate depth information, and thus, it is difficult to accurately obtain their shadow images. Summary of the invention

[0004] The embodiments of the present specification provide a shadow generation method to solve the problem that existing shadow generation solutions require a large amount of computing resources and have low shadow accuracy.

[0005] The embodiment of this specification also provides a shadow generation method, including:

[0006] Determine the contour of the target object in the target image;

[0007] Performing grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the positional relationship of the reference points before and after the affine transformation;

[0008] An image synthesis process is performed based on the shadow area image and the first area image to generate a shadow image of the target image.

[0009] The embodiment of this specification also provides a shadow generation method, including:

[0010] Determine the contour of the target object in the target image;

[0011] Based on the contour of the target object, determining a parameter group corresponding to the type of the target object, the parameter group including a light incident angle;

[0012] Performing grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the incident angle of the light;

[0013] An image synthesis process is performed based on the shadow area image and the first area image to generate a shadow image of the target image.

[0014] The embodiment of this specification also provides a shadow generating device, including:

[0015] A determination module, used for determining the contour line of the target object in the target image;

[0016] A first processing module is used to perform grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the positional relationship of the reference points before and after the affine transformation;

[0017] The second processing module is used to perform image synthesis processing based on the shadow area image and the first area image to generate a shadow image of the target image.

[0018] The embodiment of this specification also provides a shadow generating device, including:

[0019] A first determining module, used to determine the contour line of the target object in the target image;

[0020] A second determination module, configured to determine a parameter group corresponding to the type of the target object based on a contour line of the target object, wherein the parameter group includes a light incident angle;

[0021] A first processing module is used to perform grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the incident angle of the light;

[0022] The second processing module is used to perform image synthesis processing based on the shadow area image and the first area image to generate a shadow image of the target image.

[0023] The embodiment of the present specification also provides an electronic device, including:

[0024] Processor; and

[0025] a memory arranged to store computer executable instructions which, when executed, cause the processor to:

[0026] Determine the contour of the target object in the target image;

[0027] Performing grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the positional relationship of the reference points before and after the affine transformation;

[0028] An image synthesis process is performed based on the shadow area image and the first area image to generate a shadow image of the target image.

[0029] The embodiment of the present specification also provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and when the one or more programs are executed by an electronic device including a plurality of application programs, the electronic device performs the following operations:

[0030] Determine the contour of the target object in the target image;

[0031] Performing grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the positional relationship of the reference points before and after the affine transformation;

[0032] An image synthesis process is performed based on the shadow area image and the first area image to generate a shadow image of the target image.

[0033] The embodiment of the present specification also provides an electronic device, including:

[0034] Processor; and

[0035] a memory arranged to store computer executable instructions which, when executed, cause the processor to:

[0036] Determine the contour of the target object in the target image;

[0037] Based on the contour of the target object, determining a parameter group corresponding to the type of the target object, the parameter group including a light incident angle;

[0038] Performing grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the incident angle of the light;

[0039] An image synthesis process is performed based on the shadow area image and the first area image to generate a shadow image of the target image.

[0040] The embodiment of the present specification also provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and when the one or more programs are executed by an electronic device including a plurality of application programs, the electronic device performs the following operations:

[0041] Determine the contour of the target object in the target image;

[0042] Based on the contour of the target object, determining a parameter group corresponding to the type of the target object, the parameter group including a light incident angle;

[0043] Performing grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the incident angle of the light;

[0044] An image synthesis process is performed based on the shadow area image and the first area image to generate a shadow image of the target image.

[0045] At least one of the above technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects:

[0046] By determining the contour of the target object in the target image, a first region image of the target object is determined, and then grayscale gradient processing and affine transformation processing are performed based on the first region image to obtain a shadow region image corresponding to the first region image, and then the shadow region image and the first region image are merged to obtain a shadow image of the target image. Compared with the prior art solution of obtaining the spatial shadow of the target object by constructing a three-dimensional model of the target object, on the one hand, the construction of a three-dimensional model of the target object is avoided, the computing resources required for the shadow generation process are reduced, and the shadow generation efficiency is improved; on the other hand, the extraction of difficult-to-extract depth information is avoided, and the accuracy of the generated shadow can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0048] Figure 1 A flowchart of a shadow generation method provided in Example 1 of this specification;

[0049] Figure 2 A flowchart of a first implementation method of step 14 provided in Example 1 of this specification;

[0050] Figure 3A flowchart of an implementation method of step 22 provided in Example 1 of this specification;

[0051] Figure 4 A flowchart of a second implementation method of step 14 provided in Example 1 of this specification;

[0052] Figure 5 A flowchart of an implementation method of step 42 provided in Example 1 of this specification;

[0053] Figure 6 A schematic diagram of the positional relationship of reference points before and after the first affine transformation provided in Example 1 of this specification;

[0054] Figure 7 A schematic diagram of the positional relationship of reference points before and after the second affine transformation provided in Example 1 of this specification;

[0055] Figure 8 A flowchart of a shadow generation method provided in Example 2 of this specification;

[0056] Fig. 9 A schematic diagram of the structure of a shadow generating device provided in Example 3 of this specification;

[0057] Fig.10 A schematic diagram of the structure of a shadow generating device provided in Example 4 of this specification;

[0058] Fig.11 This is a schematic diagram of the structure of an electronic device provided in Example 5 of this specification. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0060] As stated in the background technology section, when constructing a shadow image of a target object, the prior art needs to rely on the depth information of the target object to construct a three-dimensional model of the target object, and then render the real shadow of the target object. However, for a two-dimensional image, since the depth information of the target object is difficult to extract, huge computing resources are required to build a three-dimensional model of the target object; and since the depth information is difficult to extract, the accuracy of the finally rendered shadow cannot be guaranteed.

[0061] Based on this, the present invention provides a shadow generation method, which determines the contour line of the target object in the two-dimensional image, performs grayscale gradient processing and affine transformation processing based on the regional image within the contour line, obtains the shadow area image, and then merges the shadow area image into the target image to obtain the shadow image of the target image. Compared with the prior art, it can reduce the computing resources required for the shadow generation process, improve the shadow generation efficiency, and improve the accuracy of the generated shadow.

[0062] The application scenarios of the present invention are exemplarily described below.

[0063] The first application scenario:

[0064] The user starts the application client installed on the terminal device, imports the image to be processed (as the target image) through operation, and then sets relevant parameters, including: light incidence angle, blur radius, etc.; then, the application client executes the above-mentioned extraction of the contour line of the target object, performs grayscale gradient processing and affine transformation processing, obtains the shadow area image of the target image, and then performs image synthesis processing to obtain a shadow image with the shadow area image.

[0065] The second application scenario:

[0066] The user starts the application client installed on the terminal device and imports the image to be processed (as the target image) through operation; then, the application client cuts out the contour line of the target object and determines the type of the target object based on the contour line; then, one or more groups of related parameters corresponding to the type are found from the database, including: light incident angle, blur radius, etc.; then, grayscale gradient processing and affine transformation processing are performed based on the relevant parameters to obtain the shadow area image of the target image, and then image synthesis processing is performed to obtain a shadow image with the shadow area image.

[0067] For the above two application scenarios, in order to reduce the computing resources occupied by the terminal device, after the application client sends the relevant data to the application server, the application server can perform one or more steps such as contour extraction, grayscale gradient processing and affine transformation processing.

[0068] The terminal devices may be: PC terminals and mobile terminals. Mobile terminals or mobile communication terminals refer to computer devices that can be used on the move, broadly speaking, including mobile phones, notebooks, tablet computers, POS machines and even car computers. However, in most cases, they refer to mobile phones or smart phones with multiple application functions and tablet computers.

[0069] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0070] Example 1

[0071] Figure 1 A flowchart of a shadow generation method provided in an embodiment of this specification is shown in FIG. Figure 1 The method can be executed by an application client, and specifically includes the following steps:

[0072] Step 12: determine the contour of the target object in the target image;

[0073] It should be noted that the first implementation of step 12 may be:

[0074] After the user imports the target image and clicks the "Start" option, the program client automatically extracts the edge pixels of the target object based on a predetermined cutout algorithm to obtain the contour line.

[0075] The predetermined matting algorithm may adopt an existing matting algorithm, such as Poisson Matting, Bayes Matting, Closed form matting, etc. Since they are all mature existing technologies, their matting principles will not be described in detail here.

[0076] A second implementation of step 12 may be:

[0077] After the user imports the target image, the third-party application is called to extract the edge pixels of the target object and obtain the contour line.

[0078] Among them, third-party applications can be exemplified as: PS, Meitu XiuXiu, etc.

[0079] Optionally, after determining the contour of the target object, an optimization step may be further included. The optimization step may specifically include:

[0080] Highlight the outline, for example, make it bold, display it in a predetermined color, etc.

[0081] If an editing instruction input by the user is received, for example, moving a portion of the contour line by a certain distance, the contour line is adaptively adjusted.

[0082] Step 14: performing grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image;

[0083] Wherein, the first area image is an area image within a contour line in the target image, and the affine transformation processing is performed based on the positional relationship of the reference points before and after the affine transformation;

[0084] It should be noted that, combined with Figure 2, the first implementation of step 14 can be:

[0085] Step 22: performing grayscale gradient processing based on the first region image to obtain a grayscale gradient image;

[0086] Step 24: Based on the positional relationship between the reference points before and after the affine transformation, perform affine transformation processing on the grayscale gradient image to obtain a shadow area image.

[0087] Combination Figure 3 , one implementation of step 22 may be:

[0088] Step 32: construct a second layer, and construct a second region image on the second layer;

[0089] Among them, the first layer is the layer where the first area image is located, and the second area image has the same image data as the first area image, that is, the first area image of the first layer is copied to the second layer to distinguish it from the first area image of the first layer. Here, the first area image of the second layer is called the second area image.

[0090] Step 34, binarizing the second region image to obtain a third region image;

[0091] The binarization process can be specifically as follows:

[0092] The grayscale values ​​of the pixels in the second region image are adjusted to 255 to obtain a black second region image. To distinguish the second region image in step 32, the black second region image is referred to as a third region image.

[0093] Optionally, in order to reduce the amount of data processing, the area image outside the second area image may be binarized, for example, the grayscale values ​​of the pixels in the area outside the second area image may be adjusted to zero.

[0094] Step 36: Perform grayscale gradient processing on the third region image to obtain a grayscale gradient image.

[0095] It should be noted that one implementation of step 36 may be:

[0096] Based on the position of the pixel in the third area image, the relative position of the pixel and the preselected reference point is determined; based on the relative position of the pixel and the reference point, the grayscale value of the pixel is adjusted.

[0097] The preselected reference point may be any point inside or outside the third region image; preferably, it is the midpoint of the bottom edge of the circumscribed rectangle of the third region image. With reference to this point, based on the rule that the grayscale value of the pixel point farther from this point is smaller, the grayscale value of each pixel point is adjusted to form a shadow gradient from dark to light from the bottom to the top of the target object.

[0098] Combination Figure 4 , the second implementation of step 14 can be:

[0099] Step 42: performing affine transformation processing based on the first region image to obtain an affine transformed image;

[0100] Step 44: Perform grayscale gradient processing on the affine transformation image to obtain a shadow area image.

[0101] Combination Figure 5 , one implementation of step 42 may be:

[0102] Step 52: construct a second layer, and construct a second region image on the second layer;

[0103] Among them, the first layer is the layer where the first area image is located, and the second area image has the same image data as the first area image, that is, the first area image of the first layer is copied to the second layer to distinguish it from the first area image of the first layer. Here, the first area image of the second layer is called the second area image.

[0104] Step 54: Determine an affine transformation matrix based on the positional relationship of the reference points before and after the affine transformation;

[0105] It should be noted that before executing step 54, the following steps are also included: determining the positional relationship of the reference points before and after the affine transformation;

[0106] Combination Figure 6 , the first implementation of this step can be:

[0107] The reference points before the affine transformation are reference points preselected on the first plane, and the first plane is the affine plane where the second area image is located, for example: the lower left corner point a1, the lower right corner point a2 and the top midpoint a3 of the circumscribed rectangle of the target object; the reference points after the affine transformation are reference points a1′ (corresponding to a1), a2′ (corresponding to a2) and a3′ (corresponding to a3) obtained by projecting the reference points before the affine transformation onto the second plane, and the second plane is a preset projection transformation plane.

[0108] Determining the incident angle of the light and the coordinates of the reference point before the affine transformation;

[0109] Determine the coordinates of the reference point after the affine transformation based on the unit vector corresponding to the incident angle of the light and the coordinates of the reference point before the affine transformation;

[0110] It is not difficult to understand that based on the coordinates of a1, a2 and a3, combined with the unit vector light=(x, y, z) corresponding to the incident angle of the light, the coordinates of a1′, a2′ and a3′ are calculated.

[0111] Accordingly, a first implementation of step 54 may be:

[0112] An affine transformation matrix is ​​determined based on the coordinates of the reference point before the affine transformation and the coordinates of the reference point after the affine transformation.

[0113] Combine the following Figure 6 , the first implementation method of “determining the positional relationship of the reference points before and after the affine transformation” and step 54 is exemplarily described:

[0114] First, assume that the coordinates of the preselected reference point a1 on the first plane are (x1, y1, z1), the coordinates of a2 are (x2, y2, z2), and the coordinates of a3 are (x3, y3, z3); ​​the incident angles of the light are 45° in the x, y, and z directions, and the unit vector corresponding to the incident angle of the light is light = (x, y, z), x∈[-1,1], y∈[0,1], z∈[0,1].

[0115] Secondly, based on the unit vector light, determine the coordinates of the reference points a1′, a2′, and a3′ corresponding to a1, a2, and a3 after affine transformation. Among them, since a1 and a1′ are the same reference point, and a2 and a2′ are the same reference point, the coordinates of a1′ are (x1, y1, z1), which is recorded as (x1′, y1′, z1′) to distinguish it from a1, and the coordinates of a2′ are (x2, y2, z2), which is recorded as (x2′, y2′, z2′) to distinguish it from a2. The calculation process of a3′'s coordinates is as follows:

[0116] Step S1: To facilitate calculation, first perform coordinate system transformation, namely:

[0117] x=x′

[0118] y=-y′

[0119] z=-z′

[0120] Step S2: Assume that the coordinates of a3′ are (x0, y0, 0)

[0121] Then, the formula for the straight line through point a3 is:

[0122]

[0123] This line intersects the y=0 plane, giving the coordinates of a3:

[0124]

[0125] Finally, substitute the obtained coordinates of a1-a3, a1′-a3′ into the following formula:

[0126]

[0127] Solve for the affine transformation parameter m 00 、m 01 、m 02 、m 10 、m 11 and m 12 , and obtain the specific affine transformation matrix.

[0128] Optionally, it also includes: a user editing step, which may specifically be:

[0129] Obtaining an adjustment instruction for the light incident angle, wherein the adjustment instruction carries the adjusted light incident angle;

[0130] The coordinates of the reference point after the affine transformation are adjusted based on the unit vector corresponding to the adjusted incident angle of the light and the coordinates of the reference point before the affine transformation.

[0131] Combination Figure 7 , a second implementation of the step of determining the positional relationship of the reference points before and after the affine transformation may be:

[0132] Determine the coordinates of a first set of preselected reference points on a first plane, for example, a1-a3, where the first plane is an affine plane where the second region image is located; determine the coordinates of a second set of preselected reference points on a second plane, for example, a1′-a3′, where the second plane is a preset projection transformation plane;

[0133] wherein the first group of reference points and the second group of reference points correspond one to one;

[0134] Accordingly, a second implementation of step 54 may be:

[0135] Based on the coordinates of the first set of reference points and the coordinates of the second set of reference points, an affine transformation matrix is ​​determined.

[0136] Combine the following Figure 7 , the second implementation of “determining the positional relationship of the reference points before and after the affine transformation” and step 54 is exemplarily described:

[0137] Step S1, determining the coordinates of the reference points a1-a3 selected by the user on the first plane and the coordinates of the reference points a1′-a3′ selected on the second plane;

[0138] Among them, the coordinates of a1 are (x1, y1, z1), the coordinates of a2 are (x2, y2, z2), the coordinates of a3 are (x3, y3, z3), the coordinates of a1′ are (x1′, y1′, z1′), the coordinates of a2′ are (x2′, y2′, z2′), and the coordinates of a3′ are (x3′, y3′, z3′).

[0139] Step S2: Substitute the coordinates of the selected 6 reference points into the following formula:

[0140]

[0141] Solve for the affine transformation parameter m 00 、m 01 、m 02 、m 10 、m 11 and m 12 , and obtain the specific affine transformation matrix.

[0142] Step 56: Based on the affine transformation matrix, perform affine transformation processing on the second region image to obtain an affine transformed image.

[0143] It is not difficult to understand that, based on the affine transformation matrix obtained in step 54, an affine transformation is performed on each point in the second region image or only on the points on the contour line to obtain an affine transformed image under illumination.

[0144] For the above two implementations of step 14, it is not difficult to understand that the execution order of the grayscale gradient processing and the affine transformation processing does not need to be limited. Moreover, step 24 (affine transformation step) in the first implementation is similar to the implementation of step 42 in the second implementation; step 44 (grayscale gradient processing) in the second implementation is similar to step 22 in the first implementation; therefore, step 24 and step 44 are not described in detail here.

[0145] Optionally, before executing step 16, the method further includes: a fuzzy processing step, which may specifically be:

[0146] Obtain a blur radius setting instruction, wherein the blur radius setting instruction carries a blur radius;

[0147] Based on the blur radius, blur processing is performed on the shadow area image.

[0148] Furthermore, the method further includes: a fuzzy adjustment step, which may specifically be:

[0149] Obtaining a blur radius adjustment instruction, wherein the adjustment instruction carries the adjusted blur radius;

[0150] Based on the adjusted blur radius, the blurred shadow area image is adjusted.

[0151] Based on the above blur processing step and blur adjustment step, the generated shadow image is processed so that the shadow area image can meet the aesthetic rules of the user.

[0152] Step 16: Perform image synthesis processing based on the shadow area image and the first area image to generate a shadow image of the target image.

[0153] The first area image is located in a first layer, the shadow area image is located in a second layer, and the display priority of the first layer is higher than that of the second layer;

[0154] It should be noted that one implementation of step 16 may be:

[0155] Determine a first reference point of the shadow area image and a second reference point of the first area image, wherein the first reference point corresponds to the second reference point; and merge the first layer and the second layer based on the first reference point and the second reference point.

[0156] Combination Figure 6 The first reference point can be the midpoint of the base of the circumscribed matrix on the second surface (i.e., the midpoint of the line segment between a1′ and a2′), and the second matrix can be the midpoint of the base of the circumscribed matrix on the first surface (i.e., the midpoint of the line segment between a1 and a2). Therefore, when merging the first layer and the second layer, the shadow area image and the first area image can be accurately merged.

[0157] Optionally, in order to improve the effect of the merged shadow image and avoid the influence of the background part of the target image, before step 16, the following step is further included:

[0158] Based on the first reference point, a region image in the target image corresponding to the shadow region image is determined; and the grayscale value of the pixel points in the region image corresponding to the shadow region image is adjusted to 0. That is, the region image in the target image on the first layer corresponding to the shadow region image is adjusted to white, so that after the images are merged, the shadow region image will not be affected by the pixel points in the background region.

[0159] It can be seen that this embodiment determines the first region image of the target object by determining the contour line of the target object in the target image, and then performs grayscale gradient processing and affine transformation processing based on the first region image to obtain a shadow region image corresponding to the first region image, and then merges the shadow region image and the first region image to obtain a shadow image of the target image. Compared with the solution in the prior art that obtains the spatial shadow of the target object by constructing a three-dimensional model of the target object, on the one hand, it avoids constructing a three-dimensional model of the target object, reduces the computing resources required for the shadow generation process, and improves the shadow generation efficiency; on the other hand, it avoids extracting depth information that is difficult to extract, and can improve the accuracy of the generated shadow.

[0160] Example 2

[0161] Figure 8 A flowchart of a shadow generation method provided in an embodiment of this specification is shown in FIG. Figure 8 The method can be executed by an application client, and specifically includes the following steps:

[0162] Step 82, analyzing the shape of the object to obtain the relationship between the image features of the object and the type of the object;

[0163] It should be noted that one implementation of step 82 may be:

[0164] Step S1: Model design and data collection

[0165] Model design: Use the vgg-16 network, reuse the convolutional layer part of the network, and then redesign the fully connected layer.

[0166] Among them, vgg-16, also known as OxfordNet, is a convolutional neural network structure developed by the Oxford Visual Geometry Group.

[0167] Data collection: crawl various object images and select a predetermined number of images suitable for generating shadows, for example, 1000 images. The object images cover several major categories of objects, such as shoes, clothing, bottles, cans, and circular shapes. Each category of objects has a certain number of training samples and a certain number of test samples.

[0168] Step S2: Model training

[0169] Since the cost of running a vgg-16 is very high, each batch needs to run the entire network, which will consume a lot of time and space resources. Therefore, in order to improve the training efficiency, this application provides a new training step, as follows:

[0170] First, all object images (including training samples and test samples) are sequentially input into the convolutional layer of the vgg-16 network to obtain ordered bottleneck features, and the bottleneck features are saved in offline form;

[0171] Then, a new model is rebuilt (the structure of the model is a combination of the two connection layers (256 dimensions and the number of categories) and the discard layer described previously). The input of the model is the bottleneck feature saved previously, and the corresponding output is the type label.

[0172] At the beginning of training, the previously saved offline bottleneck features are imported in sequence. Since the bottleneck features are recorded in order, the labels can be directly encoded with the One-Hot encoding of the image label (the correct category is 1, and the other categories are 0). Since the model has few features, the training is also much faster. The effect of such training is equivalent to the effect of training the entire vgg-16 model.

[0173] Import the saved offline data for training, and define the loss function as categorical cross entropy. The optimizer uses the Adam (Adaptive Moment Estimation) optimizer, which has the advantage that after bias correction, the learning rate of each iteration has a certain range, which can make the feature change relatively stable. Each batch uses 32 image data for gradient back propagation calculation. After 70 iterations, the accuracy of the data set can reach 98%, and the accuracy of the validation set can reach 90%. Save this fully connected layer model as offline and use it for prediction.

[0174] To further realize the intelligent shadow generation, step 82 further includes: a parameter group setting step, which may be specifically:

[0175] For each object type, one or more parameter groups are predefined, and the parameter groups include: light incident angle, blur radius, etc.

[0176] For example, for an image of a bottle, the classification model inputs that it belongs to a bottle-shaped object, and it can be determined that the bottle-shaped object is defined by a parameter group in which light is incident from the x, y, and z directions at 45° and the blur radius is 15. Then, this parameter group is brought into the previous embodiment or this embodiment to obtain a bottle-shaped object with a shadow image.

[0177] Step 84, determining the contour line of the target object in the target image;

[0178] Step 86: Determine a parameter group corresponding to the type of the target object based on the contour of the target object;

[0179] Wherein, the parameter group includes the light incident angle;

[0180] It is not difficult to understand that, based on the model trained in step 82, the contour line of the target object or the area image within the contour line is used as the input of the model to obtain the type of the target object output by the model, and then determine the predefined parameter group of the type.

[0181] Step 88: Perform grayscale gradient processing and affine transformation processing based on the first region image to obtain a shadow region image;

[0182] Among them, the first area image is the area image within the contour line in the target image, and the affine transformation processing is performed based on the incident angle of the light, including: a step of determining the positional relationship of the reference points before and after the affine transformation based on the incident angle of the light and a step of performing affine transformation processing based on the positional relationship of the reference points before and after the affine transformation.

[0183] Step 810: Perform image synthesis processing based on the shadow area image and the first area image to obtain a shadow image of the target image.

[0184] It should be noted that since steps 88 to 810 correspond to the "steps of determining the positional relationship of reference points before and after affine transformation", step 14 and step 16 recorded in the previous embodiment respectively, and their implementation methods are also similar, steps 88 to 810 will not be repeated here.

[0185] Optionally, the method further includes:

[0186] Based on the blur radius, blur processing is performed on the shadow area image.

[0187] Optionally, the method further includes:

[0188] Obtaining a blur radius adjustment instruction, wherein the adjustment instruction carries the adjusted blur radius;

[0189] Based on the adjusted blur radius, the blurred shadow area image is adjusted.

[0190] It can be seen that this embodiment builds a classification model to determine the type of the target object and the predefined parameter group corresponding to the type, and generates the shadow area image of the target object based on the predefined parameter group, and then merges to obtain the shadow image of the target image. Compared with the prior art, it can achieve full automation and intelligence in shadow image generation.

[0191] In addition, for the sake of simplicity, the above method implementations are described as a series of action combinations, but those skilled in the art should know that the implementations of the present invention are not limited by the described order of actions, because according to the implementations of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the implementations described in the specification are all preferred implementations, and the actions involved are not necessarily required for the implementations of the present invention.

[0192] Example 3

[0193] Fig. 9 This is a schematic diagram of the structure of a shadow generating device provided in Example 3 of this specification, see Fig. 9 The device may specifically include: a determination module 91, a first processing module 92 and a second processing module 93, wherein:

[0194] A determination module 91, used to determine the contour of the target object in the target image;

[0195] A first processing module 92 is used to perform grayscale gradient processing and affine transformation processing based on the first region image to obtain a shadow region image; wherein the first region image is a region image within the contour line of the target image, and the affine transformation processing is performed based on the positional relationship of the reference points before and after the affine transformation;

[0196] The second processing module 93 is used to perform image synthesis processing based on the shadow area image and the first area image to generate a shadow image of the target image.

[0197] Optionally, the first processing module 92 is specifically configured to:

[0198] Performing grayscale gradient processing based on the first region image to obtain a grayscale gradient image;

[0199] Based on the positional relationship between the reference points before and after the affine transformation, the grayscale gradient image is subjected to affine transformation processing to obtain a shadow area image.

[0200] Wherein, the first area image is located in the first layer;

[0201] Optionally, the first processing module 92 is specifically configured to:

[0202] constructing a second region image on a second layer, wherein the second region image has the same image data as the first region image;

[0203] performing binarization processing on the second region image to obtain a third region image;

[0204] The third region image is subjected to grayscale gradient processing to obtain a grayscale gradient image.

[0205] Optionally, the first processing module 92 is specifically configured to:

[0206] The grayscale values ​​of the pixels in the second region image are adjusted to 255.

[0207] Optionally, the first processing module 92 is specifically configured to:

[0208] Based on the position of the pixel point in the third area image, determining the relative position of the pixel point and the preselected reference point;

[0209] Based on the relative position of the pixel point and the reference point, the grayscale value of the pixel point is adjusted.

[0210] Optionally, the first processing module 92 is specifically configured to:

[0211] Performing affine transformation processing based on the first region image to obtain an affine transformed image;

[0212] The affine transformation image is subjected to grayscale gradient processing to obtain a shadow area image.

[0213] Wherein, the first area image is located in the first layer;

[0214] Optionally, the first processing module 92 is specifically configured to:

[0215] constructing a second region image on a second layer, wherein the second region image has the same image data as the first region image;

[0216] Determine an affine transformation matrix based on the positional relationship of the reference points before and after the affine transformation;

[0217] Based on the affine transformation matrix, an affine transformation process is performed on the second region image to obtain an affine transformation image.

[0218] The reference point before the affine transformation is a reference point preselected on a first plane, and the first plane is the affine plane where the second area image is located; the reference point after the affine transformation is a reference point obtained by projecting the reference point before the affine transformation onto the second plane, and the second plane is a preset projection transformation plane;

[0219] Then, the device further includes: a first position determination module, specifically configured to:

[0220] Determining the incident angle of the light and the coordinates of the reference point before the affine transformation;

[0221] Determine the coordinates of the reference point after the affine transformation based on the unit vector corresponding to the incident angle of the light and the coordinates of the reference point before the affine transformation;

[0222] Accordingly, the first processing module 92 is specifically configured to:

[0223] An affine transformation matrix is ​​determined based on the coordinates of the reference point before the affine transformation and the coordinates of the reference point after the affine transformation.

[0224] Optionally, the device further includes: a first position adjustment module, specifically configured to:

[0225] Obtaining an adjustment instruction for the light incident angle, wherein the adjustment instruction carries the adjusted light incident angle;

[0226] The coordinates of the reference point after the affine transformation are adjusted based on the unit vector corresponding to the adjusted incident angle of the light and the coordinates of the reference point before the affine transformation.

[0227] The optional device also includes: a second position determination module, specifically configured to:

[0228] Determine coordinates of a first set of preselected reference points on a first plane, where the first plane is an affine plane where the second region image is located;

[0229] Determining coordinates of a second set of preselected reference points on a second plane, the second plane being a preset projection transformation plane;

[0230] wherein the first group of reference points and the second group of reference points correspond one to one;

[0231] Accordingly, the first processing module 92 is specifically configured to:

[0232] Based on the coordinates of the first set of reference points and the coordinates of the second set of reference points, an affine transformation matrix is ​​determined.

[0233] Optionally, the device further includes: a fuzzy processing module, specifically configured to:

[0234] Obtain a blur radius setting instruction, wherein the blur radius setting instruction carries a blur radius;

[0235] Based on the blur radius, blur processing is performed on the shadow area image.

[0236] Optionally, the device further includes: a fuzzy adjustment module, specifically configured to:

[0237] Obtaining a blur radius adjustment instruction, wherein the adjustment instruction carries the adjusted blur radius;

[0238] Based on the adjusted blur radius, the blurred shadow area image is adjusted.

[0239] Wherein, the first area image is located in a first layer, the shadow area image is located in a second layer, and the display priority of the first layer is greater than that of the second layer;

[0240] Accordingly, the second processing module 93 is specifically configured to:

[0241] Determine a first reference point of the shadow area image and a second reference point of the first area image, the first reference point and the second reference point corresponding to each other;

[0242] The first layer and the second layer are merged based on the first reference point and the second reference point.

[0243] Optionally, the device further includes: an optimization module, specifically configured to:

[0244] Based on the first reference point, determining an area image in the target image corresponding to the shadow area image;

[0245] The grayscale values ​​of the pixels in the area image corresponding to the shadow area image are adjusted to 0.

[0246] It can be seen that this embodiment determines the first region image of the target object by determining the contour line of the target object in the target image, and then performs grayscale gradient processing and affine transformation processing based on the first region image to obtain a shadow region image corresponding to the first region image, and then merges the shadow region image and the first region image to obtain a shadow image of the target image. Compared with the solution in the prior art that obtains the spatial shadow of the target object by constructing a three-dimensional model of the target object, on the one hand, it avoids constructing a three-dimensional model of the target object, reduces the computing resources required for the shadow generation process, and improves the shadow generation efficiency; on the other hand, it avoids extracting depth information that is difficult to extract, and can improve the accuracy of the generated shadow.

[0247] Example 4

[0248] Fig.10 This is a schematic diagram of a shadow generating device provided in Example 4 of this specification, see Fig.10 The device may specifically include: a first determining module 101, a second determining module 102, a first processing module 103 and a second processing module 104, wherein:

[0249] A first determining module 101 is used to determine the contour of a target object in a target image;

[0250] A second determination module 102, configured to determine a parameter group corresponding to the type of the target object based on a contour line of the target object, the parameter group including a light incident angle;

[0251] The first processing module 103 is used to perform grayscale gradient processing and affine transformation processing based on the first region image to obtain a shadow region image; wherein the first region image is a region image within the contour line of the target image, and the affine transformation processing is performed based on the incident angle of the light;

[0252] The second processing module 104 is configured to perform image synthesis processing based on the shadow area image and the first area image to generate a shadow image of the target image.

[0253] Among them, the parameter group includes the incident angle of the light;

[0254] Optionally, the device further includes: an adjustment module, specifically configured to:

[0255] Based on the incident angle of the light, the positional relationship between the reference points before and after the affine transformation is determined.

[0256] Optionally, the parameter group also includes a blur radius;

[0257] Then, the device further includes: a fuzzy processing module, specifically configured to:

[0258] Based on the blur radius, blur processing is performed on the shadow area image.

[0259] Optionally, the device further includes: a fuzzy adjustment module, specifically configured to:

[0260] Obtaining a blur radius adjustment instruction, wherein the adjustment instruction carries the adjusted blur radius;

[0261] Based on the adjusted blur radius, the blurred shadow area image is adjusted.

[0262] It can be seen that this embodiment builds a classification model to determine the type of the target object and the predefined parameter group corresponding to the type, and generates the shadow area image of the target object based on the predefined parameter group, and then merges to obtain the shadow image of the target image. Compared with the prior art, it can achieve full automation and intelligence in shadow image generation.

[0263] In addition, for the above-mentioned device implementation, since it is basically similar to the method implementation, the description is relatively simple, and the relevant parts can be referred to the partial description of the method implementation.

[0264] It should be noted that, among the various components of the device of the present invention, the components are logically divided according to the functions to be implemented, but the present invention is not limited thereto, and the various components can be re-divided or combined as needed.

[0265] Example 5

[0266] Fig.11 This is a schematic diagram of the structure of an electronic device provided in Example 5 of this specification, see Fig.11 , the electronic device includes a processor, an internal bus, a network interface, a memory and a non-volatile memory, and of course may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a shadow generation device at the logical level. Of course, in addition to the software implementation, this application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0267] The network interface, processor and memory can be connected to each other through a bus system. The bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.11 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0268] The memory is used to store programs. Specifically, the program may include program code, and the program code includes computer operation instructions. The memory may include read-only memory and random access memory, and provide instructions and data to the processor. The memory may include high-speed random access memory (RAM), and may also include non-volatile memory (non-volatile memory), such as at least one disk storage.

[0269] The processor is used to execute the program stored in the memory, and specifically perform:

[0270] Determine the contour of the target object in the target image;

[0271] Performing grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the positional relationship of the reference points before and after the affine transformation;

[0272] An image synthesis process is performed based on the shadow area image and the first area image to generate a shadow image of the target image.

[0273] or,

[0274] Determine the contour of the target object in the target image;

[0275] Based on the contour of the target object, determining a parameter group corresponding to the type of the target object, the parameter group including a light incident angle;

[0276] Performing grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the incident angle of the light;

[0277] An image synthesis process is performed based on the shadow area image and the first area image to generate a shadow image of the target image.

[0278] The above application Figure 9-10 The method performed by the shadow generation device or the manager (Master) node disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0279] The shadow generating device may also perform Figure 1-5,8 method, and implement the method executed by the manager node.

[0280] Based on the same invention, an embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs. When the one or more programs are executed by an electronic device including multiple applications, the electronic device executes the shadow generation method provided in Examples 1-2.

[0281] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0282] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0283] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0284] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0285] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0286] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0287] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0288] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0289] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0290] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity 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, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0291] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0292] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A shadow generation method, applied to an application server, characterized in that: include: Determine, based on relevant data of a target image sent by an application client, a contour line of a target object in the target image, wherein the target image is an image to be processed that is imported by a user through operation by launching the application client installed on a terminal device; Performing grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the positional relationship of the reference points before and after the affine transformation; Performing image synthesis processing based on the shadow area image and the first area image to generate a shadow image of the target image; Before performing grayscale gradient processing and affine transformation processing based on the first region image, the method further includes: Inputting the contour line of the target object or the regional image within the contour line into a pre-trained classification model to obtain the type of the target object output by the model; Determining a parameter group predefined for the type according to the type of the target object, the parameter group including a light incident angle and a blur radius; Based on the incident angle of the light, determining the positional relationship of the reference points before and after the affine transformation; Before performing image synthesis processing based on the shadow area image and the first area image to generate the shadow image of the target image, the method further includes: performing blur processing on the shadow area image based on the blur radius; Also includes: Obtaining a blur radius adjustment instruction, wherein the adjustment instruction carries the adjusted blur radius; Based on the adjusted blur radius, the blurred shadow area image is adjusted.

2. The method according to claim 1, characterized in that The shadow area image is obtained by performing grayscale gradient processing and affine transformation processing based on the first area image, including: Performing grayscale gradient processing based on the first region image to obtain a grayscale gradient image; Based on the positional relationship between the reference points before and after the affine transformation, the grayscale gradient image is subjected to affine transformation processing to obtain a shadow area image.

3. The method according to claim 2, characterized in that The first area image is located in a first layer; The grayscale gradient processing is performed based on the first region image to obtain the grayscale gradient image, which includes: constructing a second region image on a second layer, wherein the second region image has the same image data as the first region image; performing binarization processing on the second region image to obtain a third region image; The third region image is subjected to grayscale gradient processing to obtain a grayscale gradient image.

4. The method according to claim 3, characterized in that The grayscale gradient processing of the third region image includes: Based on the position of the pixel point in the third area image, determining the relative position of the pixel point and the preselected reference point; Based on the relative position of the pixel point and the reference point, the grayscale value of the pixel point is adjusted.

5. The method according to claim 1, characterized in that The shadow area image is obtained by performing grayscale gradient processing and affine transformation processing based on the first area image, including: Performing affine transformation processing based on the first region image to obtain an affine transformed image; The affine transformation image is subjected to grayscale gradient processing to obtain a shadow area image.

6. The method according to claim 5, characterized in that The first area image is located in a first layer; The affine transformation processing is performed based on the first region image to obtain the affine transformation image, which includes: constructing a second region image on a second layer, wherein the second region image has the same image data as the first region image; Determine an affine transformation matrix based on the positional relationship of the reference points before and after the affine transformation; Based on the affine transformation matrix, an affine transformation process is performed on the second region image to obtain an affine transformation image.

7. The method according to claim 6, characterized in that The reference point before the affine transformation is a reference point preselected on a first plane, and the first plane is the affine plane where the second area image is located; the reference point after the affine transformation is a reference point obtained by projecting the reference point before the affine transformation onto the second plane, and the second plane is a preset projection transformation plane; Then, before determining the affine transformation matrix based on the positional relationship of the reference points before and after the affine transformation, the following is also included: Determining the incident angle of the light and the coordinates of the reference point before the affine transformation; Determine the coordinates of the reference point after the affine transformation based on the unit vector corresponding to the incident angle of the light and the coordinates of the reference point before the affine transformation; Wherein, based on the positional relationship between the reference points before and after the affine transformation, determining the affine transformation matrix includes: An affine transformation matrix is ​​determined based on the coordinates of the reference point before the affine transformation and the coordinates of the reference point after the affine transformation.

8. The method according to claim 7, characterized in that Also includes: Obtaining an adjustment instruction for the light incident angle, wherein the adjustment instruction carries the adjusted light incident angle; The coordinates of the reference point after the affine transformation are adjusted based on the unit vector corresponding to the adjusted incident angle of the light and the coordinates of the reference point before the affine transformation.

9. The method according to claim 6, characterized in that Before determining the affine transformation matrix based on the positional relationship of the reference points before and after the affine transformation, the following steps are also included: Determine coordinates of a first set of preselected reference points on a first plane, where the first plane is an affine plane where the second region image is located; Determining coordinates of a second set of preselected reference points on a second plane, the second plane being a preset projection transformation plane; wherein the first group of reference points and the second group of reference points correspond one to one; Wherein, based on the positional relationship between the reference points before and after the affine transformation, determining the affine transformation matrix includes: Based on the coordinates of the first set of reference points and the coordinates of the second set of reference points, an affine transformation matrix is ​​determined.

10. The method according to any one of claims 1 to 9, characterized in that: The first area image is located in a first layer, the shadow area image is located in a second layer, and the display priority of the first layer is higher than that of the second layer; The step of performing image synthesis processing based on the shadow area image and the first area image to generate the shadow image of the target image includes: Determine a first reference point of the shadow area image and a second reference point of the first area image, the first reference point and the second reference point corresponding to each other; The first layer and the second layer are merged based on the first reference point and the second reference point.

11. The method according to claim 10, characterized in that Before merging the first layer and the second layer, the method further includes: Based on the first reference point, determining an area image in the target image corresponding to the shadow area image; The grayscale values ​​of the pixels in the area image corresponding to the shadow area image are adjusted to 0.

12. A shadow generation method, applied to an application server, characterized in that: include: Determine, based on relevant data of a target image sent by an application client, a contour line of a target object in the target image, wherein the target image is an image to be processed that is imported by a user through operation by launching the application client installed on a terminal device; Inputting the contour line of the target object or the regional image within the contour line into a pre-trained classification model to obtain the type of the target object output by the model; Determining a parameter group predefined for the type according to the type of the target object, the parameter group including a light incident angle and a blur radius; Based on the incident angle of the light, determining the positional relationship of the reference points before and after the affine transformation; Performing grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the incident angle of the light; Performing image synthesis processing based on the shadow area image and the first area image to generate a shadow image of the target image; Before performing image synthesis processing based on the shadow area image and the first area image to generate the shadow image of the target image, the method further includes: performing blur processing on the shadow area image based on the blur radius; Also includes: Obtaining a blur radius adjustment instruction, wherein the adjustment instruction carries the adjusted blur radius; Based on the adjusted blur radius, the blurred shadow area image is adjusted.

13. A shadow generating device, characterized in that: include: A determination module, configured to determine, by the application server, a contour line of a target object in a target image according to relevant data of the target image sent by the application client, wherein the target image is an image to be processed imported by a user through operation by starting the application client installed on the terminal device; A first processing module is used to perform grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the positional relationship of the reference points before and after the affine transformation; A second processing module, configured to perform image synthesis processing based on the shadow area image and the first area image to generate a shadow image of the target image; The first processing module, before performing grayscale gradient processing and affine transformation processing based on the first region image, is further used to: Inputting the contour line of the target object or the regional image within the contour line into a pre-trained classification model to obtain the type of the target object output by the model; Determining a parameter group predefined for the type according to the type of the target object, the parameter group including a light incident angle and a blur radius; Based on the incident angle of the light, determining the positional relationship of the reference points before and after the affine transformation; A blur processing module, used for blurring the shadow area image based on the blur radius before performing image synthesis processing based on the shadow area image and the first area image to generate the shadow image of the target image; The blur processing module is further used to obtain an adjustment instruction for the blur radius, wherein the adjustment instruction carries the adjusted blur radius; Based on the adjusted blur radius, the blurred shadow area image is adjusted.

14. A shadow generating device, characterized in that: include: A first determination module, configured to determine, by the application server, a contour line of a target object in a target image sent by an application client, wherein the target image is an image to be processed that is imported by a user through operation by starting the application client installed on a terminal device; A second determination module is used to input the contour line of the target object or the regional image within the contour line into a pre-trained classification model to obtain the type of the target object output by the model; determine a parameter group predefined for the type according to the type of the target object, the parameter group including a light incident angle and a blur radius; and determine the positional relationship of the reference points before and after the affine transformation based on the light incident angle; A first processing module is used to perform grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the incident angle of the light; A second processing module, configured to perform image synthesis processing based on the shadow area image and the first area image to generate a shadow image of the target image; A blur processing module, used for blurring the shadow area image based on the blur radius before performing image synthesis processing based on the shadow area image and the first area image to generate the shadow image of the target image; The blur processing module is further used to obtain an adjustment instruction for the blur radius, wherein the adjustment instruction carries the adjusted blur radius; Based on the adjusted blur radius, the blurred shadow area image is adjusted.

15. An electronic device, characterized in that: include: processor; as well as a memory arranged to store computer executable instructions which, when executed, cause the processor to: The application server determines the contour of the target object in the target image according to the relevant data of the target image sent by the application client, wherein the target image is an image to be processed imported by the user through the operation of launching the application client installed on the terminal device; Performing grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the positional relationship of the reference points before and after the affine transformation; Performing image synthesis processing based on the shadow area image and the first area image to generate a shadow image of the target image; Before performing grayscale gradient processing and affine transformation processing based on the first region image, the method further includes: Inputting the contour line of the target object or the regional image within the contour line into a pre-trained classification model to obtain the type of the target object output by the model; Determining a parameter group predefined for the type according to the type of the target object, the parameter group including a light incident angle and a blur radius; Based on the incident angle of the light, determining the positional relationship of the reference points before and after the affine transformation; Before performing image synthesis processing based on the shadow area image and the first area image to generate the shadow image of the target image, the method further includes: performing blur processing on the shadow area image based on the blur radius; Also includes: Obtaining a blur radius adjustment instruction, wherein the adjustment instruction carries the adjusted blur radius; Based on the adjusted blur radius, the blurred shadow area image is adjusted.

16. An electronic device, characterized in that: include: processor; as well as a memory arranged to store computer executable instructions which, when executed, cause the processor to: The application server determines the contour of the target object in the target image according to the relevant data of the target image sent by the application client, wherein the target image is an image to be processed imported by the user through the operation of launching the application client installed on the terminal device; Inputting the contour line of the target object or the regional image within the contour line into a pre-trained classification model to obtain the type of the target object output by the model; Determining a parameter group predefined for the type according to the type of the target object, the parameter group including a light incident angle and a blur radius; Based on the incident angle of the light, determining the positional relationship of the reference points before and after the affine transformation; Performing grayscale gradient processing and affine transformation processing based on the first area image to obtain a shadow area image; wherein the first area image is an area image within the contour line of the target image, and the affine transformation processing is performed based on the incident angle of the light; Performing image synthesis processing based on the shadow area image and the first area image to generate a shadow image of the target image; Before performing image synthesis processing based on the shadow area image and the first area image to generate the shadow image of the target image, the method further includes: performing blur processing on the shadow area image based on the blur radius; Also includes: Obtaining a blur radius adjustment instruction, wherein the adjustment instruction carries the adjusted blur radius; Based on the adjusted blur radius, the blurred shadow area image is adjusted.