Method and device for generating shadow document image

By setting up a virtual camera in a three-dimensional virtual environment and adjusting the three-dimensional occlusion model, shadow document images are generated, which solves the problems of large differences between shadows and real scenes and single shapes in the existing technology, real-life shadow generation is achieved to meet the model training needs.

CN119722912APending Publication Date: 2025-03-28ZHUHAI KINGSOFT OFFICE SOFTWARE +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311253628.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-26
Publication Date
2025-03-28

Smart Images

  • Figure CN119722912A_ABST
    Figure CN119722912A_ABST
Patent Text Reader

Abstract

The invention relates to a shadow document image generation method and device, and the method comprises the steps: obtaining a three-dimensional document model, and setting a virtual camera in a three-dimensional virtual environment where the three-dimensional document model is located; adjusting a shooting angle of the virtual camera to enable the three-dimensional document model to be located in a shooting picture of the virtual camera; creating a three-dimensional shelter model, and adjusting the three-dimensional shelter model to enable the three-dimensional shelter model to generate a shadow on the three-dimensional document model; and rendering the three-dimensional document model through the virtual camera to generate a shadow document image. In this way, generation of the shadow in the real scene is simulated, the shadow in the generated shadow document image is slightly different from the shadow in the real scene, the vivid shadow can be generated, and the training requirement of a shadow removal model can be met.
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 method and device for generating a shadow document image. Background Art

[0002] Shadows are everywhere in our lives. Currently, in order to train a model to remove shadows, shadow images and their corresponding clear images are required as training samples. However, clear shadow images in real scenes are difficult to obtain, especially clear shadow document images (i.e., document images with shadows).

[0003] Currently, there is a method to generate clear shadow document images, that is, to simulate the shadow effect by adding random noise to the original document image, so as to obtain a clear shadow document image. The shadow of the shadow document image generated by this method is quite different from the shadow in the real scene, and the generated shadow shape is very simple, which cannot meet the training requirements of the shadow removal model. Summary of the invention

[0004] In order to solve the technical problem that the shadow document image generated by adding random noise to the original document image to simulate the shadow effect has a large difference from the shadow in the real scene, and the generated shadow shape is very simple and cannot meet the training requirements of the shadow removal model, the embodiment of the present application provides a method, device, electronic device and storage medium for generating a shadow document image. The specific technical solution is as follows:

[0005] In a first aspect of an embodiment of the present application, a method for generating a shadow document image is first provided, the method comprising:

[0006] Acquire a three-dimensional document model, and set a virtual camera in a three-dimensional virtual environment where the three-dimensional document model is located;

[0007] Adjusting the shooting angle of the virtual camera so that the three-dimensional document model is located in the shooting picture of the virtual camera;

[0008] Creating a three-dimensional occlusion model, and adjusting the three-dimensional occlusion model so that the three-dimensional occlusion model generates a shadow on the three-dimensional document model;

[0009] The three-dimensional document model is rendered by the virtual camera to generate a shadow document image.

[0010] In an optional implementation, the obtaining of the three-dimensional document model includes:

[0011] Creating a blank three-dimensional object model and acquiring an original document image, wherein the three-dimensional object model is adapted to the original document image;

[0012] The three-dimensional object model is rendered according to the original document image to generate a three-dimensional document model.

[0013] In an optional implementation, the rendering of the three-dimensional object model according to the original document image to generate a three-dimensional document model includes:

[0014] determining the original document image as a texture;

[0015] The texture is rendered into the three-dimensional object model to generate a three-dimensional document model.

[0016] In an optional implementation, after adjusting the shooting angle of the virtual camera so that the three-dimensional document model is located in the shooting picture of the virtual camera, the method further includes:

[0017] Obtaining a preset background set, wherein the preset background set includes a plurality of different backgrounds;

[0018] According to a preset background adjustment rule, the background of the three-dimensional document model is adjusted to a background in the preset background set.

[0019] In an optional implementation, adjusting the background of the three-dimensional document model to a background in the preset background set according to a preset background adjustment rule includes:

[0020] Determining the similarity between the background in the preset background set and the shadow;

[0021] sorting the backgrounds in the preset background set according to the similarity;

[0022] The background of the three-dimensional document model is adjusted to the Nth background, where N is a positive integer.

[0023] In an optional implementation, the number of the three-dimensional occluder model is at least one;

[0024] The step of adjusting the three-dimensional occlusion model so that the three-dimensional occlusion model generates a shadow on the three-dimensional document model includes:

[0025] Adjusting an occlusion parameter of at least one of the three-dimensional occlusion models so that at least one of the three-dimensional occlusion models generates a shadow on the three-dimensional document model;

[0026] The occlusion parameters include at least one of the following: position, shape, rotation angle, and scaling ratio.

[0027] In an optional implementation, before rendering the three-dimensional document model by the virtual camera to generate a shadow document image, the method further includes:

[0028] The ambient light of the three-dimensional virtual environment is adjusted.

[0029] In an optional implementation, adjusting the ambient light of the three-dimensional virtual environment includes:

[0030] Adjusting the ambient light of the three-dimensional virtual environment by adjusting the environmental parameters of the three-dimensional virtual environment;

[0031] The environmental parameters include at least one of the following: light intensity, color temperature, and high dynamic range imaging.

[0032] In an optional implementation, after rendering the three-dimensional document model by the virtual camera to generate a shadow document image, the method further includes:

[0033] Removing the three-dimensional occluding object model, and rendering the three-dimensional document model through the virtual camera to generate a shadow-free document image;

[0034] The shadow document image and the shadow-free document image form a training sample pair, and the training sample pair is stored in a shadow training set.

[0035] In a second aspect of the embodiments of the present application, a device for generating a shadow document image is also provided, the device comprising:

[0036] A model acquisition module, used to acquire a three-dimensional document model;

[0037] A camera setting module, used for setting a virtual camera in the three-dimensional virtual environment where the three-dimensional document model is located;

[0038] An angle adjustment module, used for adjusting the shooting angle of the virtual camera so that the three-dimensional document model is located in the shooting picture of the virtual camera;

[0039] A model creation module, used to create a three-dimensional occlusion model;

[0040] A model adjustment module, used for adjusting the three-dimensional occluding object model so that the three-dimensional occluding object model generates a shadow on the three-dimensional document model;

[0041] The image generation module is used to render the three-dimensional document model through the virtual camera to generate a shadow document image.

[0042] In an optional implementation, the model acquisition module specifically includes:

[0043] A model creation submodule is used to create a blank three-dimensional object model;

[0044] An image acquisition submodule, used to acquire an original document image, wherein the three-dimensional object model is adapted to the original document image;

[0045] The model rendering submodule is used to render the three-dimensional object model according to the original document image to generate a three-dimensional document model.

[0046] In an optional implementation, the model rendering submodule is specifically used for:

[0047] determining the original document image as a texture;

[0048] The texture is rendered into the three-dimensional object model to generate a three-dimensional document model.

[0049] In an optional embodiment, the device further comprises:

[0050] A background set acquisition module, used to acquire a preset background set, wherein the preset background set includes a plurality of different backgrounds;

[0051] The background adjustment module is used to adjust the background of the three-dimensional document model to the background in the preset background set according to a preset background adjustment rule.

[0052] In an optional implementation, the background adjustment module is specifically used to:

[0053] Determining the similarity between the background in the preset background set and the shadow;

[0054] sorting the backgrounds in the preset background set according to the similarity;

[0055] The background of the three-dimensional document model is adjusted to the Nth background, where N is a positive integer.

[0056] In an optional implementation, the number of the three-dimensional occluder model is at least one;

[0057] The model adjustment module is specifically used for:

[0058] Adjusting an occlusion parameter of at least one of the three-dimensional occlusion models so that at least one of the three-dimensional occlusion models generates a shadow on the three-dimensional document model;

[0059] The occlusion parameters include at least one of the following: position, shape, rotation angle, and scaling ratio.

[0060] In an optional embodiment, the device further comprises:

[0061] The ambient light adjustment module is used to adjust the ambient light of the three-dimensional virtual environment.

[0062] In an optional implementation, the ambient light adjustment module is specifically used to:

[0063] Adjusting the ambient light of the three-dimensional virtual environment by adjusting the environmental parameters of the three-dimensional virtual environment;

[0064] The environmental parameters include at least one of the following: light intensity, color temperature, and high dynamic range imaging.

[0065] In an optional embodiment, the device further comprises:

[0066] A model removal module, used to remove the three-dimensional occlusion model and render the three-dimensional document model through the virtual camera to generate a shadow-free document image;

[0067] The sample pair composition module is used to compose a training sample pair from the shadow document image and the shadow-free document image, and store the training sample pair into a shadow training set.

[0068] In a third aspect of the embodiments of the present application, there is further provided an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0069] Memory, used to store computer programs;

[0070] The processor is used to implement any method for generating a shadow document image as described in the first aspect above when executing a program stored in the memory.

[0071] In a fourth aspect of the embodiments of the present application, a storage medium is further provided, wherein instructions are stored in the storage medium, and when the instructions are executed on a computer, the computer executes the method for generating a shadow document image as described in any one of the first aspects above.

[0072] In a fifth aspect of the embodiments of the present application, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned methods for generating a shadow document image.

[0073] The technical solution provided by the embodiment of the present application is to obtain a three-dimensional document model, set a virtual camera in a three-dimensional virtual environment where the three-dimensional document model is located, adjust the shooting angle of the virtual camera so that the three-dimensional document model is located in the shooting picture of the virtual camera, create a three-dimensional occlusion model, and adjust the three-dimensional occlusion model so that the three-dimensional occlusion model produces a shadow on the three-dimensional document model, and then render the three-dimensional document model through the virtual camera to generate a shadow document image. By obtaining a three-dimensional document model, setting a virtual camera in a three-dimensional virtual environment where the three-dimensional document model is located, adjusting the shooting angle of the virtual camera so that the three-dimensional document model is located in the shooting picture of the virtual camera, creating and adjusting the three-dimensional occlusion model so that it produces a shadow on the three-dimensional document model, and then rendering the three-dimensional document model through the virtual camera to generate a shadow document image, the generation of shadows in real scenes is simulated in this way, and the shadows in the generated shadow document image are less different from those in real scenes, and realistic shadows can be generated, which can meet the training requirements of the model for removing shadows. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0075] In order to more clearly illustrate the embodiments of the present application 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.

[0076] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0077] Figure 1 It is a schematic diagram of an implementation process of a method for generating a shadow document image shown in an embodiment of the present application;

[0078] Figure 2 It is a schematic diagram of an implementation process of another method for generating a shadow document image shown in an embodiment of the present application;

[0079] Figure 3 A schematic diagram of an implementation process of a background adjustment method shown in an embodiment of the present application;

[0080] Figure 4 It is a schematic diagram of an implementation process of another method for generating a shadow document image shown in an embodiment of the present application;

[0081] Figure 5 A schematic diagram of a shadow document image shown in an embodiment of the present application;

[0082] Figure 6 A schematic diagram of a document image without shadows shown in an embodiment of the present application;

[0083] Figure 7 It is a schematic diagram of an implementation process of another method for generating a shadow document image shown in an embodiment of the present application;

[0084] Figure 8 It is a structural schematic diagram of a shadow document image generation device shown in an embodiment of the present application;

[0085] Fig. 9 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION

[0086] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are 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 this application.

[0087] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0088] In an embodiment of the present application, in order to generate realistic shadows and meet the training requirements of the shadow removal model, three-dimensional modeling can be used to simulate the generation of shadows in real scenes, and the shadows in the generated shadow document image are slightly different from those in the real scene.

[0089] Based on this, Figure 1 FIG. 1 is a schematic diagram of an implementation flow of a method for generating a shadow document image provided by an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:

[0090] S101, obtaining a three-dimensional document model, and setting a virtual camera in a three-dimensional virtual environment where the three-dimensional document model is located.

[0091] In an embodiment of the present application, the generation of shadows in a real scene can be simulated based on three-dimensional modeling, thereby obtaining a three-dimensional document model. The three-dimensional document model is based on three-dimensional modeling, and a blank three-dimensional object model (for example, a blank rectangular model) is obtained based on the three-dimensional modeling, and then the three-dimensional document model is obtained by combining an original document image with the blank three-dimensional object model.

[0092] In addition, the 3D document model is in a 3D virtual environment, so a virtual camera can be set in the 3D virtual environment where the 3D document model is located. The virtual camera can be set at any position in the 3D virtual environment where the 3D document model is located, and the virtual camera can be provided by a 3D modeling tool, for example, and the virtual camera provided in the 3D modeling tool can be directly used, which is not limited in the embodiments of the present application.

[0093] It should be noted that the virtual camera can be regarded as a camera simulating a real environment, and its relative position to the three-dimensional document model can be that the virtual camera is at the top of the three-dimensional document model, or the virtual camera can be on the left side of the three-dimensional document model, or the virtual camera can be on the right side of the three-dimensional document model. The embodiments of the present application do not limit this.

[0094] S102: Adjust the shooting angle of the virtual camera so that the three-dimensional document model is located in the shooting picture of the virtual camera.

[0095] In an embodiment of the present application, for a virtual camera in a three-dimensional virtual environment, the shooting angle of the virtual camera can be adjusted so that the three-dimensional document model is located in the shooting picture of the virtual camera, which means that the virtual camera can capture the complete three-dimensional document model.

[0096] Among them, for the virtual camera in the three-dimensional virtual environment, the shooting angle of the virtual camera can be adjusted so that the virtual camera can face the three-dimensional document model, and the three-dimensional document model can be located in the shooting picture of the virtual camera.

[0097] It should be noted that the shooting angle of the virtual camera can be adjusted as described above so that the virtual camera can face the three-dimensional document model. Of course, it can also be adjusted in other ways, and the embodiments of the present application are not limited to this.

[0098] S103: Create a three-dimensional occlusion model, and adjust the three-dimensional occlusion model so that the three-dimensional occlusion model generates a shadow on the three-dimensional document model.

[0099] In an embodiment of the present application, a three-dimensional occlusion model can be created based on three-dimensional modeling. The three-dimensional occlusion model serves as an occlusion object to block light in a three-dimensional virtual environment and can generate a shadow on the three-dimensional document model.

[0100] Based on this, the three-dimensional occlusion model created above can be adjusted so that the three-dimensional occlusion model generates a shadow on the three-dimensional document model, thereby simulating the generation of shadows in a real scene.

[0101] It should be noted that the created three-dimensional occlusion model can have various shapes. For example, the three-dimensional occlusion model can be a three-dimensional rectangular model, or a three-dimensional cylindrical model. This embodiment of the present application does not limit this.

[0102] In addition, in the process of creating the above-mentioned three-dimensional obstruction model, it is necessary to use the assistance of a three-dimensional modeling tool, and the three-dimensional modeling tool can be completed using any tool that can realize three-dimensional modeling, and the embodiment of the present application does not limit this.

[0103] S104, rendering the three-dimensional document model through a virtual camera to generate a shadow document image.

[0104] In the embodiment of the present application, after the above setting operation and adjustment operation, all conditions can be integrated to render and generate a shadow document image. Based on this, the three-dimensional document model can be rendered by a virtual camera to generate a shadow document image.

[0105] It should be noted that, for the process of rendering a three-dimensional document model through a virtual camera, for example, a suitable three-dimensional rendering engine can be selected, and rendering parameters (such as frame rate, resolution and sampling rate) can be set. After the above-mentioned setting operations and adjustment operations, all conditions can be integrated, and the three-dimensional document model can be rendered through the three-dimensional rendering engine at the shooting angle of the virtual camera to generate a shadow document image. The embodiments of the present application are not limited to this.

[0106] Through the above description of the technical solution provided in the embodiment of the present application, a three-dimensional document model is obtained, and a virtual camera is set in the three-dimensional virtual environment where the three-dimensional document model is located, and the shooting angle of the virtual camera is adjusted so that the three-dimensional document model is located in the shooting picture of the virtual camera, a three-dimensional occlusion model is created and adjusted so that it produces a shadow on the three-dimensional document model, and then the three-dimensional document model is rendered by the virtual camera to generate a shadow document image.

[0107] In this way, the generation of shadows in real scenes is simulated, and the shadows in the generated shadow document image are slightly different from the shadows in the real scene, so realistic shadows can be generated, which can meet the training requirements of the shadow removal model.

[0108] like Figure 2 FIG. 1 is a schematic diagram of an implementation flow of another method for generating a shadow document image provided by an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:

[0109] S201, creating a blank three-dimensional object model and acquiring an original document image, wherein the three-dimensional object model is adapted to the original document image.

[0110] In an embodiment of the present application, a blank three-dimensional object model can be created based on three-dimensional modeling. The blank three-dimensional object model can be, for example, a blank three-dimensional rectangular parallelepiped model, which can be regarded as a blank template model.

[0111] It should be noted that in the process of creating the above-mentioned blank three-dimensional object model, it is necessary to use the assistance of a three-dimensional modeling tool, and the three-dimensional modeling tool can be completed using any tool that can realize three-dimensional modeling, and the embodiment of the present application does not limit this.

[0112] In addition, in the embodiment of the present application, it is also necessary to obtain the original document image. The original document image is obtained based on image capture of the document. The document here can be, for example, a variety of documents, such as PDF documents, spreadsheet documents, text documents, slide documents, etc.

[0113] It should be noted that, for the original document image, it can be a clear, shadow-free document image, and it can be adapted to the blank three-dimensional object model created above. Specifically, they can be adapted to each other in shape. For example, the original document image is generally a rectangle, so the created blank three-dimensional object model can be a blank three-dimensional rectangular model. The embodiments of the present application do not limit this.

[0114] S202: Rendering a three-dimensional object model according to the original document image to generate a three-dimensional document model.

[0115] In an embodiment of the present application, for a three-dimensional object model, the three-dimensional object model can be rendered according to the original document image to generate a three-dimensional document model. The original document image can be rendered as a texture to the three-dimensional object model to obtain a three-dimensional document model. Here, the original document image is rendered as a texture to the three-dimensional object model to obtain a three-dimensional document model, which can be specifically regarded as treating the original document image as a texture, and then pasting the texture as a map to the surface of the three-dimensional object model, thereby obtaining a three-dimensional document model.

[0116] Based on this, the original document image obtained above can be determined as a texture, thereby rendering the texture into the three-dimensional object model to generate a three-dimensional document model. In this way, the original document image is rendered as a texture into the three-dimensional object model to obtain a three-dimensional document model.

[0117] It should be noted that, with regard to determining the original document image as a texture, it can be specifically in the texture interface, generally there is a button such as "Other Textures", which is used to insert the image as a texture into the texture set. The user can click the button to trigger the texture insertion operation, so that in response to the texture insertion operation, the Insert Image pop-up window can be displayed, and the user can select the original document image in the Insert Image pop-up window, so that in response to the image selection operation in the Insert Image pop-up window, the selected original document image can be determined, and then in response to the determination operation in the Insert Image pop-up window, the original document image can be inserted into the texture set, so that the original document image can be determined as a texture.

[0118] S203: Setting a virtual camera in the three-dimensional virtual environment where the three-dimensional document model is located.

[0119] In the embodiment of the present application, the 3D document model is in a 3D virtual environment, so a virtual camera can be set in the 3D virtual environment where the 3D document model is located. The virtual camera can be set at any position in the 3D virtual environment where the 3D document model is located, and the embodiment of the present application does not limit this.

[0120] S204: Adjust the shooting angle of the virtual camera so that the three-dimensional document model is located in the shooting picture of the virtual camera.

[0121] In an embodiment of the present application, for a virtual camera in a three-dimensional virtual environment, the shooting angle of the virtual camera can be adjusted so that the three-dimensional document model is located in the shooting picture of the virtual camera, which means that the virtual camera can capture the complete three-dimensional document model.

[0122] S205: Obtain a preset background set, where the preset background set includes a plurality of different backgrounds.

[0123] S206: According to a preset background adjustment rule, the background of the three-dimensional document model is adjusted to a background in a preset background set.

[0124] In an embodiment of the present application, the background of the three-dimensional document model can be optionally adjusted, and of course it is also possible to choose not to adjust the background of the three-dimensional document model. This can be selected according to actual needs, and of course it is also possible to choose whether to adjust the background of the three-dimensional document model based on the original document image.

[0125] Specifically, if the original document image has no background, you can choose to adjust the background of the three-dimensional document model. If the original document image has a background, to prevent confusion with the background of the three-dimensional document model, you can choose not to adjust the background of the three-dimensional document model. The embodiments of the present application are not limited to this.

[0126] When the background of the 3D document model is adjusted, a preset background set may be obtained, wherein the preset background set includes multiple different backgrounds. The background of the 3D document model may be adjusted to a background in the preset background set according to preset background adjustment rules.

[0127] It should be noted that, for the background of the three-dimensional document model, the background of the three-dimensional document model can be randomly adjusted to a background in a preset background set, or the background of the three-dimensional document model can be adjusted to a background in a preset background set in a polling manner, and the embodiment of the present application is not limited to this.

[0128] For example, a preset background set is obtained, wherein the preset background set includes background 1, background 2, and background 3. The background of the 3D document model can be randomly adjusted to background 1 or background 2 in the preset background set.

[0129] It should be noted that the above-mentioned adjustment of the background of the three-dimensional document model to a background in the preset background set is based on the consideration that backgrounds are everywhere in life. Therefore, it is necessary to adjust the background of the three-dimensional document model to a background in the preset background set, so that the generated shadow document image can be closer to life.

[0130] In addition, in an embodiment of the present application, for the backgrounds in the preset background set, the usage of each background in the preset background set in the process of generating a shadow document image can be counted, and based on the usage of each background in the preset background set, the background of the three-dimensional document model can be adjusted to the background in the preset background set.

[0131] It should be noted that the backgrounds in the preset background set can be sorted according to the usage of each background in the preset background set, for example, sorted from small to large, and the background of the three-dimensional document model can be adjusted to the background ranked first in the preset background set. The embodiments of the present application are not limited to this.

[0132] In addition, adjusting the background of the three-dimensional document model to the background in the preset background set according to the usage of each background in the preset background set can make the usage of each background in the preset background set more balanced, which means that the background of the three-dimensional document model can be evenly adjusted to the background in the preset background set.

[0133] For example, the preset background set includes background 1, background 2, and background 3. The usage of each background in the preset background set in the process of generating a shadow document image is counted, as shown in Table 1 below. According to the usage of each background in the preset background set, the background of the three-dimensional document model is adjusted to background 1 in the preset background set, so that the usage of each background in the preset background set is more balanced.

[0134] background Usage Background 1 20 times Background 2 30 times Background 3 30 times

[0135] Table 1

[0136] S207: Create at least one three-dimensional occluding object model, and adjust an occluding parameter of the at least one three-dimensional occluding object model so that the at least one three-dimensional occluding object model generates a shadow on the three-dimensional document model.

[0137] In an embodiment of the present application, at least one three-dimensional occlusion model can be created based on three-dimensional modeling. The at least one three-dimensional occlusion model created is used as an occlusion to block light in a three-dimensional virtual environment and can produce a shadow on the three-dimensional document model.

[0138] Based on this, for the at least one 3D occlusion model created above, the occlusion parameters of the at least one 3D occlusion model can be adjusted so that the at least one 3D occlusion model generates a shadow on the 3D document model, so as to simulate the generation of shadows in a real scene. The occlusion parameters include at least one of the following: position, shape, rotation angle, and scaling ratio.

[0139] It should be noted that the three-dimensional occlusion model created above may be created based on occlusions in a real scene, which means that the three-dimensional occlusion model is created by imitating occlusions in a real scene, and the embodiments of the present application do not limit this.

[0140] For example, by adjusting the position of at least one 3D occlusion model so that it is located directly above the 3D document model, the at least one 3D occlusion model can generate a shadow on the 3D document model, thereby simulating the generation of shadows in real scenes.

[0141] For example, by adjusting the shape of at least one 3D occluder so that the shape of at least one 3D occluder model becomes irregular, at least one 3D occluder model may generate a shadow on the 3D document model, thereby simulating the generation of shadows in real scenes.

[0142] For example, adjusting the rotation angle of at least one 3D occlusion model so that the at least one 3D occlusion model rotates 90 degrees clockwise can cause the at least one 3D occlusion model to generate a shadow on the 3D document model, thereby simulating the generation of shadows in real scenes.

[0143] For example, adjusting the scaling ratio of at least one 3D occlusion model to reduce the at least one 3D occlusion model by 50% can cause the at least one 3D occlusion model to generate a shadow on the 3D document model, thereby simulating the generation of shadows in real scenes.

[0144] In addition, in the process of creating the at least one three-dimensional obstruction model mentioned above, a three-dimensional modeling tool is needed to assist, and the three-dimensional modeling tool can be completed using any tool that can implement three-dimensional modeling, which is not limited in the embodiments of the present application.

[0145] The adjustment of the occlusion parameters of the at least one three-dimensional occlusion model may be random adjustment, so that various shadows may be generated on the three-dimensional document model.

[0146] In an embodiment of the present application, in order to avoid the shadow generated on the three-dimensional document model from being confused with the background of the three-dimensional document model and to avoid affecting the subsequent training of the shadow removal model, such influence can be avoided during the process of adjusting the background of the three-dimensional document model.

[0147] Specifically, Figure 3 FIG. 1 is a schematic diagram of an implementation flow of a background adjustment method provided in an embodiment of the present application. The method can be specifically applied to electronic devices and can specifically include the following steps:

[0148] S301, determining the similarity between the background in the preset background set and the shadow.

[0149] S302: Sort the backgrounds in the preset background set according to the similarity.

[0150] S303: Adjust the background of the three-dimensional document model to the Nth background, where N is a positive integer.

[0151] In an embodiment of the present application, for the background in the preset background set, the similarity between the background in the preset background set and the shadow (i.e., the shadow produced by the above-mentioned three-dimensional occlusion model on the three-dimensional document model) can be determined, so that the background in the preset background set can be sorted according to the similarity between the background and the shadow in the preset background set, and then the background of the three-dimensional document model is adjusted to the Nth background, where N is a positive integer.

[0152] For example, for the backgrounds in the preset background set, the similarity between the backgrounds and the shadows in the preset background set can be determined, so that the backgrounds in the preset background set can be sorted from small to large according to the similarity between the backgrounds and the shadows in the preset background set, and then the background of the three-dimensional document model can be adjusted to the first background, which means that the background of the three-dimensional document model is adjusted to a background that is dissimilar to the shadows generated on the three-dimensional document model as much as possible. In this way, the shadows generated on the three-dimensional document model can be avoided from being confused with the background of the three-dimensional document model, thereby avoiding the subsequent impact on the training of the removal of shadows model. This impact can be avoided in the process of adjusting the background of the three-dimensional document model.

[0153] It should be noted that the above-mentioned adjustment of the background of the three-dimensional document model to the Nth background is actually the switching of the background of the three-dimensional document model, that is, switching the background of the three-dimensional document model to the Nth background. For example, if the Nth background is spring, the background switching instruction can be executed to switch the background of the three-dimensional document model to spring.

[0154] In addition, in an embodiment of the present application, after adjusting the occlusion parameters of at least one three-dimensional occlusion model so that the at least one three-dimensional occlusion model generates a shadow on the three-dimensional document model, the similarity between the shadow and the background of the three-dimensional document model can be determined, and it can be determined whether the similarity is less than a certain similarity threshold. When the similarity is less than the preset similarity threshold, it means that the adjustment of the occlusion parameters of the at least one three-dimensional occlusion model is complete. When the similarity is greater than or equal to a certain similarity threshold, it means that the adjustment of the occlusion parameters of the at least one three-dimensional occlusion model is not complete, and the occlusion parameters of the at least one three-dimensional occlusion model can continue to be adjusted.

[0155] S208, adjusting the ambient light of the three-dimensional virtual environment.

[0156] In the embodiment of the present application, in addition to adjusting the occlusion parameters of at least one three-dimensional occlusion model as described above, the ambient light of the three-dimensional virtual environment may also be adjusted to produce different ambient light effects.

[0157] Specifically, the ambient light of the three-dimensional virtual environment can be adjusted by adjusting the environmental parameters of the three-dimensional virtual environment to produce different ambient light effects. The environmental parameters include at least one of the following: light intensity, color temperature, HDR (High Dynamic Range Imaging), so as to adjust the ambient light of the three-dimensional virtual environment to produce different ambient light effects.

[0158] For example, for a three-dimensional virtual environment, the illumination intensity of the three-dimensional virtual environment may be increased or decreased to adjust the ambient light of the three-dimensional virtual environment to produce different ambient light effects.

[0159] For example, for a three-dimensional virtual environment, the color temperature of the three-dimensional virtual environment may be increased or decreased to adjust the ambient light of the three-dimensional virtual environment to produce different ambient light effects.

[0160] In addition, the number of times the environmental parameters are adjusted during the process of generating the shadow document image can be counted; based on the number of adjustments, an adjustment strategy for the environmental parameters of the three-dimensional virtual environment is determined; and through the adjustment strategy, the environmental parameters of the three-dimensional virtual environment are adjusted to adjust the ambient light of the three-dimensional virtual environment.

[0161] S209, rendering the three-dimensional document model through a virtual camera to generate a shadow document image.

[0162] In the embodiment of the present application, after the above setting operation and adjustment operation, all conditions can be integrated to render and generate a shadow document image. Based on this, the three-dimensional document model can be rendered by a virtual camera to generate a shadow document image.

[0163] Through the above description of the technical solution provided in the embodiment of the present application, a blank three-dimensional object model is created, an original document image is obtained, the three-dimensional object model is rendered according to the original document image to generate a three-dimensional document model, a virtual camera is set in the three-dimensional virtual environment where the three-dimensional document model is located, the shooting angle of the virtual camera is adjusted so that the three-dimensional document model is located in the shooting picture of the virtual camera, the background of the three-dimensional document model is adjusted to the background in the preset background set according to the preset background adjustment rule, at least one three-dimensional occlusion model is created, and the occlusion parameters of at least one three-dimensional occlusion model are adjusted so that at least one three-dimensional occlusion model produces a shadow on the three-dimensional document model, the ambient light of the three-dimensional virtual environment is adjusted, the three-dimensional document model is rendered by the virtual camera, and a shadow document image is generated.

[0164] In this way, the generation of shadows in real scenes is simulated, and the shadows in the generated shadow document image are slightly different from the shadows in the real scene, so realistic shadows can be generated, which can meet the training requirements of the shadow removal model.

[0165] like Figure 4 FIG. 1 is a schematic diagram of an implementation flow of another method for generating a shadow document image provided by an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:

[0166] S401, creating a blank three-dimensional object model and acquiring an original document image, wherein the three-dimensional object model is adapted to the original document image.

[0167] In an embodiment of the present application, a blank three-dimensional object model is created based on three-dimensional modeling, and an original document image is acquired, wherein the three-dimensional object model is adapted to the original document image.

[0168] S402: Rendering a three-dimensional object model according to the original document image to generate a three-dimensional document model.

[0169] In the embodiment of the present application, for a 3D object model, the 3D object model can be rendered according to the original document image to generate a 3D document model. The original document image can be rendered as a texture to the 3D object model to obtain the 3D document model.

[0170] S403: Setting a virtual camera in the three-dimensional virtual environment where the three-dimensional document model is located.

[0171] In the embodiment of the present application, the three-dimensional document model is in a three-dimensional virtual environment, so a virtual camera can be set in the three-dimensional virtual environment where the three-dimensional document model is located.

[0172] S404: Adjust the shooting angle of the virtual camera so that the three-dimensional document model is located in the shooting picture of the virtual camera.

[0173] S405: Obtain a preset background set, where the preset background set includes a plurality of different backgrounds.

[0174] S406: According to a preset background adjustment rule, the background of the three-dimensional document model is adjusted to a background in a preset background set.

[0175] In an embodiment of the present application, a preset background set is obtained, wherein the preset background set includes a plurality of different backgrounds, and the background of the three-dimensional document model is adjusted to the background in the preset background set according to a preset background adjustment rule.

[0176] Wherein, for the background of the three-dimensional document model, the background of the three-dimensional document model may be randomly adjusted to a background in a preset background set.

[0177] S407: Create at least one three-dimensional occluding object model, and adjust an occlusion parameter of the at least one three-dimensional occluding object model so that the at least one three-dimensional occluding object model generates a shadow on the three-dimensional document model.

[0178] In an embodiment of the present application, at least one three-dimensional occlusion model can be created based on three-dimensional modeling. The at least one three-dimensional occlusion model created is used as an occlusion to block light in a three-dimensional virtual environment and can produce a shadow on the three-dimensional document model.

[0179] Based on this, for the at least one 3D occlusion model created above, the occlusion parameters of the at least one 3D occlusion model can be adjusted so that the at least one 3D occlusion model generates a shadow on the 3D document model, thereby simulating the generation of shadows in real scenes.

[0180] Wherein, for the occlusion parameters of at least one three-dimensional occlusion model, the occlusion parameters of at least one three-dimensional occlusion model may be randomly adjusted so that the at least one three-dimensional occlusion model generates a shadow on the three-dimensional document model.

[0181] S408, adjusting the ambient light of the three-dimensional virtual environment.

[0182] In the embodiment of the present application, in addition to adjusting the occlusion parameters of at least one three-dimensional occlusion model as described above, the ambient light of the three-dimensional virtual environment may also be adjusted to produce different ambient light effects.

[0183] Specifically, the ambient light of the three-dimensional virtual environment can be adjusted by randomly adjusting the illumination intensity, color temperature and / or HDR of the three-dimensional virtual environment to produce different ambient light effects.

[0184] S409, rendering the three-dimensional document model through a virtual camera to generate a shadow document image.

[0185] In the embodiment of the present application, after the above-mentioned setting operation and adjustment operation, all conditions can be integrated to render and generate a shadow document image. Based on this, the three-dimensional document model can be rendered by a virtual camera to generate a shadow document image, such as Figure 5 shown.

[0186] S410, removing the three-dimensional occluding object model, and rendering the three-dimensional document model through a virtual camera to generate a shadow-free document image.

[0187] In the embodiment of the present application, at least one of the three-dimensional occlusion models can be removed, while the remaining setting operations and adjustment operations can remain unchanged, so that all conditions can be integrated to render and generate a document image without a shadow. Based on this, the three-dimensional document model can be rendered by a virtual camera to generate a document image without a shadow, such as Figure 6 shown.

[0188] It should be noted that the only difference between the shadow document image and the shadow-free document image is the shadow, while the other conditions, such as the shooting angle of the virtual camera, ambient light, etc., are the same for both, and the embodiments of the present application do not limit this.

[0189] S411, forming a training sample pair from a shadow document image and a non-shadow document image, and storing the training sample pair into a shadow training set.

[0190] In an embodiment of the present application, after the above steps, a shadow document image and a shadow-free document image can be obtained, thereby, a training sample pair can be composed of the shadow document image and the shadow-free document image, and the training sample pair can be stored in a shadow training set to participate in the subsequent training of the shadow removal model.

[0191] Through the above description of the technical solution provided in the embodiment of the present application, a blank three-dimensional object model is created, an original document image is obtained, the three-dimensional object model is rendered according to the original document image to generate a three-dimensional document model, a virtual camera is set in the three-dimensional virtual environment where the three-dimensional document model is located, and the shooting angle of the virtual camera is adjusted so that the three-dimensional document model is located in the shooting picture of the virtual camera. According to the preset background adjustment rule, the background of the three-dimensional document model is adjusted to the background in the preset background set, at least one three-dimensional occlusion model is created, and the occlusion parameters of at least one three-dimensional occlusion model are adjusted so that at least one three-dimensional occlusion model produces a shadow on the three-dimensional document model, the ambient light of the three-dimensional virtual environment is adjusted, the three-dimensional document model is rendered by the virtual camera to generate a shadow document image, the three-dimensional occlusion model is removed, and the three-dimensional document model is rendered by the virtual camera to generate a shadow-free document image, a training sample pair is composed of the shadow document image and the shadow-free document image, and the training sample pair is stored in a shadow training set.

[0192] In this way, the shadows in the real scene are simulated, and the shadows in the generated shadow document image are less different from the shadows in the real scene, and realistic shadows can be generated, which can meet the training requirements of the shadow removal model. In addition, the generated shadows can be removed to generate a shadow-free document image, and the shadow document image and the shadow-free document image form a training sample pair, and the training sample pair is stored in the shadow training set to participate in the subsequent training of the shadow removal model.

[0193] The following is a description of the method for generating a shadow document provided by the embodiment of the present application in conjunction with a specific embodiment. Figure 7 As shown, firstly, a three-dimensional document model is obtained, wherein the three-dimensional document model can be obtained specifically in the following manner:

[0194] Use a 3D modeling tool to create a blank 3D cuboid model. In addition, obtain an original document image. The original document image here is a rectangle, which fits the blank 3D cuboid model. Then render the original document image as a texture into the blank 3D cuboid model, so that a 3D document model can be obtained.

[0195] Next, a virtual camera is set in the 3D virtual environment where the 3D document model is located. The virtual camera set here can be located on the top of the 3D document model. The shooting angle of the virtual camera can be adjusted so that the virtual camera can face the 3D document model directly, so that the 3D document model can be located in the shooting picture of the virtual camera.

[0196] Then, optionally, the background of the 3D document model may be adjusted, wherein a preset background set may be obtained, wherein the preset background set includes background 1, background 2, and background 3, and then the background of the 3D document model may be randomly adjusted to background 2 in the preset background set.

[0197] Then, two rendering paths are executed respectively: one is to render a document image with a shadow, that is, to generate a shadow document image. To this end, three-dimensional occlusion model 1, three-dimensional occlusion model 2, and three-dimensional occlusion model 3 are created as occlusions to block the light in the three-dimensional virtual environment, so as to generate a shadow on the three-dimensional document model.

[0198] Then, the positions, rotation angles, shapes, etc. of the three-dimensional occlusion model 1, the three-dimensional occlusion model 2, and the three-dimensional occlusion model 3 may be randomly adjusted to generate various shadows on the three-dimensional document model.

[0199] Then, the ambient light in the three-dimensional virtual environment can be adjusted, specifically by randomly adjusting the light intensity, color temperature and / or HDR (High Dynamic Range Imaging) of the three-dimensional virtual environment to produce different ambient light effects.

[0200] Finally, all conditions can be integrated to generate a shadow document image by rendering. Based on this, the three-dimensional document model can be rendered through a virtual camera to generate a shadow document image.

[0201] In addition, another rendering path can be performed simultaneously, fixing the lighting conditions, fixing the shooting angle of the virtual camera, removing the three-dimensional occlusion model, rendering the three-dimensional document model through the virtual camera, and generating a shadow-free document image.

[0202] After the two rendering paths are executed, a shadow document image and a shadow-free document image can be obtained, and the shadow document image and the shadow-free document image form a training sample pair, and the training sample pair is stored in a shadow training set.

[0203] In this way, the generation of shadows in real scenes is simulated, and the shadows in the generated shadow document image are slightly different from the shadows in the real scene, so realistic shadows can be generated, which can meet the training requirements of the shadow removal model.

[0204] In addition, the embodiment of the present application can realize batch processing and production of a large number of shadow document images with the help of a program, which greatly reduces labor costs, solves the problem of obtaining shadow document images, provides a basis for training models for removing shadows, and creates conditions for the implementation of related applications. In addition, the shadow document images generated by the embodiment of the present application can not only be used for training models for removing shadows, but also for data generation for other image tasks such as image denoising and image enhancement.

[0205] Corresponding to the above method embodiment, the present application embodiment also provides a device for generating a shadow document image, such as Figure 8 As shown, the device may include: a model acquisition module 810, a camera setting module 820, an angle adjustment module 830, a model creation module 840, a model adjustment module 850, and an image generation module 860.

[0206] Model acquisition module 810, used to acquire a three-dimensional document model;

[0207] A camera setting module 820, used to set a virtual camera in the three-dimensional virtual environment where the three-dimensional document model is located;

[0208] An angle adjustment module 830, used to adjust the shooting angle of the virtual camera so that the three-dimensional document model is located in the shooting picture of the virtual camera;

[0209] A model creation module 840, used to create a three-dimensional occluder model;

[0210] A model adjustment module 850, configured to adjust the three-dimensional occluding object model so that the three-dimensional occluding object model generates a shadow on the three-dimensional document model;

[0211] The image generation module 860 is used to render the three-dimensional document model through the virtual camera to generate a shadow document image.

[0212] In an optional implementation, the model acquisition module specifically includes:

[0213] A model creation submodule is used to create a blank three-dimensional object model;

[0214] An image acquisition submodule, used to acquire an original document image, wherein the three-dimensional object model is adapted to the original document image;

[0215] The model rendering submodule is used to render the three-dimensional object model according to the original document image to generate a three-dimensional document model.

[0216] In an optional implementation, the model rendering submodule is specifically used for:

[0217] determining the original document image as a texture;

[0218] The texture is rendered into the three-dimensional object model to generate a three-dimensional document model.

[0219] In an optional embodiment, the device further comprises:

[0220] A background set acquisition module, used to acquire a preset background set, wherein the preset background set includes a plurality of different backgrounds;

[0221] The background adjustment module is used to adjust the background of the three-dimensional document model to the background in the preset background set according to a preset background adjustment rule.

[0222] In an optional implementation, the background adjustment module is specifically used to:

[0223] Determining the similarity between the background in the preset background set and the shadow;

[0224] sorting the backgrounds in the preset background set according to the similarity;

[0225] The background of the three-dimensional document model is adjusted to the Nth background, where N is a positive integer.

[0226] In an optional implementation, the number of the three-dimensional occluder model is at least one;

[0227] The model adjustment module is specifically used for:

[0228] Adjusting an occlusion parameter of at least one of the three-dimensional occlusion models so that at least one of the three-dimensional occlusion models generates a shadow on the three-dimensional document model;

[0229] The occlusion parameters include at least one of the following: position, shape, rotation angle, and scaling ratio.

[0230] In an optional embodiment, the device further comprises:

[0231] The ambient light adjustment module is used to adjust the ambient light of the three-dimensional virtual environment.

[0232] In an optional implementation, the ambient light adjustment module is specifically used to:

[0233] Adjusting the ambient light of the three-dimensional virtual environment by adjusting the environmental parameters of the three-dimensional virtual environment;

[0234] The environmental parameters include at least one of the following: light intensity, color temperature, and high dynamic range imaging.

[0235] In an optional embodiment, the device further comprises:

[0236] A model removal module, used to remove the three-dimensional occlusion model and render the three-dimensional document model through the virtual camera to generate a shadow-free document image;

[0237] The sample pair composition module is used to compose a training sample pair from the shadow document image and the shadow-free document image, and store the training sample pair into a shadow training set.

[0238] The present application also provides an electronic device, such as Fig. 9 As shown, it includes a processor 91, a communication interface 92, a memory 93 and a communication bus 94, wherein the processor 91, the communication interface 92, and the memory 93 communicate with each other through the communication bus 94.

[0239] Memory 93, used for storing computer programs;

[0240] The processor 91 is used to execute the program stored in the memory 93 to implement the following steps:

[0241] Acquire a three-dimensional document model, and set a virtual camera in a three-dimensional virtual environment where the three-dimensional document model is located; adjust the shooting angle of the virtual camera so that the three-dimensional document model is located in the shooting picture of the virtual camera; create a three-dimensional occlusion model, and adjust the three-dimensional occlusion model so that the three-dimensional occlusion model produces a shadow on the three-dimensional document model; render the three-dimensional document model through the virtual camera to generate a shadow document image.

[0242] In an optional implementation, the obtaining of the three-dimensional document model includes:

[0243] Creating a blank three-dimensional object model and acquiring an original document image, wherein the three-dimensional object model is adapted to the original document image;

[0244] The three-dimensional object model is rendered according to the original document image to generate a three-dimensional document model.

[0245] In an optional implementation, the rendering of the three-dimensional object model according to the original document image to generate a three-dimensional document model includes:

[0246] determining the original document image as a texture;

[0247] The texture is rendered into the three-dimensional object model to generate a three-dimensional document model.

[0248] In an optional implementation, after adjusting the shooting angle of the virtual camera so that the three-dimensional document model is located in the shooting picture of the virtual camera, the method further includes:

[0249] Acquire a preset background set, wherein the preset background set includes a plurality of different backgrounds;

[0250] According to a preset background adjustment rule, the background of the three-dimensional document model is adjusted to a background in the preset background set.

[0251] In an optional implementation, adjusting the background of the three-dimensional document model to a background in the preset background set according to a preset background adjustment rule includes:

[0252] Determining the similarity between the background in the preset background set and the shadow;

[0253] sorting the backgrounds in the preset background set according to the similarity;

[0254] The background of the three-dimensional document model is adjusted to the Nth background, where N is a positive integer.

[0255] In an optional implementation, the number of the three-dimensional occluder model is at least one;

[0256] The step of adjusting the three-dimensional occlusion model so that the three-dimensional occlusion model generates a shadow on the three-dimensional document model includes:

[0257] Adjusting an occlusion parameter of at least one of the three-dimensional occlusion models so that at least one of the three-dimensional occlusion models generates a shadow on the three-dimensional document model;

[0258] The occlusion parameters include at least one of the following: position, shape, rotation angle, and scaling ratio.

[0259] In an optional implementation, before rendering the three-dimensional document model by the virtual camera to generate a shadow document image, the method further includes:

[0260] The ambient light of the three-dimensional virtual environment is adjusted.

[0261] In an optional implementation, adjusting the ambient light of the three-dimensional virtual environment includes:

[0262] Adjusting the ambient light of the three-dimensional virtual environment by adjusting the environmental parameters of the three-dimensional virtual environment;

[0263] The environmental parameters include at least one of the following: light intensity, color temperature, and high dynamic range imaging.

[0264] In an optional implementation, after rendering the three-dimensional document model by the virtual camera to generate a shadow document image, the method further includes:

[0265] Removing the three-dimensional occluding object model, and rendering the three-dimensional document model through the virtual camera to generate a shadow-free document image;

[0266] The shadow document image and the shadow-free document image form a training sample pair, and the training sample pair is stored in a shadow training set.

[0267] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0268] The communication interface is used for communication between the above electronic device and other devices.

[0269] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0270] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can 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 gate or transistor logic devices, discrete hardware components.

[0271] In another embodiment provided in the present application, a storage medium is also provided, in which instructions are stored. When the instructions are executed on a computer, the computer executes the method for generating a shadow document image described in any of the above embodiments.

[0272] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the method for generating a shadow document image described in any one of the above embodiments.

[0273] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a storage medium, or transmitted from one storage medium to another storage medium, for example, the computer instructions may be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0274] It should be noted that, in this article, relational terms such as first and second, etc. 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.

[0275] Each embodiment in this specification is described in a related 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.

[0276] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A method for generating a shadow document image, characterized in that: The method comprises: Acquire a three-dimensional document model, and set a virtual camera in a three-dimensional virtual environment where the three-dimensional document model is located; Adjusting the shooting angle of the virtual camera so that the three-dimensional document model is located in the shooting picture of the virtual camera; Creating a three-dimensional occlusion model, and adjusting the three-dimensional occlusion model so that the three-dimensional occlusion model generates a shadow on the three-dimensional document model; The three-dimensional document model is rendered by the virtual camera to generate a shadow document image.

2. The method according to claim 1, characterized in that The obtaining of the three-dimensional document model comprises: Creating a blank three-dimensional object model and acquiring an original document image, wherein the three-dimensional object model is adapted to the original document image; The three-dimensional object model is rendered according to the original document image to generate a three-dimensional document model.

3. The method according to claim 2, characterized in that The step of rendering the three-dimensional object model according to the original document image to generate a three-dimensional document model includes: determining the original document image as a texture; The texture is rendered into the three-dimensional object model to generate a three-dimensional document model.

4. The method according to claim 1, characterized in that After adjusting the shooting angle of the virtual camera so that the three-dimensional document model is located in the shooting picture of the virtual camera, the method further includes: Acquire a preset background set, wherein the preset background set includes a plurality of different backgrounds; According to a preset background adjustment rule, the background of the three-dimensional document model is adjusted to a background in the preset background set.

5. The method according to claim 4, characterized in that The step of adjusting the background of the three-dimensional document model to a background in the preset background set according to a preset background adjustment rule includes: Determining the similarity between the background in the preset background set and the shadow; sorting the backgrounds in the preset background set according to the similarity; The background of the three-dimensional document model is adjusted to the Nth background, where N is a positive integer.

6. The method according to claim 1, characterized in that The number of the three-dimensional occluder model is at least one; The step of adjusting the three-dimensional occlusion model so that the three-dimensional occlusion model generates a shadow on the three-dimensional document model includes: Adjusting an occlusion parameter of at least one of the three-dimensional occlusion models so that at least one of the three-dimensional occlusion models generates a shadow on the three-dimensional document model; The occlusion parameters include at least one of the following: position, shape, rotation angle, and scaling ratio.

7. The method according to claim 1, characterized in that Before rendering the three-dimensional document model by the virtual camera to generate a shadow document image, the method further includes: The ambient light of the three-dimensional virtual environment is adjusted.

8. The method according to claim 7, characterized in that The step of adjusting the ambient light of the three-dimensional virtual environment comprises: Adjusting the ambient light of the three-dimensional virtual environment by adjusting the environmental parameters of the three-dimensional virtual environment; The environmental parameters include at least one of the following: light intensity, color temperature, and high dynamic range imaging.

9. The method according to claim 1, characterized in that: After rendering the three-dimensional document model by the virtual camera to generate a shadow document image, the method further includes: Removing the three-dimensional occluding object model, and rendering the three-dimensional document model through the virtual camera to generate a shadow-free document image; The shadow document image and the shadow-free document image form a training sample pair, and the training sample pair is stored in a shadow training set.

10. A device for generating a shadow document image, characterized in that: The device comprises: A model acquisition module, used to acquire a three-dimensional document model; A camera setting module, used for setting a virtual camera in the three-dimensional virtual environment where the three-dimensional document model is located; An angle adjustment module, used for adjusting the shooting angle of the virtual camera so that the three-dimensional document model is located in the shooting picture of the virtual camera; A model creation module, used to create a three-dimensional occlusion model; A model adjustment module, used for adjusting the three-dimensional occluding object model so that the three-dimensional occluding object model generates a shadow on the three-dimensional document model; The image generation module is used to render the three-dimensional document model through the virtual camera to generate a shadow document image.