Image processing method, device, electronic device and storage medium
By constructing an ambient light restoration model and multispectral light source technology, objects in the virtual scene are relit, which solves the problem of poor image authenticity in the virtual scene and achieves a more realistic lighting restoration effect.
Patent Information
- Application Number
- CN202211704923.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2042-12-29
AI Technical Summary
When adding human body or object images to virtual scenes, it is difficult to visually restore the lighting conditions realistically with the existing technology, resulting in poor image authenticity, mainly due to differences in ambient lighting and spectral reflectivity.
By building an ambient light restoration model, using multi-spectral light sources and color lamp beads to calibrate the color card image, determine the relighting coefficient of each virtual scene, and relight the target object based on these coefficients to make the virtual scene Object images are restored more realistically.
It improves the authenticity of the image, makes the reflection effect of objects in the virtual environment more realistic, and overcomes the chromatic aberration problem caused by changes in lighting direction and angle.
Smart Images

Figure CN116017167B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of multi-spectral light sources, and in particular to an image processing method, device, electronic equipment and storage medium. Background Art
[0002] With the prosperous development of film and television media and cultural entertainment industries, the demand for ambient light restoration technology in related industries has continued to increase. This technology can efficiently restore the lighting conditions in a specified scene, playing a vital role in the development and upgrading of related industries.
[0003] Generally speaking, when adding real-life human or object images directly to a virtual scene, the real effects of the human or object cannot be realistically restored visually due to differences in ambient lighting. The surfaces of various objects will show different reflection effects under different lighting environments; different surfaces of the same object will show different reflection effects due to factors such as angle, roughness, and transparency; even for the same surface of the same object, the reflectivity of different spectra will be different, making the simulated object surface and the real object surface show different reflection effects.
[0004] Current technologies focus on restoring the direction of light, striving to correct the light and shadow information brought by different angles. Simply using the three-channel data of the image to restore the ambient light will result in large image color difference due to factors such as the camera response curve, the light response curve and the weak expression ability of the universal color standard sRGB color gamut, that is, the image authenticity is poor. Summary of the invention
[0005] In view of this, embodiments of the present invention provide an image processing method, an apparatus, an electronic device, and a storage medium to solve the problem of poor image authenticity in the prior art.
[0006] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0007] A first aspect of an embodiment of the present invention shows a method for processing an image, the method comprising:
[0008] Receive a shooting instruction input by any user;
[0009] Based on the target virtual scene selected in the shooting instruction, determining a corresponding target relighting coefficient from an ambient light restoration model, wherein the ambient light restoration model is used to store a corresponding relationship between each virtual scene and a first relighting coefficient;
[0010] Using the target relighting coefficient as the pixel brightness value;
[0011] relighting the target object in the shooting instruction based on the pixel brightness value;
[0012] The target object image obtained by relighting and photographing is added to the target virtual scene to obtain a target virtual image.
[0013] Optionally, determining a corresponding target relighting coefficient from an ambient light restoration model based on the target virtual scene selected in the shooting instruction includes:
[0014] Traversing the correspondence between each virtual scene in the ambient light restoration model and the first relighting coefficient, and determining the relighting coefficient corresponding to the target virtual scene;
[0015] The first relighting coefficient corresponding to the target virtual scene is used as the target relighting coefficient.
[0016] Optionally, the process of constructing the ambient light restoration model includes:
[0017] Using a variety of color lamp beads to calibrate the captured color card image to obtain a calibrated color card image;
[0018] For each virtual scene, the target ambient light sampling map corresponding to the virtual scene is used to virtually illuminate the calibrated color card image based on the preprocessed target ambient light sampling map to obtain corresponding color card pixels;
[0019] Determining a first relighting coefficient for each virtual scene based on the color card pixels;
[0020] An ambient light restoration model is constructed based on the corresponding relationship between each virtual scene and the first relighting coefficient.
[0021] Optionally, for each virtual scene corresponding to the target ambient light sampling map, the calibrated color card image is virtually illuminated based on the preprocessed target ambient light sampling map to obtain corresponding color card pixels, including:
[0022] For each target ambient light sampling map corresponding to the virtual scene, preprocessing the target ambient light sampling map to obtain a compressed initial pixel brightness value;
[0023] Mapping the initial pixel brightness value according to the spherical multi-spectral light source coordinates to obtain an image area;
[0024] Processing the image region to determine expected pixel values;
[0025] The color card is virtually illuminated using the light measured by the expected pixel value to obtain corresponding color card pixels.
[0026] A second aspect of an embodiment of the present invention shows an image processing device, the device comprising:
[0027] a determining unit, configured to, upon receiving a shooting instruction input by any user, determine a corresponding target relighting coefficient from an ambient light restoration model based on a target virtual scene selected in the shooting instruction, wherein the ambient light restoration model is constructed by the constructing unit;
[0028] A lighting unit, used for taking the target relighting system as a pixel brightness value; and relighting the target object in the shooting instruction based on the pixel brightness value;
[0029] The processing unit is used to add the target object image obtained by relighting and photographing to the target virtual scene to obtain the target image.
[0030] Optionally, the determining unit is specifically used to: traverse the correspondence between each virtual scene in the ambient light restoration model and the first relighting coefficient, and determine the relighting coefficient corresponding to the target virtual scene;
[0031] The first relighting coefficient corresponding to the target virtual scene is used as the target relighting coefficient.
[0032] Optionally, the construction unit is used to: calibrate the captured color card image using a variety of color lamp beads to obtain a calibrated color card image;
[0033] For each virtual scene, the target ambient light sampling map corresponding to the virtual scene is used to virtually illuminate the calibrated color card image based on the preprocessed target ambient light sampling map to obtain corresponding color card pixels;
[0034] Determining a first relighting coefficient for each virtual scene based on the color card pixels;
[0035] An ambient light restoration model is constructed based on the corresponding relationship between each virtual scene and the first relighting coefficient.
[0036] Optionally, for each virtual scene corresponding to the target ambient light sampling map, the calibrated color card image is virtually illuminated based on the preprocessed target ambient light sampling map to obtain a construction unit of corresponding color card pixels, which is specifically used for:
[0037] For each target ambient light sampling map corresponding to the virtual scene, preprocessing the target ambient light sampling map to obtain a compressed initial pixel brightness value;
[0038] Mapping the initial pixel brightness value according to the spherical multi-spectral light source coordinates to obtain an image area;
[0039] Processing the image region to determine expected pixel values;
[0040] The color card is virtually illuminated using the light measured by the expected pixel value to obtain corresponding color card pixels.
[0041] A third aspect of an embodiment of the present invention shows an electronic device, which is used to run a program, wherein the program, when running, executes the image processing method shown in the first aspect of the embodiment of the present invention.
[0042] A fourth aspect of an embodiment of the present invention shows a computer storage medium, which includes a storage program, wherein when the program is running, the device where the storage medium is located is controlled to execute the image processing method shown in the first aspect of the embodiment of the present invention.
[0043] Based on the above-mentioned embodiment of the present invention, an image processing method, device, electronic device and storage medium are provided. The method includes: when receiving a shooting instruction input by any user, based on the target virtual scene selected in the shooting instruction, determining the corresponding target relighting coefficient from the ambient light restoration model, the ambient light restoration model is used to store the corresponding relationship between each virtual scene and the first relighting coefficient; using the target relighting system as the pixel brightness value; relighting the target object in the shooting instruction based on the pixel brightness value; adding the target object image obtained by relighting to the target virtual scene to obtain the target image. In an embodiment of the present invention, the ambient light is restored in the lighting device of the multi-spectral light source according to the target ambient light sampling diagram corresponding to different virtual scenes to construct an ambient light restoration model, and the target relighting coefficient corresponding to the target virtual scene is determined by the ambient light restoration model; relighting the target object in the shooting instruction based on the target relighting coefficient makes the virtual environment relighting the real object more realistic, and adding the target object image obtained by relighting to the target virtual scene to obtain the target virtual image. The authenticity of the image obtained by the above method can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0045] Figure 1 A schematic flow chart of an image processing method according to an embodiment of the present invention;
[0046] Figure 2 A schematic diagram of a process of constructing an ambient light restoration model according to an embodiment of the present invention;
[0047] Figure 3 The figure is a schematic diagram of the structure of an image processing device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0050] It should be noted that the descriptions of "first", "second", etc. in the present invention are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0051] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising 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, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0052] See also Figure 1, is a flow chart of an image processing method shown in an embodiment of the present invention, the method comprising:
[0053] Step S101: receiving a shooting instruction input by any user.
[0054] Optionally, the user can select a corresponding target virtual scene based on the user terminal and trigger a corresponding shooting button to generate a corresponding shooting instruction and send it to the image processing system.
[0055] In the specific process of implementing step S101, a shooting instruction carrying a target virtual scene is received.
[0056] Step S102: Based on the target virtual scene selected in the shooting instruction, determine the corresponding target relighting coefficient from the ambient light restoration model.
[0057] In step S102, the ambient light restoration model is used to store the corresponding relationship between each virtual scene and the first relighting coefficient.
[0058] It should be noted that the construction process of the ambient light restoration model, such as Figure 2 As shown, the following steps are included:
[0059] Step S201: calibrate the captured color card image using multiple color lamp beads to obtain a calibrated color card image.
[0060] It should be noted that the L channel in the Lab color space (LAB) is the brightness, and A and B are the color channels. Therefore, the color mixture will produce bright colors. Since the RGB color space cannot directly correspond to the perception of the human eye. The LAB color space can accurately correspond to the perception of the human eye, and the calculation of related brightness, color difference, color correction, etc. will be more accurate; therefore, it is necessary to convert the RGB color space to the LAB color space.
[0061] In the specific implementation of step S201, first, since the brightness of lamp beads with different spectra is different at the maximum brightness, in order to avoid the influence of low light conditions, in the process of shooting the color card, the exposure time of the image camera is different for the lamp beads of each light source spectrum. For different exposure times, the RGB color space of the color card image is converted to the color-opponent space (Lab color space, LAB) color space, and then the pixel brightness L and exposure time of the converted color card image are substituted into formula (1) to determine the pixel brightness L' of the corrected color card image.
[0062] Formula (1):
[0063] L'=L / exp_time*factor (1)
[0064] Where L is the pixel brightness; factor is the average exposure time, under which the color exposure of the color card under blue, green, and red lighting is basically uniform; exp_time is the exposure time of the camera;
[0065] Secondly, since the actual brightness of the light source is uneven under the input brightness, it is necessary to shoot a set of color card images for lamp beads with different brightness inputs under the same camera exposure parameters during the shooting process, and calibrate the brightness curve of the lamp beads. Specifically, for a set of discrete brightness L1, L2, ..., L k , and based on the brightness L1,L2,...,L k Draw the first curve; take the grayscale color block on the color card image to obtain a set of brightness M1, M2, ..., M k , based on the brightness M1,M2,...,M k Draw a second curve; fit the first curve and the second curve to calculate the minimum error, that is, the regression function f. In other words, the minimum error, that is, the regression function f, can be determined according to the curve conditions of the first curve and the second curve.
[0066] Among them, brightness refers to the brightness of the color, also known as color scale and illumination. Brightness, also known as grayscale value, is a measure of the brightness of the color.
[0067] Finally, for the lamp beads with different spectra of the same light source, the corresponding data is saved. After exposure time correction, a calibrated color card image is obtained, and it is used as the re-lighting coefficient of the multi-spectral light source. The process is to convert the color space to the color space of linear brightness information such as LAB, divide the brightness value by the corresponding exposure time, and then multiply it by the same exposure time to obtain the re-lighting coefficient of the multi-spectral light source, that is, to obtain the calibrated color card image.
[0068] For example, the exposure time Q at which white light is fully exposed is selected as the uniform exposure time; at this exposure time Q, the color exposure of the color cards under blue, green, and red lighting is basically uniform.
[0069] Optionally, the exposure time can be used as a relighting factor for the multi-spectral light source.
[0070] It should be noted that the high-definition color card images taken by a professional camera when the lamp beads of each light source spectrum light up the dark room separately require the control of the camera's sensitivity and exposure time during the acquisition process.
[0071] For the same light source, the response curve of each light source can be obtained based on the brightness of the grayscale color block on the color card and the corresponding light source intensity.
[0072] Step S202: for each target ambient light sampling diagram corresponding to the virtual scene, the calibrated color card image is virtually illuminated based on the preprocessed target ambient light sampling diagram to obtain corresponding color card pixels.
[0073] It should be noted that the specific implementation of step S202 is to virtually illuminate the calibrated color card image based on the preprocessed target ambient light sampling map corresponding to each virtual scene to obtain the corresponding color card pixel, including the following steps:
[0074] Step S11: for each target ambient light sampling map corresponding to the virtual scene, preprocess the target ambient light sampling map to obtain a compressed initial pixel brightness value.
[0075] In the specific implementation of step S11, a hybrid logging curve, namely a hybrid log gamma logging method, can be used. Specifically, the brightness value E of each pixel in the image is compressed, as shown in formula (2), to obtain the compressed initial pixel brightness value E'.
[0076] Formula (2):
[0077]
[0078] Wherein, E is a linear image brightness signal normalized to the interval 0, 1, i.e., the brightness value of a pixel. E' is a nonlinear brightness output signal, i.e., the compressed brightness value. Constants a, b, c are fixed to 0.17883277, 0.28466892, 0.55991073, respectively. Constant d is determined by the brightness range of the multi-spectral lighting system. For one embodiment of the present patent, this constant is often determined as
[0079] It should be noted that the target ambient light sampling image refers to a panoramic image with a high dynamic range, which has sampling information of the surrounding environment of a certain position. Generally, the aspect ratio of the image is 1:2.
[0080] In the implementation of the present invention, the image is enhanced by compression. That is, if the target ambient light image does not have sufficient high dynamic range expression capability, this patent can enhance the image by using the hybrid log gamma logging method, etc., to restore the dynamic range of the original image.
[0081] Step S12: mapping the initial pixel brightness value according to the spherical multi-spectral light source coordinates to obtain an image area.
[0082] In the specific implementation of step S12, the pixel corresponding to the initial pixel brightness value is projected by using the equirectangular cylindrical projection method to map the pixel position coordinates by constructing spherical longitude and latitude coordinates, as shown in formula (3), and the corresponding coordinates are obtained, and then the target ambient light sampling map is determined to be mapped to the image area of the lighting device based on the mapped coordinates.
[0083] Specifically, the coordinates of any longitude and latitude coordinates λ, φ on the sphere on the coordinate axes of the orthogonal conformal cylindrical projection are shown in formula (3).
[0084] Formula (3):
[0085]
[0086] Among them, x, y are the two-dimensional plane coordinates of the compressed brightness value in the target ambient light sampling map, λ, λ0 are the dimensional coordinates and the equatorial latitude, respectively. φ is the longitude coordinate.
[0087] Step S13: Process the image area to determine expected pixel values.
[0088] In the process of implementing step S13, since the number of light sources in the multi-spectral light source system itself is sparse and unevenly distributed, that is, the area mapping of the equirectangular cylindrical projection itself is also uneven, the area factors of all sampling points can be considered when performing coordinate mapping. That is to say, the sampling area corresponding to the pixel point in the image area corresponding to the target ambient light sampling map can be determined by the von Lonoy diagram algorithm on the sphere or the cone mapping method, and the projection area and the pixel color are substituted into formula (4) for calculation to obtain the expected pixel value of the target ambient light sampling map. That is to say, a Delaunay triangulation of the control points is generated according to the principle of the shortest coordinate distance of the pixel points in the target ambient light sampling map, and the distance from any inner point to its control point is less than the distance from the point to other control points. The expected pixel value of each light source is set as the average of all pixel values of the triangulation.
[0089] To ensure that it meets the constraints of Delaunay triangulation. Draw a perpendicular bisector for each edge of the white triangulated network. The intersection of the perpendicular bisectors is the vertex of the Thiessen polygon. The vertices on the perpendicular bisectors are connected to form a Thiessen polygon. Dividing the inner points of the Thiessen polygon generates a von Lonoy diagram.
[0090] Among them, the internal points refer to the pixel points on the target ambient light sampling map, and the control points refer to the points after the three-dimensional coordinates of each light source on the light source system are projected to the two-dimensional image coordinates.
[0091] Formula (4):
[0092]
[0093] Where C is the expected pixel value of the target ambient light sampling map, assuming that S is the sampling area corresponding to the current sampling point, and the pixel point S=s1,...,s k They have projected areas m1,...,m k , the corresponding pixel colors are c1,...,c k That is, m k is the projection area of pixel k, c k is the pixel color corresponding to pixel k.
[0094] Step S14: Virtually illuminate the color card using the light measured by the expected pixel value to obtain corresponding color card pixels.
[0095] In the specific implementation of step S14, the color card is virtually illuminated by the light measured by the expected pixel values of different target ambient light sampling images to obtain corresponding color card pixels.
[0096] It should be noted that virtual lighting refers to the color card color C in any color card image, through the lightness value L in the color lookup table C =fI,O,L C As the mapping relationship between the color of the color card and the color output O obtained by reflecting the specific light source input I.
[0097] Step S203: Determine a first relighting coefficient of each virtual scene based on the color card pixels.
[0098] It should be noted that the specific implementation of step S203 of determining the first relighting coefficient of each virtual scene based on the color card pixels includes the following steps:
[0099] Step S21: For each virtual scene, the color card pixels and the given light source color pixels are used to perform calculations to obtain a first relighting coefficient.
[0100] In the specific implementation of step S21, a non-negative least square method is performed between the given light source color pixel and the expected color card pixel, that is, by P ij and L ijk P ij and L ijk Substitute into formula (5) to calculate and obtain the first relighting coefficient α k .
[0101] Formula (5):
[0102]
[0103] Among them, P ij As the expected value of color card color i in color channel j; L ijkAs the value of light color k irradiating color card color i in color channel j; P refers to P ij The vectorization expression of vectorize; Lα refers to L ijk Vectorize expression of vectorization.
[0104] It should be noted that, considering the first relighting coefficient α k It cannot be negative, so the non-negative least squares method is used to obtain the optimal coefficient.
[0105] Step S204: constructing an ambient light restoration model based on the corresponding relationship between each virtual scene and the first relighting coefficient.
[0106] In the specific implementation of step S204, a correspondence between a virtual scene corresponding to the target ambient light sampling diagram and a first relighting coefficient corresponding to the target ambient light sampling diagram is constructed, thereby constructing an ambient light restoration model.
[0107] It should be noted that the specific implementation of step S102 includes the following steps:
[0108] Step S31: traverse the correspondence between each virtual scene in the ambient light restoration model and the first relighting coefficient to determine the relighting coefficient corresponding to the target virtual scene.
[0109] In the specific implementation of step S31, the correspondence between each virtual scene in the ambient light restoration model and the first relighting coefficient is traversed to find the first relighting coefficient corresponding to the target virtual scene.
[0110] Step S32: using the first relighting coefficient corresponding to the target virtual scene as the target relighting coefficient.
[0111] In the specific implementation of step S32, the first relighting coefficient obtained by searching is used as the target relighting coefficient.
[0112] Step S103: taking the target relighting coefficient as the pixel brightness value.
[0113] Step S104: re-lighting the target object in the shooting instruction based on the pixel brightness value.
[0114] In the specific implementation process of step S104, the light source response curve is corrected using the pixel brightness value to obtain the intensity information of all light sources; the intensity information of all light sources is used as the light source input brightness to restore the lighting; the restored lighting can be used to re-light the target object in the shooting instruction.
[0115] Step S105: adding the target object image obtained by re-lighting and photographing to the target virtual scene to obtain a target virtual image.
[0116] In the specific implementation of step S105, the target object image is captured by a shooting device and placed in the target virtual scene, so that the target virtual image visually restores the real effect of the target object image.
[0117] It should be noted that the target object image may be a human body or an object image.
[0118] In an embodiment of the present invention, the ambient light is restored in the lighting device of the multi-spectral light source according to the target ambient light sampling diagram corresponding to different virtual scenes to construct an ambient light restoration model, and the target relighting coefficient corresponding to the target virtual scene is determined by the ambient light restoration model; the target object in the shooting instruction is relighted based on the target relighting coefficient, so that the virtual environment relights the real object more realistically, and the target object image obtained by the relighting shooting is added to the target virtual scene to obtain a target virtual image. The authenticity of the image obtained by the above method can be improved.
[0119] Based on the image processing method shown in the above embodiment of the present invention, correspondingly, the embodiment of the present invention also discloses another image processing device, such as Figure 3 As shown, the device comprises:
[0120] The determining unit 301 is used to determine the corresponding target relighting coefficient from the ambient light restoration model based on the target virtual scene selected in the shooting instruction when receiving a shooting instruction input by any user, and the ambient light restoration model is constructed by the constructing unit 304;
[0121] A lighting unit 302 is used for using the target relighting system as a pixel brightness value; and relighting the target object in the shooting instruction based on the pixel brightness value;
[0122] The processing unit 303 is used to add the target object image obtained by re-lighting and photographing to the target virtual scene to obtain the target image.
[0123] It should be noted that the specific principles and execution processes of each unit in the image processing device disclosed in the above embodiment of the present invention are the same as the image processing method shown in the above embodiment of the present invention. Please refer to the corresponding parts of the image processing method disclosed in the above embodiment of the present invention, and will not be repeated here.
[0124] In an embodiment of the present invention, the ambient light is restored in the lighting device of the multi-spectral light source according to the target ambient light sampling diagram corresponding to different virtual scenes to construct an ambient light restoration model, and the target relighting coefficient corresponding to the target virtual scene is determined by the ambient light restoration model; the target object in the shooting instruction is relighted based on the target relighting coefficient, so that the virtual environment relights the real object more realistically, and the target object image obtained by the relighting shooting is added to the target virtual scene to obtain a target virtual image. The authenticity of the image obtained by the above method can be improved.
[0125] Optionally, based on the image processing device shown in the above embodiment of the present invention, the determination unit 301 is specifically used to: traverse the correspondence between each virtual scene in the ambient light restoration model and the first relighting coefficient, and determine the relighting coefficient corresponding to the target virtual scene;
[0126] The first relighting coefficient corresponding to the target virtual scene is used as the target relighting coefficient.
[0127] Optionally, based on the image processing device shown in the above embodiment of the present invention, the construction unit 304 is used to: calibrate the captured color card image using multiple color lamp beads to obtain a calibrated color card image;
[0128] For each virtual scene, the target ambient light sampling map corresponding to the virtual scene is used to virtually illuminate the calibrated color card image based on the preprocessed target ambient light sampling map to obtain corresponding color card pixels;
[0129] Determining a first relighting coefficient for each virtual scene based on the color card pixels;
[0130] An ambient light restoration model is constructed based on the corresponding relationship between each virtual scene and the first relighting coefficient.
[0131] Optionally, based on the image processing device shown in the above embodiment of the present invention, for each target ambient light sampling map corresponding to a virtual scene, the calibrated color card image is virtually illuminated based on the preprocessed target ambient light sampling map to obtain a corresponding color card pixel construction unit 304, which is specifically used to: for each target ambient light sampling map corresponding to a virtual scene, preprocess the target ambient light sampling map to obtain a compressed initial pixel brightness value;
[0132] Mapping the initial pixel brightness value according to the spherical multi-spectral light source coordinates to obtain an image area;
[0133] Processing the image region to determine expected pixel values;
[0134] The color card is virtually illuminated using the light measured by the expected pixel value to obtain corresponding color card pixels.
[0135] The embodiment of the present invention also discloses an electronic device, which is used to run a database storage process, wherein the above-mentioned Figure 1 and Figure 2 The processing method of the public image.
[0136] The embodiment of the present invention also discloses a computer storage medium, wherein the storage medium includes a storage database storage process, wherein when the database storage process is running, the device where the storage medium is located is controlled to execute the above Figure 1 and Figure 2 The processing method of the public image.
[0137] In the context of the present disclosure, a computer storage medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0138] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.
[0139] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0140] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for processing an image, It is characterized in that The method comprises: Receive a shooting instruction input by any user; Based on the target virtual scene selected in the shooting instruction, determining a corresponding target relighting coefficient from an ambient light restoration model, wherein the ambient light restoration model is used to store a corresponding relationship between each virtual scene and a first relighting coefficient; Using the target relighting coefficient as the pixel brightness value; relighting the target object in the shooting instruction based on the pixel brightness value; Adding the target object image obtained by relighting and photographing to the target virtual scene to obtain a target virtual image; The construction process of the ambient light restoration model includes: Using a variety of color lamp beads to calibrate the captured color card image to obtain a calibrated color card image; For each virtual scene, the target ambient light sampling map corresponding to the virtual scene is used to virtually illuminate the calibrated color card image based on the preprocessed target ambient light sampling map to obtain corresponding color card pixels; Determining a first relighting coefficient for each virtual scene based on the color card pixels; An ambient light restoration model is constructed based on the corresponding relationship between each virtual scene and the first relighting coefficient.
2. The method according to claim 1, It is characterized in that The step of determining a corresponding target relighting coefficient from an ambient light restoration model based on the target virtual scene selected in the shooting instruction includes: Traversing the correspondence between each virtual scene in the ambient light restoration model and the first relighting coefficient, and determining the relighting coefficient corresponding to the target virtual scene; The first relighting coefficient corresponding to the target virtual scene is used as the target relighting coefficient.
3. The method according to claim 1, It is characterized in that The target ambient light sampling diagram corresponding to each virtual scene is used to virtually illuminate the calibrated color card image based on the preprocessed target ambient light sampling diagram to obtain corresponding color card pixels, including: For each target ambient light sampling map corresponding to the virtual scene, preprocessing the target ambient light sampling map to obtain a compressed initial pixel brightness value; Mapping the initial pixel brightness value according to the spherical multi-spectral light source coordinates to obtain an image area; Processing the image region to determine expected pixel values; The color card is virtually illuminated using the light measured by the expected pixel value to obtain corresponding color card pixels.
4. An image processing device, It is characterized in that The device comprises: a determining unit, configured to, upon receiving a shooting instruction input by any user, determine a corresponding target relighting coefficient from an ambient light restoration model based on a target virtual scene selected in the shooting instruction, wherein the ambient light restoration model is constructed by the constructing unit and is used to store a corresponding relationship between each virtual scene and a first relighting coefficient; A lighting unit, configured to use the target relighting system as a pixel brightness value; and relight the target object in the shooting instruction based on the pixel brightness value; A processing unit, used for adding the target object image obtained by relighting and photographing to the target virtual scene to obtain a target image; The construction unit is used to calibrate the captured color card image using multiple color lamp beads to obtain a calibrated color card image; For each virtual scene, the target ambient light sampling map corresponding to the virtual scene is used to virtually illuminate the calibrated color card image based on the preprocessed target ambient light sampling map to obtain corresponding color card pixels; Determining a first relighting coefficient for each virtual scene based on the color card pixels; An ambient light restoration model is constructed based on the corresponding relationship between each virtual scene and the first relighting coefficient.
5. The device according to claim 4, It is characterized in that The determining unit is specifically used to: traverse the correspondence between each virtual scene in the ambient light restoration model and the first relighting coefficient, and determine the relighting coefficient corresponding to the target virtual scene; The first relighting coefficient corresponding to the target virtual scene is used as the target relighting coefficient.
6. The device according to claim 4, It is characterized in that The target ambient light sampling map corresponding to each virtual scene is used to virtually illuminate the calibrated color card image based on the preprocessed target ambient light sampling map to obtain a construction unit of corresponding color card pixels, which is specifically used for: For each target ambient light sampling map corresponding to the virtual scene, preprocessing the target ambient light sampling map to obtain a compressed initial pixel brightness value; Mapping the initial pixel brightness value according to the spherical multi-spectral light source coordinates to obtain an image area; Processing the image region to determine expected pixel values; The color card is virtually illuminated using the light measured by the expected pixel value to obtain corresponding color card pixels.
7. An electronic device, It is characterized in that The electronic device is used to run a program, wherein the program, when running, executes the image processing method as described in any one of claims 1 to 3.
8. A computer storage medium, It is characterized in that The storage medium includes a storage program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the image processing method according to any one of claims 1 to 3.
