Texture reconstruction method, device, electronic device and storage medium

By obtaining pictures under multiple light sources and performing automatic calculations, the problem of inefficient texture map editing is solved, and the effect of simplifying the texture construction process is achieved.

CN114399578BActive Publication Date: 2025-02-25BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111270082.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-29
Publication Date
2025-02-25
Estimated Expiration
2041-10-29

AI Technical Summary

Technical Problem

In the prior art, editing of texture maps requires a lot of manual operations, and requires high professional skills of operators, resulting in inefficiency.

Method used

By obtaining the image of the target object under multiple light sources, determining the three primary color data of each pixel, and automatically computing it according to the texture rendering formula to obtain the texture data of the surface of the target object.

Benefits of technology

Without relying on high-quality manual intervention and processing, the texture construction process is simplified and efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114399578B_ABST
    Figure CN114399578B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a texture reconstruction method, device, electronic device and storage medium. The method includes: obtaining a picture of a target object under each of a plurality of light sources; the picture size under each light source is the same, determining the three-primary color data of each pixel in the picture under each light source, obtaining a set of three-primary color data corresponding to each light source, determining the texture data of each pixel according to a texture rendering formula and the three-primary color data corresponding to each pixel, and the three-primary color data corresponding to each pixel is the three-primary color data of each pixel in the set of three-primary color data corresponding to each light source. In this way, the three-primary color data of each pixel under different light sources is obtained by taking pictures, and the texture rendering formula is combined for automatic calculation to obtain the texture data of the surface of the target object, without relying on high-quality manual intervention and processing, and the texture construction process can be simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of Internet technology, and in particular to a texture reconstruction method, device, electronic device and storage medium. Background Art

[0002] In the field of computer graphics (CG), rendering technology refers to the method of drawing the geometry of a three-dimensional mesh defined in a computer and the texture attached to the geometry into the view plane. In the specific implementation technology center of rendering, the color of each pixel to be drawn is calculated according to the illumination at different points, which is called the pixel shading link (Fragment Shader). Its main principle is to calculate the color that each pixel should present based on the three-dimensional spatial position, normal, texture coordinates and other information corresponding to a certain pixel in three-dimensional space, and finally obtain the color that each pixel should present through calculation with the position, color and brightness of the light source. Therefore, texture is very important data attached to the surface of the three-dimensional mesh and determines the display appearance. It directly participates in the drawing process of the object and plays a very important role in the standard rendering pipeline.

[0003] Generally speaking, in the design process of three-dimensional objects, in addition to geometric information, the most important thing is the texture information of the object. The mathematical calculation method that determines how texture participates in the calculation and how to get the final pixel color together with the light source information is called the lighting model, that is, a mathematical formula that calculates the current light source position, color, brightness, and the three-dimensional position and texture information corresponding to a pixel point to get the final color. Due to the structure of human eyes, red light, green light and blue light are perceived separately. Therefore, generally speaking, various textures are also represented based on the response to these three colors of light.

[0004] However, editing the texture map of an actual object is not simple. A common way is to manually design it, which includes: manually designing the value of each texture channel through the design, modification, smearing and other editing operations of the manual texture map in the computer on a 3D design platform. Since each texture map channel is basically independent of each other, as long as the design result can be previewed, experienced designers can still get the result within a controllable time. However, this not only requires a lot of manual operation, but also requires high professional skills of the operator. Summary of the invention

[0005] The present disclosure provides a texture reconstruction method, device, electronic device and storage medium. The technical solution of the present disclosure is as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, a texture reconstruction method is provided, comprising:

[0007] Obtain an image of the target object under each of the multiple light sources; the image size under each light source is the same;

[0008] Determine the three primary color data of each pixel in the image under each light source, and obtain the three primary color data set corresponding to each light source;

[0009] The texture data of each pixel is determined according to the texture rendering formula and the three primary color data corresponding to each pixel. The three primary color data corresponding to each pixel is the three primary color data in the three primary color data set corresponding to each light source for each pixel.

[0010] In some possible embodiments, determining the texture data of each pixel according to the texture rendering formula and the three primary color data corresponding to each pixel includes:

[0011] Determine a calibrated three-primary-color data set corresponding to each light source according to the three-primary-color data set corresponding to each light source and the color calibration parameter corresponding to each light source;

[0012] The texture data of each pixel is determined according to the texture rendering formula and the calibrated three-primary color data corresponding to each pixel; the calibrated three-primary color data corresponding to each pixel is the three-primary color data in the calibrated three-primary color data set corresponding to each light source for each pixel.

[0013] In some possible embodiments, the method further includes:

[0014] Obtaining a calibration image of the calibration object under each of a plurality of light sources;

[0015] Determine preset three-primary color data of each pixel corresponding to the calibration object;

[0016] Determine the three primary color data of each pixel in the calibration image under each light source;

[0017] The color calibration parameters corresponding to each light source are determined according to the three primary color data of each pixel in the calibration image under each light source and the preset three primary color data of each pixel.

[0018] In some possible embodiments, determining the color calibration parameters corresponding to each light source according to the three-primary color data of each pixel in the calibration image under each light source and the preset three-primary color data of each pixel includes:

[0019] Determine color data corresponding to three color channels according to the three primary color data of each pixel in the calibration image under each light source;

[0020] The color calibration parameters corresponding to each light source are determined according to the color data corresponding to the three color channels and the preset three primary color data; the color calibration parameters include three color calibration sub-parameters, and the three color calibration sub-parameters correspond to the three color channels one by one.

[0021] In some possible embodiments, the texture data of the current pixel includes normal data, intrinsic color data, metalness data, roughness data, and ambient occlusion data.

[0022] In some possible embodiments,

[0023] The preset shooting platform is used to obtain a picture of the target object under each of the multiple light sources;

[0024] The preset shooting platform is used to obtain a picture of the calibration object under each of the multiple light sources;

[0025] The preset shooting platform includes a shooting terminal, multiple light sources, a storage table and a light shielding part;

[0026] The shooting terminal is arranged on the light shielding portion and is used for shooting the target object and the calibration object;

[0027] A plurality of light sources are evenly arranged on the light shielding portion;

[0028] The light shielding portion and the storage table form a receiving cavity that isolates the external light source.

[0029] In some possible embodiments, the calibration object is a 50 degree gray card.

[0030] According to a second aspect of an embodiment of the present disclosure, a texture reconstruction device is provided, comprising:

[0031] The image acquisition module is configured to acquire an image of the target object under each of the multiple light sources, and the size of the image under each light source is the same;

[0032] A three-primary color data determination module is configured to determine the three-primary color data of each pixel in the image under each light source, and obtain a set of three-primary color data corresponding to each light source;

[0033] The texture data determination module is configured to determine the texture data of each pixel according to the texture rendering formula and the three primary color data corresponding to each pixel. The three primary color data corresponding to each pixel is the three primary color data in the three primary color data set corresponding to each pixel for each light source.

[0034] In some possible embodiments, the texture data determination module is configured to execute the following steps:

[0035] Determine a calibrated three-primary-color data set corresponding to each light source according to the three-primary-color data set corresponding to each light source and the color calibration parameter corresponding to each light source;

[0036] The texture data of each pixel is determined according to the texture rendering formula and the calibrated three-primary color data corresponding to each pixel. The calibrated three-primary color data corresponding to each pixel is the three-primary color data in the calibrated three-primary color data set corresponding to each light source for each pixel.

[0037] In some possible embodiments, the device further includes:

[0038] A calibration picture acquisition module is configured to acquire a calibration picture of the calibration object under each of the plurality of light sources;

[0039] A three-primary color data determination module, configured to determine preset three-primary color data of each pixel corresponding to the calibration object;

[0040] A three-primary color data determination module is configured to determine the three-primary color data of each pixel in the calibration image under each light source;

[0041] The calibration parameter determination module is configured to determine the color calibration parameters corresponding to each light source according to the three primary color data of each pixel in the calibration picture under each light source and the preset three primary color data of each pixel.

[0042] In some possible embodiments, the calibration parameter determination module is configured to execute the following steps:

[0043] Determine color data corresponding to three color channels according to the three primary color data of each pixel in the calibration image under each light source;

[0044] The color calibration parameters corresponding to each light source are determined according to the color data corresponding to the three color channels and the preset three primary color data. The color calibration parameters include three color calibration sub-parameters. The three color calibration sub-parameters correspond to the three color channels one by one.

[0045] In some possible embodiments, the texture data of the current pixel includes normal data, intrinsic color data, metalness data, roughness data, and ambient occlusion data.

[0046] In some possible embodiments,

[0047] The preset shooting platform is used to obtain a picture of the target object under each of the multiple light sources;

[0048] The preset shooting platform is used to obtain a picture of the calibration object under each of the multiple light sources;

[0049] The preset shooting platform includes a shooting terminal, multiple light sources, a storage table and a light shielding part;

[0050] The shooting terminal is arranged on the light shielding portion and is used for shooting the target object and the calibration object;

[0051] A plurality of light sources are evenly arranged on the light shielding portion;

[0052] The light shielding portion and the storage table form a receiving cavity that isolates the external light source.

[0053] In some possible embodiments, the calibration object is a 50 degree gray card.

[0054] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, comprising: a processor; and a memory for storing processor executable instructions; wherein the processor is configured to execute instructions to implement a texture reconstruction method as described in each item of the first aspect above.

[0055] According to the fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided. When the instructions in the computer-readable storage medium are executed by the processor of an electronic device, the electronic device can execute the texture reconstruction method of each item in the first aspect of the embodiments of the present disclosure.

[0056] According to the fifth aspect of the embodiments of the present disclosure, a computer program product is provided, the computer program product comprising a computer program, the computer program being stored in a readable storage medium, at least one processor of a computer device reading and executing the computer program from the readable storage medium, so that the computer device executes the texture reconstruction method of each item in the first aspect of the embodiments of the present disclosure.

[0057] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0058] Obtain pictures of the target object under each of the multiple light sources; the pictures under each light source have the same size, determine the three-primary color data of each pixel in the pictures under each light source, obtain the three-primary color data set corresponding to each light source, determine the texture data of each pixel according to the texture rendering formula and the three-primary color data corresponding to each pixel, and the three-primary color data corresponding to each pixel is the three-primary color data of each pixel in the three-primary color data set corresponding to each light source. In this way, the three-primary color data of each pixel under different light sources is obtained by taking pictures, and the texture rendering formula is combined for automatic calculation to obtain the texture data of the surface of the target object, without relying on high-quality manual intervention and processing, which can simplify the texture construction process.

[0059] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0061] Figure 1 is a schematic diagram of an application environment according to an exemplary embodiment;

[0062] Figure 2 is a flow chart of a texture reconstruction method according to an exemplary embodiment;

[0063] Figure 3 is a schematic diagram of a preset shooting platform according to an exemplary embodiment;

[0064] Figure 4 is a flow chart showing a method for determining color calibration parameters according to an exemplary embodiment;

[0065] Figure 5 is a block diagram of a texture reconstruction device according to an exemplary embodiment;

[0066] Figure 6 It is a block diagram of an electronic device for texture reconstruction according to an exemplary embodiment. DETAILED DESCRIPTION

[0067] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0068] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar first 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 interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0069] See also Figure 1 , Figure 1 is a schematic diagram showing an application environment of a texture reconstruction method according to an exemplary embodiment. Figure 1 As shown, the application environment may include a terminal device 01 and a server 02 .

[0070] In an optional embodiment, the terminal device 01 may be a device that provides the server 02 with pictures under each of multiple light sources. The terminal device 01 may include but is not limited to electronic devices such as smart phones, desktop computers, tablet computers, laptop computers, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, and smart wearable devices. It may also be software running on the above electronic devices, such as applications, applets, etc. Optionally, the operating system running on the electronic device may include but is not limited to Android, IOS, Linux, Windows, Unix, etc.

[0071] In an optional embodiment, server 02 obtains a picture of the target object under each of a plurality of light sources; the picture size under each light source is the same, the three primary color data of each pixel in the picture under each light source is determined, and a set of three primary color data corresponding to each light source is obtained, and the texture data of each pixel is determined according to the texture rendering formula and the three primary color data corresponding to each pixel, and the three primary color data corresponding to each pixel is the three primary color data of each pixel in the set of three primary color data corresponding to each light source. Optionally, server 02 may include an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0072] Optionally, the terminal device 01 and the server 02 may be connected via a wired link or a wireless link, and the connection method depends on the actual application scenario.

[0073] In addition, it should be noted that Figure 1 What is shown is only one application environment of the texture reconstruction method provided by the present disclosure. In actual applications, other application environments may also be included. For example, in actual applications, a shooting device and a terminal device may be included because the embodiment may be implemented by an application on a terminal device.

[0074] Figure 2 is a flowchart of a texture reconstruction method according to an exemplary embodiment. Figure 2 As shown, the texture reconstruction method can be applied to a server or a terminal device, and includes the following steps:

[0075] In step S201 , a picture of the target object under each of a plurality of light sources is obtained, and the size of the picture under each light source is the same.

[0076] The embodiments of the present application will be described with the server as the execution subject. The specific implementation steps of other execution subjects, such as terminal devices or node devices, can refer to the specific implementation steps of the server.

[0077] In some possible embodiments, the server can obtain a picture of the target object under each of the multiple light sources based on a preset shooting platform. The preset shooting platform includes a shooting terminal, multiple light sources, a storage table and a light shielding portion. The shooting terminal is arranged on the light shielding portion for shooting the target object, and the multiple light sources are evenly arranged on the light shielding portion. The light shielding portion and the storage table can form a receiving cavity that isolates the external light source. Optionally, the server can be connected to the shooting terminal. After the shooting terminal shoots the target object under each of the multiple light sources, the picture corresponding to each light source can be obtained, and the shooting terminal can transmit these pictures to the server.

[0078] Figure 3 is a schematic diagram of a preset shooting platform according to an exemplary embodiment. Figure 3 As shown, the camera comprises a storage platform, a light shielding portion, a light source and a shooting terminal. The target object can be placed in the middle of the storage platform, and the lens of the shooting terminal can be set on the light shielding portion. Optionally, the shooting terminal can be as Figure 3 As shown, it is set in the middle of the light shielding part, and at the same time needs to meet the requirement of being able to clearly capture the target object.

[0079] Among them, the structure of the light blocking portion can be a three-dimensional pot-lid-shaped structure. Optionally, the light blocking portion can be an arc dome-shaped structure, or a polyhedral dome-shaped structure, for example, a dome-shaped structure with four faces. The shape structure of the light blocking portion is not limited here. Optionally, the inner wall of the light blocking portion can be a low-reflective black material, for example, a black optical light-absorbing velvet cloth. When the light blocking portion is covered on the storage table, the light blocking portion and the storage table can form or substantially form a accommodating cavity that isolates the external light source.

[0080] Multiple light sources can be evenly arranged on the inner side of the light shielding portion. Assuming that the light shielding portion is a dome-shaped structure with four surfaces, and the multiple light sources include 64 light sources, then these 64 light sources can be evenly arranged on the four surfaces, and each surface includes 16 light sources. The above example is only a specific embodiment and is not limited here. In order to reduce the difficulty of subsequent processing of texture data, the above multiple light sources can uniformly use white LED lamp beads with consistent color temperature.

[0081] In an optional embodiment, the shooting terminal and multiple light sources can be connected to a terminal device or a server via a wired circuit. The control program on the terminal device and the server can control the opening and closing of the light source, and can also control the shooting terminal to shoot the target object under the light source to obtain a picture corresponding to each light source.

[0082] In the embodiment of the present application, the target object can be an object, such as flannel, rock or other objects with rough surfaces. The explanation is continued with the multiple light sources being 64 light sources. It is assumed that the center position of the target object is the coordinate origin O of the three-dimensional space, and its two horizontal directions are the X and Y axes of the three-dimensional space, respectively. According to the right-hand rule, the upward direction is defined as the Z axis of the three-dimensional space. In this way, the center position of each light source (the center of the light-emitting position) can be represented by a three-dimensional coordinate. This three-dimensional coordinate is labeled Li, where i=0,1,...,l-1, and Li is a three-dimensional coordinate vector.

[0083] Thus, obtaining the image of the target object under each of the multiple light sources can be specifically expanded as follows: the server first controls the number L 0 The light source is turned on and the shooting terminal is controlled to 0 The target object under the light source is photographed, and the image is 000. The server controls the number L for the second time. 1 The light source is turned on and the shooting terminal is controlled to 1 The target object under the light source is photographed, and image 001 is obtained. The server first controls the number L 3 The light source is turned on and the shooting terminal is controlled to 3 The target object under the light source is photographed, and picture 002 is obtained... The server first controls the number L 63 The light source is turned on and the shooting terminal is controlled to 63 The target object under the light source is photographed to obtain picture 063. The shooting terminal can send these 64 pictures to the server after shooting is completed, or send these 64 pictures to the server in sequence according to the shooting completion time.

[0084] Optionally, all pixels of each of the 64 images are pixels of the target object, and the size of the 64 images is the same, that is, the size of the images under each light source is the same. If there are pixels other than the target object in the original image captured by the shooting terminal, for example, part of the storage table is captured, the server can perform object recognition on the image after receiving the image, and crop the non-target object part of the image.

[0085] In step S203, the three-primary color data of each pixel in the image under each light source is determined to obtain a set of three-primary color data corresponding to each light source.

[0086] In the embodiment of the present application, assuming that the actual length of each picture is m and the width is n, the length of each picture corresponds to M pixels and the width corresponds to N pixels, then it can be determined that the total number of pixels of each picture is M*N (where * is a multiplication sign). The three-primary color data refers to the color data (R, G, B) corresponding to the three color channels (red, green and blue).

[0087] Optionally, the server determines the three primary color data of each pixel in the image under each light source, and obtains the three primary color data set corresponding to each light source, which can be specifically expressed as follows: the server determines L 0 The image under the light source contains the three primary color data of each pixel in the M*N pixels, and L 0 The three primary color data set H corresponding to the light source 0 , determine L 1 The image under the light source contains the three primary color data of each pixel in the M*N pixels, and L 1 The three primary color data set H corresponding to the light source 1 , determine L 2 The image under the light source contains the three primary color data of each pixel in the M*N pixels, and L 2 The three primary color data set H corresponding to the light source 2 ...Confirm L 63 The image under the light source contains the three primary color data of each pixel in the M*N pixels, and L 63 The three primary color data set H corresponding to the light source 63 , in this way, 64 three-primary color data sets can be obtained.

[0088] In an optional embodiment, the above-mentioned 64 light sources can be light sources of relatively good quality, and a light source of relatively good quality can be a light source with a smaller color temperature difference. In this case, the three primary color data of each pixel in the picture under each light source determined by the server is basically accurate or meets the preset requirements, then the server can directly obtain the three primary color data set corresponding to each light source.

[0089] In another optional embodiment, due to the instability of the process or materials or other reasons, the color temperature of each light source is inevitably different. This leads to the fact that the three primary color data of each pixel in the picture under each light source determined by the server and the actual three primary color data are in error. Based on this, in the embodiment of the present application, the service can determine the calibrated three primary color data set corresponding to each light source according to the three primary color data set corresponding to each light source and the color calibration parameters corresponding to each light source. Among them, the color calibration parameters include three color calibration sub-parameters, and the three color calibration sub-parameters correspond to the three color channels one by one.

[0090] L 0Take the light source as an example, L 0 The three primary color data set H corresponding to the light source 0 There are M*N three-primary color data corresponding to M*N pixels in the data, that is, each pixel corresponds to a three-primary color data (R, G, B). The server can first obtain L 0 Color calibration parameters corresponding to the light source (corresponding to the color calibration sub-parameter a for red 0 , corresponding to the green color calibration sub-parameter b 0 and the color calibration sub-parameter c corresponding to blue 0 ), and then multiply the red data of each pixel by the color calibration sub-parameter a corresponding to red 0 , the green data is multiplied by the color calibration sub-parameter b corresponding to green 0 , the blue data is multiplied by the color calibration sub-parameter c corresponding to blue 0 , and obtain the calibrated three-primary color data of each pixel, and then obtain the calibrated three-primary color data of M*N pixels, that is, determine the calibrated three-primary color data set corresponding to each light source. 1 -L 63 The calibrated three-primary color data set corresponding to these 63 light sources can be referenced to L 0 The implementation steps of the three-primary color data set after the light source calibration are determined, which will not be repeated here.

[0091] Figure 4 is a flow chart of a method for determining color calibration parameters according to an exemplary embodiment. Figure 4 As shown, including:

[0092] In step S401 , a calibration picture of the calibration object under each of a plurality of light sources is obtained.

[0093] In some possible embodiments, the server may obtain a picture of the target object under each of the multiple light sources based on the preset shooting platform.

[0094] Specifically, the server's first control number is L 0 The light source is turned on and the shooting terminal is controlled to 0 The calibration object under the light source is photographed to obtain the calibration image 100. The server controls the number L for the second time. 1 The light source is turned on and the shooting terminal is controlled to 1 The calibration object under the light source is photographed to obtain the calibration image 101. The server first controls the number L 3 The light source is turned on and the shooting terminal is controlled to 3 The calibration object under the light source is photographed to obtain a calibration image 102 ... The server first controls the number L 63 The light source is turned on and the shooting terminal is controlled to63 The calibration object under the light source is photographed to obtain a calibration picture 163, and thus, a total of 64 calibration pictures are obtained.

[0095] Optionally, all pixels of each of the 64 images are pixels of the calibration object, and the sizes of the 64 images are the same. If there are pixels other than the calibration object in the original image captured by the shooting terminal, for example, part of the storage table is captured, the server can perform object recognition on the calibration image after receiving the image, and crop the non-calibration object portion of the calibration image. At this time, there is an error between the three primary color data of each pixel in each of the above 64 calibration images and the actual three primary color data.

[0096] In step S403, the preset three-primary color data of each pixel corresponding to the calibration object is determined.

[0097] The server can determine the preset three primary color data of each pixel of the calibration object in the image, that is, the real three primary color data of each pixel. In order to reduce the computing overhead of the server, the calibration object can be a 50-degree gray plate, so that the three primary color data of each pixel can be guaranteed to be the same and (0.5, 0.5, 0.5). The above (0.5, 0.5, 0.5) can be the data obtained by scaling down (127, 127, 127) in equal proportion.

[0098] In step S405 , the three primary color data of each pixel in the calibration image under each light source is determined.

[0099] Optionally, the server can determine L 0 The calibration image under the light source contains the three primary color data of each pixel in the M*N pixels, and determines L 1 The calibration image under the light source contains the three primary color data of each pixel in the M*N pixels, and determines L 2 The calibration image under the light source contains the three primary color data of each pixel in the M*N pixels, ... determine L 63 The number of three primary colors for each pixel in the M*N pixels contained in the image under the light source.

[0100] In step S407 , the color calibration parameters corresponding to each light source are determined according to the three primary color data of each pixel in the calibration image under each light source and the preset three primary color data of each pixel.

[0101] When the preset three primary color data of each pixel corresponding to the calibration object are the same, for example, all are (0.5, 0.5, 0.5), the server can determine the color data corresponding to the three color channels according to the three primary color data of each pixel in the calibration image under each light source.

[0102] In an optional embodiment, L 0 The three primary color data of each pixel in the calibration image under the light source are the same, for example, the red data of each pixel is 0.52, the green data of each pixel is 0.51, and the blue data of each pixel is 0.515. The server can determine the color calibration parameters corresponding to each light source based on the color data corresponding to the three color channels (0.52, 0.51, 0.515) and the preset three color data (0.5, 0.5, 0.5). The color calibration parameters include three color calibration sub-parameters, and the three color calibration sub-parameters correspond to the three color channels one by one. Optionally, the server determines L based on the quotient of the red data 0.5 in the preset three color data and the red data 0.52 of each pixel. 0 Color calibration sub-parameter a of the light source corresponding to red 0 L is 0.962, and L is determined based on the quotient of the green data 0.5 in the preset three-color data and the green data 0.51 of each pixel. 0 The color calibration sub-parameter b of the light source corresponding to green 0 L is determined based on the quotient of the blue data 0.5 in the preset three-color data and the blue data 0.515 of each pixel. 0 The color calibration sub-parameter c of the light source corresponding to blue 0 It is 0.971.

[0103] In another optional embodiment, L 0 The three primary color data of each pixel in the calibration image under the light source are different. The average red data of the pixel can be determined as 0.52 based on the red data of each pixel, the average green data of the pixel can be determined as 0.51 based on the green data of each pixel, and the average blue data of the pixel can be determined as 0.515 based on the blue data of each pixel. Then, the server can determine the color calibration parameters corresponding to each light source according to the average color data corresponding to the three color channels (0.52, 0.51, 0.515) and the preset three color data (0.5, 0.5, 0.5). Optionally, the server determines L according to the quotient of the red data 0.5 in the preset three color data and the average red data 0.52 of each pixel. 0 Color calibration sub-parameter a of the light source corresponding to red 0 =0.962, L is determined based on the quotient of the green data 0.5 in the preset three-color data and the average green data 0.51 of each pixel. 0 The color calibration sub-parameter b of the light source corresponding to green 0 is 0.98, and L is determined based on the quotient of the blue data 0.5 in the preset three-color data and the average blue data 0.515 of each pixel. 0 The color calibration sub-parameter c of the light source corresponding to blue 0 It is 0.971.

[0104] In this way, we can get L 0 The color calibration parameters corresponding to the light source are (0.962, 0.98, 0.971). Similarly, we can get L 1 To L 63 Color calibration parameters corresponding to each light source in the light source.

[0105] In step S205, texture data of each pixel is determined according to the texture rendering formula and the three primary color data corresponding to each pixel, where the three primary color data corresponding to each pixel is the three primary color data in the three primary color data set corresponding to each light source.

[0106] Based on the above steps, the embodiment of the present application can obtain a set of three-primary-color data corresponding to each light source, or a set of calibrated three-primary-color data corresponding to each light source.

[0107] If each light source corresponds to a calibrated three-primary color data set, the server can determine the texture data of each pixel based on the texture rendering formula and the calibrated three-primary color data corresponding to each pixel. The calibrated three-primary color data corresponding to each pixel is the three-primary color data of each pixel in the calibrated three-primary color data set corresponding to each light source. Since there are 64 light sources, there are 64 calibrated three-primary color data for each pixel in the image.

[0108] Since the target object and the shooting terminal are unchanged, the only variable during the shooting process is the different light sources. Therefore, the pixels at the same position in multiple pictures of the same size corresponding to multiple light sources correspond to the same area of ​​the target object. This means that the pixels at the same position have 64 calibrated three-primary color data Q[i] under 64 light sources, where i = 0, 1, 2...63.

[0109] For the first pixel (the pixel in the upper left corner of the image), the present application can input 64 calibrated three-primary color data Q[i] into the texture rendering formula, and finally obtain the texture data of the first pixel, wherein the texture data includes normal data, intrinsic color data, metalness data, roughness data and ambient occlusion data. Among them, the normal data includes three position sub-data, and the intrinsic color data includes three color sub-data of red, green and blue. Among them, the normal data is used to represent the corrected value of the normal obtained by geometric interpolation of the point. Of course, the normal data can also be a value of two degrees of freedom in a tangent space.

[0110] Specifically, for pixels with image coordinates (u, v), this application considers Q[u,v,i]=Pi[u,v], where Pi[u,v] represents the pixel value of Pi at the position (u,v). Since each pixel is processed in the same way, and the position of the same pixel in different pictures is the same, the server can omit the data of the two identification positions u and v in the calculation, that is, Q[i] in the above text is used to represent Q[u,v,i] under u and v. Q[i] is a color value, which contains three components: red, green, and blue. Its value is considered to be 0-1 (in the actual implementation process, it may be 0-255, which only requires proportional enlargement and reduction, and is not limited here).

[0111] During the calculation process, the server can determine the physical position of the first pixel, that is, the texture coordinate (u, v) corresponding to the formula (1):

[0112] p=((u / M-0.5)*m,(v / N-0.5)*n,0)……Formula (1)

[0113] In an optional embodiment, when shooting with a single light source and the shooting position is a constant, the rendering formula shown in formula (2) can be simplified to obtain formula (3).

[0114]

[0115]

[0116] Among them, wi=Li-p,n=(0,0,1) (that is, the global normal is upward). c is the reflectivity, D, G, F are the determination functions of the normal (q), metalness (e), roughness (r) and ambient occlusion (a) respectively. The expression is expanded into the following formula (4):

[0117] L(wi,c,q,e,r,a)=Q[i],i=0,1,...,l–1...Formula (4)

[0118] And define the error function shown in formula (5):

[0119]

[0120] Since all the above except c, q, e, r and a are known numbers, and the formula is also determined. It can be solved by gradient descent method. That is: select any initial value of c, q, e, r, a (generally can be 0, or the corresponding value of the known pixel next to it), and then solve it by the gradient descent method of the function. The number of iterations can be limited, or the error can be limited. The final c is the reflectivity, q is the normal data, e is the metalness data, r is the roughness data, a is the ambient light occlusion data, and the intrinsic color data can also be obtained.

[0121] For determining the texture data of other pixels, reference may be made to determining the texture data of the first pixel, which will not be described in detail here.

[0122] The method proposed in the embodiment of the present application obtains the three-primary color data of each pixel under different light sources by taking pictures, and automatically calculates it in combination with the texture rendering formula, so as to obtain the surface texture data of the target object. It does not require high-quality manual intervention and processing, and can simplify the texture construction process.

[0123] Figure 5 is a block diagram of a texture reconstruction device according to an exemplary embodiment. Figure 5 The device includes a picture acquisition module 501, a three-primary color data determination module 502 and a texture data determination module 503.

[0124] The picture acquisition module 501 is configured to acquire a picture of the target object under each of the multiple light sources, and the picture size under each light source is the same;

[0125] The three-primary color data determination module 502 is configured to determine the three-primary color data of each pixel in the image under each light source, and obtain a set of three-primary color data corresponding to each light source;

[0126] The texture data determination module 503 is configured to determine the texture data of each pixel according to the texture rendering formula and the three primary color data corresponding to each pixel. The three primary color data corresponding to each pixel is the three primary color data in the three primary color data set corresponding to each pixel for each light source.

[0127] In some possible embodiments, the texture data determination module is configured to execute the following steps:

[0128] Determine a calibrated three-primary-color data set corresponding to each light source according to the three-primary-color data set corresponding to each light source and the color calibration parameter corresponding to each light source;

[0129] The texture data of each pixel is determined according to the texture rendering formula and the calibrated three-primary color data corresponding to each pixel. The calibrated three-primary color data corresponding to each pixel is the three-primary color data in the calibrated three-primary color data set corresponding to each light source for each pixel.

[0130] In some possible embodiments, the device further includes:

[0131] A calibration picture acquisition module is configured to acquire a calibration picture of the calibration object under each of the plurality of light sources;

[0132] A three-primary color data determination module, configured to determine preset three-primary color data of each pixel corresponding to the calibration object;

[0133] A three-primary color data determination module is configured to determine the three-primary color data of each pixel in the calibration image under each light source;

[0134] The calibration parameter determination module is configured to determine the color calibration parameters corresponding to each light source according to the three primary color data of each pixel in the calibration picture under each light source and the preset three primary color data of each pixel.

[0135] In some possible embodiments, the calibration parameter determination module is configured to execute the following steps:

[0136] Determine color data corresponding to three color channels according to the three primary color data of each pixel in the calibration image under each light source;

[0137] The color calibration parameters corresponding to each light source are determined according to the color data corresponding to the three color channels and the preset three primary color data. The color calibration parameters include three color calibration sub-parameters. The three color calibration sub-parameters correspond to the three color channels one by one.

[0138] In some possible embodiments, the texture data of the current pixel includes normal data, intrinsic color data, metalness data, roughness data, and ambient occlusion data.

[0139] In some possible embodiments,

[0140] The preset shooting platform is used to obtain a picture of the target object under each of the multiple light sources;

[0141] The preset shooting platform is used to obtain a picture of the calibration object under each of the multiple light sources;

[0142] The preset shooting platform includes a shooting terminal, multiple light sources, a storage table and a light shielding part;

[0143] The shooting terminal is arranged on the light shielding portion and is used for shooting the target object and the calibration object;

[0144] A plurality of light sources are evenly arranged on the light shielding portion;

[0145] The light shielding portion and the storage table form a receiving cavity that isolates the external light source.

[0146] In some possible embodiments, the calibration object is a 50 degree gray card.

[0147] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0148] Figure 6 is a block diagram of an electronic device 800 for texture reconstruction according to an exemplary embodiment.

[0149] The electronic device may be a server or a terminal device, and its internal structure diagram may be as follows: Figure 6 As shown. The electronic device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a texture reconstruction method is implemented.

[0150] Those skilled in the art will understand that Figure 6 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0151] In an exemplary embodiment, an electronic device is also provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the texture reconstruction method in the embodiment of the present disclosure.

[0152] In an exemplary embodiment, a computer-readable storage medium is further provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the texture reconstruction method in the embodiment of the present disclosure.

[0153] In an exemplary embodiment, a computer program product is also provided, which includes a computer program, the computer program is stored in a readable storage medium, and at least one processor of a computer device reads and executes the computer program from the readable storage medium, so that the computer device performs the texture reconstruction method of the embodiment of the present disclosure.

[0154] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0155] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0156] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A texture reconstruction method, characterized in that: include: Acquire a picture of the target object under each of the multiple light sources, wherein the pictures under each of the light sources have the same size; The target object and the shooting terminal of the target object are unchanged; Determine the three-primary color data of each pixel in the image under each light source, and obtain a set of three-primary color data corresponding to each light source; The texture data of each pixel is determined according to a texture rendering formula and the three primary color data corresponding to each pixel, wherein the three primary color data corresponding to each pixel is the three primary color data of each pixel in a three primary color data set corresponding to each light source.

2. The texture reconstruction method according to claim 1, characterized in that: Determining the texture data of each pixel according to the texture rendering formula and the three primary color data corresponding to each pixel includes: Determine a calibrated three-primary-color data set corresponding to each light source according to the three-primary-color data set corresponding to each light source and a color calibration parameter corresponding to each light source; The texture data of each pixel is determined according to the texture rendering formula and the calibrated three-primary color data corresponding to each pixel, wherein the calibrated three-primary color data corresponding to each pixel is the three-primary color data of each pixel in the calibrated three-primary color data set corresponding to each light source.

3. The texture reconstruction method according to claim 2, characterized in that: The method further comprises: Acquire a calibration image of the calibration object under each of the multiple light sources; Determining preset three-primary color data of each pixel corresponding to the calibration object; Determine three primary color data of each pixel in the calibration image under each light source; The color calibration parameters corresponding to each light source are determined according to the three-primary color data of each pixel in the calibration picture under each light source and the preset three-primary color data of each pixel.

4. The texture reconstruction method according to claim 3, characterized in that: Determining the color calibration parameters corresponding to each light source according to the three-primary color data of each pixel in the calibration picture under each light source and the preset three-primary color data of each pixel includes: Determine color data corresponding to three color channels according to the three primary color data of each pixel in the calibration image under each light source; The color calibration parameters corresponding to each light source are determined according to the color data corresponding to the three color channels and the preset three primary color data, wherein the color calibration parameters include three color calibration sub-parameters, and the three color calibration sub-parameters correspond to the three color channels one by one.

5. The texture reconstruction method according to any one of claims 1 to 4, characterized in that: The texture data of the current pixel includes normal data, intrinsic color data, metalness data, roughness data, and ambient occlusion data.

6. The texture reconstruction method according to claim 3, characterized in that: The preset shooting platform is used to obtain the image of the target object under each of the multiple light sources; The preset shooting platform is used to obtain a picture of the calibration object under each of the multiple light sources; The preset shooting platform includes a shooting terminal, the multiple light sources, a storage table and a light shielding part; The photographing terminal is arranged on the light shielding portion, and is used for photographing the target object and the calibration object; The plurality of light sources are evenly arranged on the light shielding portion; The light shielding portion and the storage platform form a receiving cavity that isolates the external light source.

7. The texture reconstruction method according to claim 3, characterized in that: The calibration object is a 50-degree gray plate.

8. A texture reconstruction device, characterized in that: include: A picture acquisition module is configured to acquire a picture of the target object under each of the multiple light sources, wherein the picture under each light source has the same size; The target object and the shooting terminal of the target object are unchanged; A three-primary color data determination module is configured to determine the three-primary color data of each pixel in the image under each light source to obtain a set of three-primary color data corresponding to each light source; The texture data determination module is configured to determine the texture data of each pixel according to the texture rendering formula and the three primary color data corresponding to each pixel, wherein the three primary color data corresponding to each pixel is the three primary color data of each pixel in the three primary color data set corresponding to each light source.

9. The texture reconstruction device according to claim 8, characterized in that: The texture data determination module is configured to perform the following steps: Determine a calibrated three-primary-color data set corresponding to each light source according to the three-primary-color data set corresponding to each light source and a color calibration parameter corresponding to each light source; The texture data of each pixel is determined according to the texture rendering formula and the calibrated three-primary color data corresponding to each pixel, wherein the calibrated three-primary color data corresponding to each pixel is the three-primary color data of each pixel in the calibrated three-primary color data set corresponding to each light source.

10. The texture reconstruction device according to claim 9, characterized in that: The device also includes: A calibration picture acquisition module, configured to acquire a calibration picture of the calibration object under each of the plurality of light sources; The three-primary-color data determination module is configured to determine the preset three-primary-color data of each pixel corresponding to the calibration object; The three-primary-color data determination module is configured to determine the three-primary-color data of each pixel in the calibration picture under each light source; The calibration parameter determination module is configured to determine the color calibration parameters corresponding to each light source according to the three primary color data of each pixel in the calibration picture under each light source and the preset three primary color data of each pixel.

11. The texture reconstruction device according to claim 10, characterized in that: The calibration parameter determination module is configured to perform the following steps: Determine color data corresponding to three color channels according to the three primary color data of each pixel in the calibration image under each light source; The color calibration parameters corresponding to each light source are determined according to the color data corresponding to the three color channels and the preset three primary color data, wherein the color calibration parameters include three color calibration sub-parameters, and the three color calibration sub-parameters correspond to the three color channels one by one.

12. The texture reconstruction device according to any one of claims 8 to 11, characterized in that: The texture data of the current pixel includes normal data, intrinsic color data, metalness data, roughness data, and ambient occlusion data.

13. The texture reconstruction device according to claim 10, characterized in that: The preset shooting platform is used to obtain the image of the target object under each of the multiple light sources; The preset shooting platform is used to obtain a picture of the calibration object under each of the multiple light sources; The preset shooting platform includes a shooting terminal, the multiple light sources, a storage table and a light shielding part; The photographing terminal is arranged on the light shielding portion, and is used for photographing the target object and the calibration object; The plurality of light sources are evenly arranged on the light shielding portion; The light shielding portion and the storage platform form a receiving cavity that isolates the external light source.

14. The texture reconstruction device according to claim 10, characterized in that: The calibration object is a 50-degree gray plate.

15. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the texture reconstruction method as described in any one of claims 1 to 7.

16. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the texture reconstruction method as described in any one of claims 1 to 7.

17. A computer program product, characterized in that The computer program product comprises a computer program, which is stored in a readable storage medium. At least one processor of a computer device reads and executes the computer program from the readable storage medium, so that the computer device performs the texture reconstruction method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Generation of texture models using moveable scanner

    CN113474619A