An image generation method and apparatus
By using 3D model rendering technology based on simulated illumination, the problem of low efficiency in X-ray image generation in existing technologies has been solved, achieving efficient image generation without the need for physical illumination.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-30
- Publication Date
- 2026-03-31
AI Technical Summary
Existing technologies require the use of an X-ray machine to irradiate the actual object when generating X-ray images, which is a complex and inefficient process.
By obtaining the object's three-dimensional model and photosensitive parameters, the three-dimensional model is rendered using simulated illumination to generate an image of light passing through the object.
X-ray images can be generated without creating a real lighting environment, thus improving image generation efficiency.
Smart Images

Figure CN114445544B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image generation method and apparatus. Background Technology
[0002] With the rapid development of image processing technology, its applications are becoming increasingly widespread. To meet the needs of different applications, it is often necessary to obtain images of objects under different lighting environments. For example, in film and television production, to achieve X-ray effects, it may be necessary to obtain X-ray images of objects under X-rays.
[0003] Obtaining an X-ray image of an object typically requires an X-ray machine and film. Specifically, an X-ray machine emits X-rays to irradiate the object; the X-rays penetrate the object and form an image on the film, thus obtaining an X-ray image of the object.
[0004] While the above method can obtain X-ray images, it requires purchasing an X-ray machine and operating the machine to emit X-rays onto the object. The process is complex, resulting in low efficiency in obtaining X-ray images of the object. Summary of the Invention
[0005] The purpose of this application is to provide an image generation method and apparatus to improve image generation efficiency. The specific technical solution is as follows:
[0006] In a first aspect, embodiments of this application provide an image generation method, the method comprising:
[0007] Obtain a 3D model of the object;
[0008] Photosensitive parameters reflecting the photosensitivity of the object are obtained, and light parameters of penetrating light are obtained;
[0009] Based on the photosensitivity parameters and light parameters, the three-dimensional model is rendered in a simulated illumination manner to generate an image representing the light rays passing through the object.
[0010] In one embodiment of this application, when the number of objects is greater than 1, the step of rendering the three-dimensional model based on the photosensitivity parameters and light parameters in a simulated illumination manner to generate an image representing the image formed after the light penetrates the objects includes:
[0011] Based on the requirements of the scenario, the obtained 3D models of the objects are combined to obtain a composite model;
[0012] Based on the light parameters and the photosensitive parameters of each object, the combined model is rendered in a simulated illumination manner to generate an image representing the image formed after the light passes through the combined objects, wherein the combined objects are obtained by combining the various objects according to the scene requirements.
[0013] In one embodiment of this application, the ray parameters of the light include a first intensity of the light;
[0014] The step of rendering an image of the combined model based on the light parameters and the photosensitive parameters of each object, in a simulated illumination manner, to generate an image representing the image formed after the light penetrates the combined objects, includes:
[0015] Based on the first intensity and the photosensitive parameters of each object, calculate the second intensity if the light penetrates the combined object;
[0016] Based on the calculated second intensity, the combined model is rendered to generate an image representing the image formed after the light penetrates the combined object.
[0017] In one embodiment of this application, calculating the second intensity based on the first intensity and the photosensitivity parameters of each object, if the light penetrates the combined object, includes:
[0018] Identify a first overlapping region in the combined model where there is model overlap along the direction of the light ray;
[0019] Based on the first intensity and the photosensitive parameters of the object in the second overlapping region, calculate the second intensity after the light penetrates the object in the second overlapping region, wherein the second overlapping region is: the region in the combined object that corresponds to the first overlapping region of the combined model;
[0020] Based on the first intensity and the photosensitive parameters of the object in the non-overlapping region, a second intensity is calculated if the light penetrates the object in the non-overlapping region, wherein the non-overlapping region is the region of the combined object other than the second overlapping region.
[0021] In one embodiment of this application, calculating the second intensity if the light penetrates the object in the second overlapping region based on the first intensity and the photosensitivity parameters of the object in the second overlapping region includes:
[0022] Based on the photosensitive parameters of each object in the second overlapping region, calculate the combined photosensitive parameters of all objects in the second overlapping region;
[0023] Based on the combined photosensitivity parameters and the first intensity, a second intensity is calculated if the light penetrates an object located in the second overlapping region.
[0024] In one embodiment of this application, calculating the second intensity if the light penetrates the object in the second overlapping region based on the first intensity and the photosensitivity parameters of the object in the second overlapping region includes:
[0025] Based on the first intensity and the photosensitive parameters of the objects in the second overlapping region, the intensity of the light rays after they sequentially penetrate each of the objects in the second overlapping region is calculated, thus obtaining the second intensity of the light rays after they penetrate all the objects in the second overlapping region.
[0026] In one embodiment of this application, the photosensitive parameters of the object include the transmittance of the object, and the second intensity R2 is calculated by the following formula:
[0027] A = lg(1 / T)
[0028] R2 = R1 * A
[0029] Wherein, T represents the transmittance of the object through which the light passes, A represents the absorbance of the object through which the light passes, and R1 represents the first intensity of the light.
[0030] In one embodiment of this application, obtaining the three-dimensional model of the object includes:
[0031] Determine if a 3D model of an object exists in the 3D model library;
[0032] If it exists, the 3D model is obtained directly from the 3D model library;
[0033] If the object does not exist, a 3D model of the object is constructed and uploaded to the 3D model library.
[0034] In one embodiment of this application, after generating an image representing the light rays passing through the object, the method further includes:
[0035] The generated image is post-processed, wherein the post-processing includes at least one of the following methods: adding noise, adding distortion, and adding texture.
[0036] Secondly, embodiments of this application provide an image generation apparatus, the apparatus comprising:
[0037] The model acquisition module is used to obtain a 3D model of an object;
[0038] The parameter acquisition module is used to acquire photosensitive parameters that reflect the photosensitive ability of the object, and to acquire light parameters that allow light to penetrate.
[0039] The image generation module is used to render the three-dimensional model based on the photosensitive parameters and light parameters in a simulated illumination manner, and generate an image representing the image formed after the light passes through the object.
[0040] In one embodiment of this application, when the number of objects is greater than 1, the image generation module specifically includes:
[0041] The combined model acquisition submodule is used to combine the 3D models of the obtained objects based on scene requirements to obtain a combined model;
[0042] The image generation submodule is used to perform image rendering on the combined model in a simulated illumination manner based on the light parameters and the photosensitive parameters of each object, generating an image representing the image formed after the light passes through the combined objects, wherein the combined objects are obtained by combining each object according to the scene requirements.
[0043] In one embodiment of this application, the ray parameters of the light include a first intensity of the light;
[0044] The image generation submodule specifically includes:
[0045] An intensity calculation unit is used to calculate a second intensity based on the first intensity and the photosensitive parameters of each object, if the light penetrates the combined object;
[0046] An image generation unit is used to render an image of the combined model based on a calculated second intensity, generating an image representing the light rays passing through the combined object.
[0047] In one embodiment of this application, the strength calculation unit specifically includes:
[0048] The region determination subunit is used to determine the first overlapping region in the combined model where there is model overlap along the direction of the light irradiation;
[0049] The first calculation subunit is used to calculate the second intensity after the light penetrates the object in the second overlapping region, based on the first intensity and the photosensitive parameters of the object in the second overlapping region, wherein the second overlapping region is: the region in the combined object that corresponds to the first overlapping region of the combined model;
[0050] The second calculation subunit is used to calculate the second intensity if the light penetrates the object in the non-overlapping region based on the first intensity and the photosensitive parameters of the object in the non-overlapping region, wherein the non-overlapping region is the region in the combined object other than the second overlapping region.
[0051] In one embodiment of this application, the first computing subunit is specifically used for:
[0052] Based on the photosensitive parameters of each object in the second overlapping region, calculate the combined photosensitive parameters of all objects in the second overlapping region;
[0053] Based on the combined photosensitivity parameters and the first intensity, a second intensity is calculated if the light penetrates an object located in the second overlapping region.
[0054] In one embodiment of this application, the first computing subunit is specifically used for:
[0055] Based on the first intensity and the photosensitive parameters of the objects in the second overlapping region, the intensity of the light rays after they sequentially penetrate each of the objects in the second overlapping region is calculated, thus obtaining the second intensity of the light rays after they penetrate all the objects in the second overlapping region.
[0056] In one embodiment of this application, the photosensitive parameters of the object include the transmittance of the object, and the second intensity R2 is calculated by the following formula:
[0057] A = lg(1 / T)
[0058] R2 = R1 * A
[0059] Wherein, T represents the transmittance of the object through which the light passes, A represents the absorbance of the object through which the light passes, and R1 represents the first intensity of the light.
[0060] In one embodiment of this application, the model acquisition module is specifically used for:
[0061] Determine if a 3D model of an object exists in the 3D model library;
[0062] If it exists, the 3D model is obtained directly from the 3D model library;
[0063] If the object does not exist, a 3D model of the object is constructed and uploaded to the 3D model library.
[0064] In one embodiment of this application, the apparatus further includes an image post-processing module, used for:
[0065] After generating an image representing the light rays passing through the object, the generated image is post-processed, wherein the post-processing includes at least one of the following methods: adding noise, adding distortion, and adding texture.
[0066] Thirdly, embodiments of this application provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0067] Memory, used to store computer programs;
[0068] When a processor executes a program stored in memory, it implements any of the steps described in the first aspect.
[0069] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the methods described in the first aspect.
[0070] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the image generation method steps described above.
[0071] Beneficial effects of the embodiments in this application:
[0072] When generating an image using the scheme provided in this application, a three-dimensional model of the object is first obtained; photosensitive parameters reflecting the object's photosensitivity are obtained, as well as light parameters representing penetrating light rays are obtained; based on the photosensitive parameters and light parameters, the three-dimensional model is rendered using simulated illumination to generate an image representing the image formed after light penetrates the object. In this way, an image of an object formed under penetrating light can be generated through simulation, eliminating the need to create a realistic lighting environment and saving image generation steps. Therefore, the image generation scheme provided in this application can improve image generation efficiency. Attached Figure Description
[0073] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings without creative effort.
[0074] Figure 1 A flowchart illustrating an image generation method provided in an embodiment of this application;
[0075] Figure 2 A flowchart illustrating a method for obtaining a three-dimensional model provided in an embodiment of this application;
[0076] Figure 3 A schematic flowchart illustrating another image generation method provided in an embodiment of this application;
[0077] Figure 4 A schematic diagram of multiple three-dimensional models provided in an embodiment of this application;
[0078] Figure 5 A schematic diagram of a combined model provided in an embodiment of this application;
[0079] Figure 6 A schematic diagram of a generated image provided in an embodiment of this application;
[0080] Figure 7 A flowchart illustrating a second strength calculation method provided in an embodiment of this application;
[0081] Figure 8 A schematic diagram of a first overlapping region provided in an embodiment of this application;
[0082] Figure 9 A flowchart illustrating yet another image generation method provided in an embodiment of this application;
[0083] Figure 10 This is a schematic diagram of the structure of an image generation device provided in an embodiment of this application;
[0084] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0085] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0086] To improve image generation efficiency, this application provides an image generation method and apparatus, which will be described in detail below.
[0087] See Figure 1 , Figure 1 This is a flowchart illustrating an image generation method provided in an embodiment of this application. The method can be applied to electronic devices such as computers, mobile phones, and tablet computers. The method includes the following steps 101 to 103.
[0088] Step 101: Obtain the three-dimensional model of the object.
[0089] The objects mentioned above can be animals, users, daily necessities, machinery, etc. There can be one or more objects, and correspondingly, the obtained 3D models of the objects can also be one or more.
[0090] Specifically, when obtaining a 3D model of an object, one can construct the 3D model, for example, by using a 3D modeling tool to create a 3D model of the object, or by directly performing a 3D scan of the object to obtain its 3D model. Alternatively, one can obtain the 3D model of the object from a pre-defined 3D model library.
[0091] See Figure 2 , Figure 2 This is a flowchart illustrating a three-dimensional model acquisition method provided in an embodiment of this application. The method includes the following steps 201 to 203.
[0092] Step 201: Determine whether a 3D model of the object exists in the 3D model library. If it exists, proceed to step 202; otherwise, proceed to step 203.
[0093] Step 202: Obtain the 3D model directly from the 3D model library;
[0094] Step 203: Build a 3D model of the object and upload it to the 3D model library.
[0095] Specifically, the 3D model library pre-stores various 3D models. When a 3D model of an object is needed, it is first determined whether the object's 3D model exists in the 3D model library. If it exists, the object's 3D model can be directly obtained from the 3D model library. If it does not exist, the object's 3D model can be constructed, and the constructed 3D model can be uploaded to the 3D model library. This makes it convenient to obtain the object's 3D model directly from the 3D model library the next time.
[0096] When it is necessary to obtain the 3D models of multiple objects, the 3D models of each object can be obtained sequentially by following the above method.
[0097] Step 102: Obtain photosensitivity parameters that reflect the photosensitivity of the object, and obtain light parameters that allow light to penetrate.
[0098] The photosensitivity of an object can include its ability to absorb, emit, and refract light. Photosensitivity parameters reflecting this ability can include the object's reflectance and transmittance. Furthermore, since an object's photosensitivity is related to its absorption coefficient, density, and thickness, and these factors are related to the object's material, photosensitivity parameters can also include the object's material information, absorption coefficient, density, and thickness.
[0099] The aforementioned penetrating light can be X-rays, ultraviolet rays, gamma rays, etc., and the light parameters of the aforementioned light can include wavelength, frequency, intensity, etc.
[0100] In one embodiment of this application, the photosensitivity parameters of the object can be set manually, obtained through experimental measurement, or calculated based on the object's size, thickness, material, etc. This application does not limit these parameters.
[0101] The ray parameters of the aforementioned rays can be set according to the requirements of the scene. For example, when it is necessary to obtain an X-ray image of an object, the ray parameters of the aforementioned rays can be the ray parameters of X-rays.
[0102] Step 103: Based on the photosensitivity parameters and light parameters, the three-dimensional model is rendered in a simulated illumination manner to generate an image representing the image formed after light passes through the object.
[0103] Specifically, based on photosensitivity parameters and light parameters, the parameters after the aforementioned penetrating light passes through an object can be calculated, thus simulating the parameters after real light passes through an object. The calculation results can then be used to render the 3D model, generating an image that simulates the real light passing through the object.
[0104] In one embodiment of this application, after the image is generated in step 103 above, post-processing can be performed on the generated image.
[0105] The post-processing includes at least one of the following methods: adding noise, adding distortion, and adding texture. The noise may include Gaussian noise, exponential noise, etc., and the distortion may include linear distortion, geometric distortion, etc. Adding noise, distortion, and texture to an image can be achieved using methods commonly used in the art, and this application does not limit the scope of the embodiments.
[0106] Specifically, after generating the image, noise, distortion, texture, etc., can be added to the generated image to make it closer to the image formed by light passing through the object in reality.
[0107] In one embodiment of this application, different parts of an object may have different materials, thicknesses, light absorption coefficients, etc., meaning different parts of an object may have different photosensitivity parameters. In this case, when obtaining the photosensitivity parameters of the object in step 102 above, it is necessary to obtain the photosensitivity parameters of different parts of the object. Thus, when generating an image representing the image formed after light passes through the object, it is necessary to perform image rendering on the corresponding different parts of the 3D model in a simulated illumination manner according to the light parameters and the photosensitivity parameters of different parts of the object, to generate an image representing the image formed after light passes through the object.
[0108] This simulation method can generate images of objects under penetrating light without creating a realistic lighting environment, thus saving steps in image generation. Therefore, the image generation scheme provided in the above embodiments can improve image generation efficiency.
[0109] See Figure 3 , Figure 3 This is a flowchart illustrating another image generation method provided in an embodiment of this application. When the number of objects is greater than 1, step 103 above may include the following steps 1031 and 1032.
[0110] Step 1031: Based on the scene requirements, combine the obtained 3D models of the objects to obtain a combined model.
[0111] Specifically, in real-world scenarios, to build a complete scene, it's often necessary to combine multiple objects to obtain a composite object. For example, in a security check scenario, objects passing through the security scanner might include everyday items such as backpacks, water bottles, scissors, and lighters, with the latter typically placed inside the backpack. To simulate a realistic scenario, it's necessary to obtain 3D models of multiple objects and combine these models to obtain a composite model.
[0112] See Figure 4 , Figure 4 This is a schematic diagram of multiple three-dimensional models provided in an embodiment of this application. Taking the above security check scenario as an example, the objects passing through the security check machine include daily necessities such as backpacks, water bottles, scissors, and lighters. Therefore, it is necessary to obtain the following information for each item: Figure 4 The diagram shows 3D models of a backpack, water bottle, scissors, and lighter. Based on the scene requirements, the 3D models of the water bottle, scissors, and lighter are placed inside the 3D model of the backpack, resulting in the following: Figure 5 The combined model shown.
[0113] In one embodiment of this application, when combining multiple 3D models, the rigid body collision principle can be used to combine the individual 3D models. The rigid body collision principle means that the 3D models do not intersect each other. For example, the 3D model of a water bottle can be located inside the 3D model of a backpack, but the 3D model of the water bottle and the 3D model of the backpack will not intersect.
[0114] In another embodiment of this application, when combining multiple 3D models, the positions of each 3D model can be manually set according to scene requirements, and then the 3D models can be combined according to the set positions. Alternatively, an image of the actual scene can be obtained, and the positional relationships of various objects in the actual scene can be analyzed based on the image. The 3D models can then be combined according to the analysis results to obtain a combined model.
[0115] Step 1032: Based on the light parameters and the photosensitive parameters of each object, the combined model is rendered in a simulated illumination manner to generate an image representing the image formed after the light passes through the combined objects.
[0116] The composite object is obtained by combining various objects according to the needs of the scenario.
[0117] Specifically, after obtaining the composite model, based on the ray parameters and the photosensitivity parameters of each object, the parameters after the aforementioned penetrating light penetrates the composite object can be calculated. This allows for the simulation of the parameters after real light penetrates the composite object. The calculation results are then used to render the composite model, generating an image that simulates the effect of real light penetrating the composite object. See also... Figure 6 , Figure 6 This is a schematic diagram of a generated image provided in an embodiment of this application. A composite model is used as an example. Figure 5 The model shown is an X-ray, and the solution provided in the embodiments of this application can be obtained as follows: Figure 6 The images shown are formed after X-rays penetrate various objects, namely, X-ray images of a schoolbag, scissors, a lighter, and a kettle.
[0118] This simulation method can generate an image of the composite object under penetrating light, eliminating the need to create a realistic lighting environment or combine real objects to obtain a realistic composite object, thus saving image generation steps. Therefore, the image generation scheme provided in the above embodiments can improve image generation efficiency.
[0119] In one embodiment of this application, the light parameters may include a first intensity of the light. In step 1032 above, when generating an image representing the light rays passing through the combined objects, a second intensity of the light rays after passing through the combined objects can be calculated based on the first intensity and the photosensitive parameters of each object. Based on the calculated second intensity, the combined model is then rendered to generate an image representing the light rays passing through the combined objects.
[0120] Specifically, in real-world scenarios, when light of the first intensity penetrates a composite object, the light is attenuated due to absorption by the object, resulting in a reduced intensity of the light after penetration. Therefore, when simulating light penetration of a composite object, a second intensity of the light after penetration can be calculated based on the first intensity of the light and the photosensitive parameters of each object. Then, the composite model can be rendered based on the second intensity of the light to simulate the image formed after the light penetrates the composite object.
[0121] In one embodiment of this application, the photosensitivity parameters of the object may include the transmittance of the object. In this case, the second intensity R2 of the light after passing through the object can be calculated by the following formula:
[0122] A = lg(1 / T)
[0123] R2 = R1 * A
[0124] Where T represents the transmittance of the object through which light passes. The specific value of T can be set manually or obtained in advance based on experimental measurements. A represents the absorbance of the object through which light passes, and R1 represents the first intensity of the light.
[0125] In addition, when the object is a liquid, the absorbance A of the object can be calculated using the following formula:
[0126] A = Kbc
[0127] Where K represents the light absorption coefficient of the object, b represents the thickness of the object, and c represents the concentration of the object. Thus, in step 102 above, when obtaining the photosensitivity parameters of the object, parameters such as the light absorption coefficient, thickness, and concentration of the object can be obtained, and then the absorbance of the object can be calculated according to the above formula.
[0128] In another embodiment of this application, the photosensitivity parameter of the object can also be the absorbance of the object, so that when obtaining the photosensitivity parameter of the object in step 102 above, the absorbance of the object can be obtained directly.
[0129] See Figure 7 , Figure 7 The following is a flowchart illustrating a second strength calculation method provided in an embodiment of this application. The method includes the following steps 701 to 703.
[0130] Step 701: Determine the first overlapping region in the combined model where there is model overlap along the direction of light illumination.
[0131] In simulating light illuminating an object, the direction of the light illuminating the object can be either direct vertical illumination or illumination along a preset angle.
[0132] Along the direction of light illumination, there may be overlapping areas within the composite model. Figure 5 Taking the combined model in the illustrated embodiment as an example, assuming that light shines perpendicularly onto the combined object, the areas where the water bottle, lighter, and scissors are located inside the backpack overlap with the area of the backpack. Therefore, it can be determined that... Figure 8 The first overlapping area is indicated by the dashed line.
[0133] Step 702: Calculate the second intensity if light passes through the object in the second overlapping region, based on the first intensity and the photosensitive parameters of the object in the second overlapping region.
[0134] The second overlapping region is the region within the combined object that corresponds to the first overlapping region of the combined model. Since the combined model is a simulated 3D model where each object is combined according to scene requirements—that is, the combined simulation is a simulated 3D model of the combined objects—there is a one-to-one correspondence between the regions of the combined objects and the combined model.
[0135] Regarding the second overlapping region, in a real scene, when light penetrates the second overlapping region of the combined objects, it needs to penetrate multiple objects. Therefore, when simulating light penetrating objects in the second overlapping region, it is necessary to calculate the second intensity of the light after penetrating each of the objects based on the first intensity of the light and the photosensitive parameters of the objects in the second overlapping region.
[0136] Step 703: Calculate the second intensity if the light penetrates the object in the non-overlapping region, based on the first intensity and the photosensitive parameters of the object in the non-overlapping region.
[0137] The non-overlapping region refers to the area within the combined object excluding the second overlapping region. In other words, the non-overlapping region corresponds to the area within the combined object where there is no overlap between models along the direction of light irradiation. This can be understood as follows: if the combined object were actually illuminated by light, there would be no overlapping areas between objects within the combined object along the direction of light irradiation.
[0138] In this way, when calculating the second intensity of light after it passes through an object in a non-overlapping region, the calculation can be based on the first intensity of the light and the photosensitive parameters of the object in the non-overlapping region.
[0139] The second strength mentioned above can be calculated using the formula for calculating the second strength R2 shown in step 1032 above, which will not be elaborated here.
[0140] It should be noted that the embodiments of this application do not limit the execution order of the above steps 702 and 703. Step 702 can be executed first and then step 703, or step 703 can be executed first and then step 702, or they can be executed simultaneously.
[0141] In one embodiment of this application, when calculating the second intensity of light after it penetrates an object in the second overlapping region in step 702, there may be two implementation methods, which will be described below.
[0142] In one implementation, the combined photosensitive parameters of all objects in the second overlapping region can be calculated based on the photosensitive parameters of each object in the second overlapping region. Then, based on the combined photosensitive parameters and the first intensity, the second intensity after light passes through the objects in the second overlapping region can be calculated.
[0143] Specifically, since the simulated light illuminating the second overlapping region needs to penetrate multiple objects, it is necessary to merge the photosensitivity parameters of the multiple objects to calculate the merged photosensitivity parameters of the multiple objects. Then, based on the merged photosensitivity parameters and the first intensity of the light, the second intensity after the light penetrates the object in the second overlapping region is calculated.
[0144] Taking the absorbance as the photosensitivity parameter of an object as an example, when calculating the combined photosensitivity parameter, the absorbance of objects in the second overlapping region can be multiplied, and the product can be used as the combined photosensitivity parameter of the above multiple objects.
[0145] Taking the formula for calculating the second intensity R2 shown in step 1032 above as an example, we can first calculate the absorbance of each object in the second overlapping region, then multiply the absorbance of each object to obtain the combined photosensitivity parameter, and finally multiply the first intensity of the light with the combined photosensitivity parameter to obtain the second intensity after the light passes through the object in the second overlapping region.
[0146] In another implementation, the intensity of light rays after passing through each object in the second overlapping region can be calculated based on the first intensity and the photosensitive parameters of the objects in the second overlapping region, thus obtaining the second intensity of light rays after passing through all objects in the second overlapping region.
[0147] Specifically, the intensity of light rays can be calculated by sequentially penetrating each object in the second overlapping region until all objects in the second overlapping region are traversed, thus obtaining the second intensity of light rays penetrating all objects in the second overlapping region.
[0148] Similarly, taking the formula for calculating the second intensity R2 shown in step 1032 above as an example, we can first calculate the absorbance of each object in the second overlapping region, then calculate the product of the first intensity of the light and the absorbance of one of the objects to obtain the intensity after the light passes through the object, and then calculate the product of the intensity and the absorbance of the next object, until all objects are traversed, and finally obtain the second intensity after the light passes through all objects in the second overlapping region.
[0149] See Figure 9 , Figure 9 This is a flowchart illustrating another image generation method provided in an embodiment of this application, which includes the following steps 901 to 906.
[0150] Step 901: Determine whether a 3D model of the object exists in the 3D model library. If it exists, proceed to step 902; otherwise, proceed to step 903.
[0151] Step 902: Obtain the 3D model directly from the 3D model library;
[0152] Step 903: Construct a 3D model of the object and upload it to the 3D model library;
[0153] Step 904: Based on the scene requirements, combine the obtained 3D models of the objects to obtain a combined model;
[0154] Step 905: Based on the light parameters and the photosensitive parameters of each object, the combined model is rendered in a simulated illumination manner to generate an image representing the image formed after the light passes through the combined objects;
[0155] Step 906: Post-process the generated image.
[0156] When generating images using the scheme provided in the above embodiments, an image of an object under penetrating light can be generated through simulation, eliminating the need to create a real lighting environment and saving image generation steps. Therefore, the image generation scheme provided in the above embodiments can improve image generation efficiency.
[0157] See Figure 10 , Figure 10 This is a schematic diagram of an image generation apparatus provided in an embodiment of this application. The apparatus includes:
[0158] Model acquisition module 1001 is used to obtain a three-dimensional model of the object;
[0159] The parameter acquisition module 1002 is used to acquire photosensitive parameters reflecting the photosensitive ability of the object, and to acquire light parameters of penetrating light.
[0160] The image generation module 1003 is used to perform image rendering on the three-dimensional model based on the photosensitive parameters and light parameters in a simulated illumination manner, and generate an image representing the image formed after the light passes through the object.
[0161] In one embodiment of this application, when the number of objects is greater than 1, the image generation module 1003 specifically includes:
[0162] The combined model acquisition submodule is used to combine the 3D models of the obtained objects based on scene requirements to obtain a combined model;
[0163] The image generation submodule is used to perform image rendering on the combined model in a simulated illumination manner based on the light parameters and the photosensitive parameters of each object, generating an image representing the image formed after the light passes through the combined objects, wherein the combined objects are obtained by combining each object according to the scene requirements.
[0164] In one embodiment of this application, the ray parameters of the light include a first intensity of the light;
[0165] The image generation submodule specifically includes:
[0166] An intensity calculation unit is used to calculate a second intensity based on the first intensity and the photosensitive parameters of each object, if the light penetrates the combined object;
[0167] An image generation unit is used to render an image of the combined model based on a calculated second intensity, generating an image representing the light rays passing through the combined object.
[0168] In one embodiment of this application, the strength calculation unit specifically includes:
[0169] The region determination subunit is used to determine the first overlapping region in the combined model where there is model overlap along the direction of the light irradiation;
[0170] The first calculation subunit is used to calculate the second intensity after the light penetrates the object in the second overlapping region, based on the first intensity and the photosensitive parameters of the object in the second overlapping region, wherein the second overlapping region is: the region in the combined object that corresponds to the first overlapping region of the combined model;
[0171] The second calculation subunit is used to calculate the second intensity if the light penetrates the object in the non-overlapping region based on the first intensity and the photosensitive parameters of the object in the non-overlapping region, wherein the non-overlapping region is the region in the combined object other than the second overlapping region.
[0172] In one embodiment of this application, the first computing subunit is specifically used for:
[0173] Based on the photosensitive parameters of each object in the second overlapping region, calculate the combined photosensitive parameters of all objects in the second overlapping region;
[0174] Based on the combined photosensitivity parameters and the first intensity, a second intensity is calculated if the light penetrates an object located in the second overlapping region.
[0175] In one embodiment of this application, the first computing subunit is specifically used for:
[0176] Based on the first intensity and the photosensitive parameters of the objects in the second overlapping region, the intensity of the light rays after they sequentially penetrate each of the objects in the second overlapping region is calculated, thus obtaining the second intensity of the light rays after they penetrate all the objects in the second overlapping region.
[0177] In one embodiment of this application, the photosensitive parameters of the object include the transmittance of the object, and the second intensity R2 is calculated by the following formula:
[0178] A = lg(1 / T)
[0179] R2 = R1 * A
[0180] Wherein, T represents the transmittance of the object through which the light passes, A represents the absorbance of the object through which the light passes, and R1 represents the first intensity of the light.
[0181] In one embodiment of this application, the model acquisition module 1001 is specifically used for:
[0182] Determine if a 3D model of an object exists in the 3D model library;
[0183] If it exists, the 3D model is obtained directly from the 3D model library;
[0184] If the object does not exist, a 3D model of the object is constructed and uploaded to the 3D model library.
[0185] In one embodiment of this application, the apparatus further includes an image post-processing module, used for:
[0186] After generating an image representing the light rays passing through the object, the generated image is post-processed, wherein the post-processing includes at least one of the following methods: adding noise, adding distortion, and adding texture.
[0187] When generating an image using the scheme provided in the above embodiments, a three-dimensional model of the object is first obtained; photosensitive parameters reflecting the object's photosensitivity are obtained, as well as light parameters representing penetrating light rays are obtained; based on the photosensitive parameters and light parameters, the three-dimensional model is rendered using simulated illumination to generate an image representing the image formed after light penetrates the object. In this way, an image of an object formed under penetrating light can be generated through simulation, eliminating the need to create a realistic lighting environment and saving image generation steps. Therefore, it is evident that applying the image generation scheme provided in the above embodiments can improve image generation efficiency.
[0188] This application also provides an electronic device, such as... Figure 11As shown, it includes a processor 1101, a communication interface 1102, a memory 1103, and a communication bus 1104. The processor 1101, communication interface 1102, and memory 1103 communicate with each other via the communication bus 1104.
[0189] Memory 1103 is used to store computer programs;
[0190] The processor 1101 is used to implement the steps of the image generation method when executing the program stored in the memory 1103.
[0191] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0192] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0193] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0194] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0195] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the above-described image generation methods.
[0196] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the image generation methods described above.
[0197] When generating an image using the scheme provided in the above embodiments, a three-dimensional model of the object is first obtained; photosensitive parameters reflecting the object's photosensitivity are obtained, as well as light parameters representing penetrating light rays are obtained; based on the photosensitive parameters and light parameters, the three-dimensional model is rendered using simulated illumination to generate an image representing the image formed after light penetrates the object. In this way, an image of an object formed under penetrating light can be generated through simulation, eliminating the need to create a realistic lighting environment and saving image generation steps. Therefore, it is evident that applying the image generation scheme provided in the above embodiments can improve image generation efficiency.
[0198] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially 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, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0199] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0200] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments, electronic device embodiments, computer-readable storage medium embodiments, and computer program product embodiments are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0201] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. An image generation method characterized by, The method comprises: obtaining a three-dimensional model of an object; obtaining a photosensitive parameter reflecting the photosensitivity of the object and obtaining a light ray parameter of a light ray with penetration; the light ray parameter of the light ray comprises a first intensity of the light ray; in the case where the number of the objects is greater than 1, combining the obtained three-dimensional models of the objects based on a scene requirement to obtain a combined model; determining a first overlapping area in which models exist along the irradiation direction of the light ray in the combined model; calculating a second intensity of the light ray after penetrating the objects in a second overlapping area according to the first intensity and the photosensitive parameter of the objects in the second overlapping area, wherein the second overlapping area is a region in a combined object corresponding to the first overlapping area of the combined model, and the combined object is obtained by combining each object according to the scene requirement; calculating a second intensity of the light ray after penetrating the objects in a non-overlapping area according to the first intensity and the photosensitive parameter of the objects in the non-overlapping area, wherein the non-overlapping area is a region in the combined object except the second overlapping area; performing image rendering on the combined model according to the calculated second intensity to generate an image representing the image formed after the light ray penetrates the combined object.
2. The method of claim 1, wherein, The method comprises: calculating a combined photosensitive parameter of all the objects in the second overlapping area according to the photosensitive parameter of each object in the second overlapping area; calculating a second intensity of the light ray after penetrating the objects in the second overlapping area based on the combined photosensitive parameter and the first intensity.
3. The method of claim 1, wherein, The method comprises: calculating an intensity of the light ray after penetrating each object in the second overlapping area according to the first intensity and the photosensitive parameter of the objects in the second overlapping area to obtain a second intensity of the light ray after penetrating all the objects in the second overlapping area.
4. The method according to any one of claims 1-3, characterized in that, The photosensitive parameter of the object comprises a transmittance of the object, and the second intensity R2 is calculated by the following formula: A = lg (1 / T) ; wherein T represents the transmittance of the object penetrated by the light ray, A represents the absorbance of the object penetrated by the light ray, and R1 represents the first intensity of the light ray.
5. The method according to any one of claims 1-3, characterized in that, The method comprises: determining whether a three-dimensional model of the object exists in a three-dimensional model library; if yes, directly obtaining the three-dimensional model from the three-dimensional model library; if no, constructing a three-dimensional model of the object and uploading it to the three-dimensional model library.
6. The method according to any one of claims 1-3, characterized in that, After generating the image representing the image formed after the light ray penetrates the object, the method further comprises: performing post-processing on the generated image, wherein the post-processing comprises at least one of the following processing modes: adding noise, adding distortion, and adding texture.
7. An image generation apparatus characterized by comprising: The device comprises: A model obtaining module is configured to obtain a three-dimensional model of an object; A parameter obtaining module is configured to obtain a photosensitive parameter reflecting photosensitivity of the object and obtain a light parameter of a light ray having penetrability; An image generating module is configured to perform image rendering on the three-dimensional model in a simulated illumination manner based on the photosensitive parameter and the light parameter, and generate an image representing an image formed after the light ray penetrates the object; In a case where the number of objects is greater than one, the image generating module specifically includes: A combined model obtaining submodule is configured to combine the obtained three-dimensional models of the objects based on a scene requirement, and obtain a combined model; An image generating submodule is configured to perform image rendering on the combined model in a simulated illumination manner based on the light parameter and the photosensitive parameter of each object, and generate an image representing an image formed after the light ray penetrates the combined object, wherein the combined object is obtained by combining each object according to the scene requirement; The light parameter of the light ray includes a first intensity of the light ray; the image generating submodule specifically includes: An intensity calculating unit is configured to calculate a second intensity after the light ray penetrates the combined object based on the first intensity and the photosensitive parameter of each object; An image generating unit is configured to perform image rendering on the combined model based on the calculated second intensity, and generate an image representing an image formed after the light ray penetrates the combined object; The intensity calculating unit specifically includes: A region determining subunit is configured to determine a first overlapping region in the combined model along an illumination direction of the light ray; A first calculating subunit is configured to calculate a second intensity after the light ray penetrates an object in a second overlapping region based on the first intensity and the photosensitive parameter of the object in the second overlapping region, wherein the second overlapping region is a region in the combined object corresponding to the first overlapping region of the combined model; A second calculating subunit is configured to calculate a second intensity after the light ray penetrates an object in a non-overlapping region based on the first intensity and the photosensitive parameter of the object in the non-overlapping region, wherein the non-overlapping region is a region in the combined object except the second overlapping region.
Citation Information
Patent Citations
Method and apparatus for rendering three-dimensional model
CN110084873A