Color processing method and device for virtual scene, electronic equipment, computer readable storage medium and computer program product
By converting the color space to a luminance color space in a virtual scene, identifying the areas to be complemented, and performing complementary color processing, the problem of high computational resources is solved, the visual effect is improved, and computational resources are saved.
Patent Information
- Application Number
- CN202410636663.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-21
- Publication Date
- 2025-11-21
AI Technical Summary
Determining the brightness information and light reflection effect of a light source at various locations in a virtual scene requires excessive computing resources, which affects the improvement of visual effects.
By acquiring color information from the color space of the virtual scene, performing a first space transformation to the luminance color space, determining the area to be complemented, and performing complementary color processing based on the luminance information, and finally performing a second space transformation, computational resources are saved.
It improves the visual effects of virtual scenes, optimizes the utilization of computing resources, and reduces the need for complementary color processing of the entire image.
Smart Images

Figure CN120997366A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the image processing technology field, and particularly relates to a color processing method and device of a virtual scene, an electronic device, a computer readable storage medium and a computer program product. BACKGROUND
[0002] When a virtual scene is displayed to a user, in order to improve the reality of the virtual scene and bring closer to the user's visual effect of reality, the brightness information of each position in the virtual scene needs to be determined in the case that the virtual scene has a light source, so that the brightness information of each position in the virtual scene is closer to reality, and the visual effect of the virtual scene on the user is improved. However, determining the brightness information of each position in the virtual scene not only needs to calculate the effect of the light source directly on each position in the virtual scene, but also needs to determine the effect of the light reflected between objects, which needs to occupy a large amount of computing resources. SUMMARY
[0003] The embodiments of the present application provide a color processing method and device of a virtual scene, an electronic device, a computer readable storage medium and a computer program product, which can improve the visual effect of the virtual scene and improve the utilization rate of computing resources.
[0004] The technical scheme of the embodiments of the present application is as follows:
[0005] The embodiments of the present application provide a color processing method of a virtual scene, and the method comprises the following steps:
[0006] Obtain color information of a virtual scene in a color space;
[0007] Perform first space transformation processing on the color information to obtain brightness color information of the virtual scene in a brightness color space;
[0008] Determine a color complementation area to be complemented in the virtual scene;
[0009] Perform color complementation processing on the color complementation area to be complemented based on the brightness information in the brightness color information to obtain color complementation brightness color information of the virtual scene in the brightness color space;
[0010] Perform second space transformation processing on the color complementation brightness color information to obtain color complementation color information of the virtual scene in the color space.
[0011] The embodiments of the present application provide a color processing device of a virtual scene, and the device comprises the following modules:
[0012] A color obtaining module is configured to obtain color information of a virtual scene in a color space;
[0013] The first spatial transformation module is configured to perform first spatial transformation processing on the color information to obtain luminance color information of the virtual scene in a luminance color space.
[0014] The region determination module is configured to determine a color complementation region in the virtual scene.
[0015] The color complementation processing module is configured to perform color complementation processing on the color complementation region based on luminance information in the luminance color information to obtain color complementation luminance color information of the virtual scene in the luminance color space.
[0016] The second spatial transformation module is configured to perform second spatial transformation processing on the color complementation luminance color information to obtain color complementation color information of the virtual scene in the color space.
[0017] In the foregoing solution, the first spatial transformation module is further configured to extract a first color matrix from the color information; perform matrix multiplication processing on a first spatial transformation matrix and the first color matrix to obtain a second color matrix of the virtual scene in the luminance color space; and determine the luminance color information based on the second color matrix.
[0018] In the foregoing solution, the first spatial transformation module is further configured to perform encoding processing on the color information to obtain first spherical harmonic coefficients corresponding to each color channel included in the color information; perform first spatial transformation processing on the first spherical harmonic coefficients corresponding to each color channel to obtain second spherical harmonic coefficients in the luminance color space; and determine the luminance color information of the virtual scene in the luminance color space based on the second spherical harmonic coefficients.
[0019] In the foregoing solution, the first spatial transformation module is further configured to form a first spherical harmonic coefficient matrix from the first spherical harmonic coefficients corresponding to each color channel; perform matrix multiplication processing on the first spatial transformation matrix and the first spherical harmonic coefficient matrix to obtain a second spherical harmonic coefficient matrix in the luminance color space; and extract the second spherical harmonic coefficients in the luminance color space from the second spherical harmonic coefficient matrix.
[0020] In the foregoing solution, the region determination module is further configured to obtain first spherical harmonic coefficients corresponding to each color channel included in the color information; determine a brightest direction of an observation viewing angle in the virtual scene based on the first spherical harmonic coefficients corresponding to each color channel included in the color information; obtain an opposite direction of the brightest direction of the observation viewing angle in the virtual scene as a color complementation direction; and obtain a region corresponding to the color complementation direction as the color complementation region.
[0021] In the above scheme, the region determining module is further configured to determine a brightest direction of the observation viewing angle in the virtual scene based on the second spherical harmonic coefficients of the luminance channel; obtain an opposite direction of the brightest direction of the observation viewing angle in the virtual scene as a complementary color direction; and obtain a region corresponding to the complementary color direction as the region to be complemented in color.
[0022] In the above scheme, the region determining module is further configured to determine a luminance value corresponding to each of the second spherical harmonic coefficients; determine a luminance value of each direction of the observation viewing angle in the virtual scene based on the luminance value corresponding to each of the second spherical harmonic coefficients; and determine a direction with the highest luminance value as the brightest direction of the observation viewing angle in the virtual scene.
[0023] In the above scheme, the region determining module is further configured to determine a first luminance value of the brightest direction based on luminance information in the luminance color information; obtain a complementary color luminance positively related to the complementary color threshold and the first luminance value; and perform complementary color processing on the region to be complemented in color based on the complementary color luminance to obtain complementary color luminance color information of the virtual scene in the luminance color space.
[0024] In the above scheme, the complementary color processing module is further configured to, when the luminance information in the luminance color information is a negative value, perform complementary color processing on the region to be complemented in color to obtain the complementary color luminance color information of the virtual scene in the luminance color space; and when the luminance information in the luminance color information is a non-negative value, keep the luminance color information of the region to be complemented in color unchanged.
[0025] In the above scheme, the second space transformation module is further configured to group the complementary color luminance color information into a fourth color matrix; and perform matrix multiplication processing on the second space transformation matrix and the fourth color matrix to obtain the complementary color information of the virtual scene in the color space.
[0026] An electronic device is provided in the embodiments of the present application, and the electronic device comprises:
[0027] a memory configured to store computer executable instructions;
[0028] a processor configured to execute the computer executable instructions stored in the memory to implement the color processing method of the virtual scene provided in the embodiments of the present application.
[0029] A computer readable storage medium is provided in the embodiments of the present application, and the computer readable storage medium stores computer programs or computer executable instructions, and is configured to be executed by a processor to implement the color processing method of the virtual scene provided in the embodiments of the present application.
[0030] The embodiment of the present application provides a computer program product, comprising a computer program or computer executable instructions, which, when executed by a processor, implement the color processing method of a virtual scene provided by the embodiment of the present application.
[0031] The embodiment of the present application has the following beneficial effects: color information of a virtual scene in a color space is obtained, first space transformation processing is performed on the color information, and luminance color information of the virtual scene in a luminance color space is obtained, so that the color information in the color space is converted into the luminance color space, the luminance information in each position is adjusted, and it is ensured that the color of an image is not affected in the process of adjusting the luminance of the image, a color complementation region to be complemented in the virtual scene is determined, the color complementation region to be complemented is determined, so that color complementation processing is performed on the determined color complementation region in the subsequent process, and color complementation processing is not performed on the entire image, thereby saving computing resources. Based on the luminance information in the luminance color information, color complementation processing is performed on the color complementation region to be complemented, color complementation luminance color information of the virtual scene in the luminance color space is obtained, second space transformation processing is performed on the color complementation luminance color information, color complementation color information of the virtual scene in the color space is obtained, the color complementation color information is converted into the color space after the color complementation processing, and it is ensured that the virtual scene in the color space is finally obtained, so as to directly display the virtual scene or further process the virtual scene. BRIEF DESCRIPTION OF DRAWINGS
[0032] Figure 1 FIG. 1 is an architectural schematic diagram of a color processing system 100 of a virtual scene provided by the embodiment of the present application;
[0033] Figure 2 FIG. 5 is a structural schematic diagram of an electronic device 500 provided by the embodiment of the present application;
[0034] Figure 3A FIG. 6 is a first flow schematic diagram of a color processing method of a virtual scene provided by the embodiment of the present application;
[0035] Figure 3B FIG. 7 is a second flow schematic diagram of a color processing method of a virtual scene provided by the embodiment of the present application;
[0036] Figure 3C FIG. 8 is a third flow schematic diagram of a color processing method of a virtual scene provided by the embodiment of the present application;
[0037] Figure 4A FIG. 9 is a first color complementation pre-image provided by the embodiment of the present application;
[0038] Figure 4B FIG. 10 is a second color complementation pre-image provided by the embodiment of the present application;
[0039] Figure 5Ais a first complementary post-image provided by an embodiment of the present application;
[0040] Figure 5B is a second complementary post-image provided by an embodiment of the present application;
[0041] Figure 6 is a whole flowchart of image rendering provided by an embodiment of the present application;
[0042] Figure 7 is a specific implementation flowchart of a color processing method of a virtual scene provided by an embodiment of the present application;
[0043] Figure 8 is a schematic diagram of luminance color information provided by an embodiment of the present application.
[0044] It should be noted that the above-mentioned "first" and "second" are only used to distinguish different schemes, and do not represent the advantages or disadvantages of the schemes or the priority in the implementation process. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be described in further detail below with reference to the accompanying drawings, and the described embodiments should not be regarded as limiting the present application. All other embodiments obtained by those skilled in the art without making creative labor fall within the scope of protection of the present application.
[0046] In the following description, "some embodiments" are related to a subset of all possible embodiments, but it can be understood that "some embodiments" can be the same subset or different subset of all possible embodiments, and can be combined with each other without conflict.
[0047] In the following description, the terms "first\second\third" are only used to distinguish similar objects, and do not represent a specific order of the objects. It can be understood that "first\second\third" can interchange the specific order or sequence as allowed, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0048] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works with other related parts to achieve a predetermined target, and can be implemented entirely or partially by using software, hardware (such as processing circuit or memory) or combination thereof. Similarly, one processor (or multiple processors or memory) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that includes the function of the module or unit.
[0049] Unless otherwise defined, all technical and scientific terms used in the embodiments of the application have the same meanings as those commonly understood by one of ordinary skill in the art. The terms used in the embodiments of the application are merely used to describe the embodiments of the application, and are not intended to limit the application.
[0050] The relevant data collection process in the embodiments of the application should be strictly in accordance with the requirements of relevant national laws and regulations, obtain the informed consent or separate consent of the personal information subject, and within the scope of authorization of laws and regulations and the personal information subject, carry out subsequent data use and processing.
[0051] Before the embodiments of the application are further described in detail, the terms and phrases involved in the embodiments of the application are explained, and the terms and phrases involved in the embodiments of the application are applicable to the following explanations.
[0052] 1) Color space: A way to describe colors is by specifying combinations of primary colors to create other colors. For example, the RGB color space uses different combinations of the three primary colors red, green, and blue to represent a variety of colors.
[0053] 2) Luma color space: Color information is decomposed into two parts, brightness and color. For example, the YCoCg space decomposes color information into brightness (Y), chroma blue difference (Co), and chroma green difference (Cg)
[0054] 3) Spherical harmonic coefficients: In computer graphics, spherical harmonic coefficients are commonly used for lighting and environment mapping. By applying spherical harmonic coefficients to environment mapping, information about the ambient light can be captured, and by using only a few sets of spherical harmonic coefficients, the lighting environment can be reconstructed. Therefore, reconstructing the lighting environment using spherical harmonic coefficients can save computing resources required for computing and analyzing global lighting.
[0055] 4) Irradiance: Irradiance is related to the intensity of the light source and the area of the illuminated area, and is inversely proportional to the area of the receiving surface. It is a physical quantity that represents the density of light energy or the intensity of light, commonly used in optics, radiology, meteorology, solar energy and many other fields. Irradiance is an important parameter for describing the intensity of light received by a light detector. In architecture and interior design, irradiance is used to evaluate the indoor lighting level to ensure proper visual comfort and energy efficiency.
[0056] In today's mobile game development, global illumination has become an important technology that can provide more realistic and vivid visual effects for game environments. Global illumination not only includes the illumination of direct light sources on objects, but also includes indirect lighting, that is, the effect of light reflection between objects. This complex lighting model plays an important role in improving the visual quality of games and the immersion of players. However, the calculation of global illumination usually requires a large amount of computing resources, which is a challenge for mobile devices because the processing power and bandwidth of mobile GPUs are limited. Therefore, an efficient method is needed to calculate and resolve global illumination.
[0057] The embodiment of the present application provides a color processing method and device for a virtual scene, electronic equipment, computer readable storage medium and computer program product, which can improve the visual effect of the virtual scene while improving the utilization rate of computing resources. The color processing method for a virtual scene provided by the embodiment of the present application is realized based on computer vision technology in artificial intelligence technology.
[0058] Artificial intelligence technology is a comprehensive discipline, involving a wide range of fields, both hardware and software technologies. Artificial intelligence basic technologies generally include, such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, pre-training model technology, operation / interaction system, mechatronics, etc. Among them, the pre-training model is also called large model, basic model, which can be widely applied to downstream tasks in various directions of artificial intelligence after fine tuning. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc.
[0059] Computer vision technology (Computer Vision, CV) is a science that studies how to make machines see, and further, it refers to using cameras and computers to replace human eyes to identify and measure targets, and further to do image processing, so that the computer processing becomes more suitable for human eye observation or transmission to instrument detection. As a scientific discipline, computer vision researches related theories and technologies, and tries to establish artificial intelligence systems that can obtain information from images or multidimensional data. Large model technology brings important changes to the development of computer vision technology. Pre-training models in the field of vision can be quickly and widely applied to downstream specific tasks after fine tuning. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping, etc. It also includes common face recognition, fingerprint recognition and other biometric identification technologies.
[0060] The electronic device provided by the embodiments of the present application can be implemented as a notebook computer, a tablet computer, a desktop computer, a set-top box, a mobile device (for example, a mobile phone, a portable music player, a personal digital assistant, a dedicated message device, a portable game device), a smart device (for example, a smart phone, a smart speaker, a smart watch, a smart television, a smart home appliance, a smart voice interaction device), a vehicle-mounted terminal, an aircraft, and various types of object terminals, and can also be implemented as a server. In the following, an example application when the device is implemented as a server will be described.
[0061] Referring to Figure 1 , Figure 1 is an architecture schematic diagram of a color processing system 100 of a virtual scene provided by the embodiments of the present application. To implement a color processing application supporting a virtual scene, the terminal 400 is connected to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.
[0062] The terminal 400 is configured to acquire an image that needs to be adjusted in brightness, and transmit the image to the server 200 through the network 300.
[0063] The server 200 is configured to acquire color information of the virtual scene in a color space, perform first space transformation processing on the color information to obtain brightness color information of the virtual scene in a brightness color space, determine a color complementation region to be complemented in the virtual scene, perform color complementation processing on the color complementation region to be complemented based on the brightness information in the brightness color information to obtain color complementation brightness color information of the virtual scene in the brightness color space, and perform second space transformation processing on the color complementation brightness color information to obtain color complementation color information of the virtual scene in the color space.
[0064] The color processing method of the virtual scene provided by the embodiments of the present application can be applied in a game scene and a shopping scene. In the game scene, color information of a game picture of a virtual scene corresponding to a game in a color space can be acquired, and then first space transformation processing is performed on the color information of the game picture to obtain brightness color information of the virtual scene corresponding to the game in a brightness color space. A color complementation region to be complemented in the virtual scene corresponding to the game is determined, color complementation processing is performed on the color complementation region to be complemented based on the brightness information in the brightness color information to obtain color complementation brightness color information of the virtual scene corresponding to the game in the brightness color space, and finally second space transformation processing is performed on the color complementation brightness color information to obtain color complementation color information of the virtual scene corresponding to the game in the color space.
[0065] In the shopping scene, color information of a shopping picture of a virtual scene corresponding to shopping in a color space can be acquired, then the color information of the shopping picture is subjected to first space transformation processing, and brightness color information of the virtual scene corresponding to shopping in a brightness color space is obtained, a region to be color complemented in the virtual scene corresponding to shopping is determined, the region to be color complemented is subjected to color complementation processing based on brightness information in the brightness color information, color complementation brightness color information of the virtual scene corresponding to shopping in the brightness color space is obtained, and finally the color complementation brightness color information is subjected to second space transformation processing, and color complementation color information of the virtual scene corresponding to shopping in the color space is obtained.
[0066] In some embodiments, the server 200 can be a standalone physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, and basic cloud computing services such as big data and artificial intelligence platforms. The terminal 400 can be a smartphone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a smart television, a vehicle-mounted terminal, and the like, but is not limited thereto. The terminal and the server can be connected directly or indirectly through wired or wireless communication, and the present embodiments are not limited in this regard.
[0067] In some embodiments, the terminal or the server can implement the method provided in the present embodiments by running a computer program. For example, the computer program can be a native program or a software module in an operating system; can be a native application program (APP), i.e., a program that needs to be installed in an operating system to run, such as a game APP; can be a mini program, i.e., a program that only needs to be downloaded into a browser environment to run; or can be a mini program that can be embedded into any APP. In summary, the above computer program can be any form of application program, module or plug-in.
[0068] Referring to Figure 2 , Figure 2 is a structural schematic diagram of an electronic device 500 provided in the present embodiments, Figure 2 The electronic device 500 shown in FIG. 5 includes at least one processor 510, a memory 550, at least one network interface 520, and a user interface 530. The various components in the electronic device 500 are coupled together through a bus system 540. It can be understood that the bus system 540 is used to realize the connection and communication between the components. In addition to including a data bus, the bus system 540 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, all the buses are marked as the bus system 540 in Figure 2 .
[0069] The processor 510 can be an integrated circuit chip that has a processing capability of signals, such as a general purpose processor, a digital signal processor (DSP), or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc., wherein the general purpose processor can be a microprocessor or any conventional processor.
[0070] The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532 that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0071] The memory 550 can be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 550 optionally includes one or more storage devices physically located in proximity to the processor 510.
[0072] The memory 550 includes volatile memory or non-volatile memory, and can also include both volatile and non-volatile memory. Non-volatile memory can be read only memory (ROM), and volatile memory can be random access memory (RAM). The memory 550 described in embodiments of the present application is intended to include any suitable type of memory.
[0073] In some embodiments, the memory 550 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or a subset or superset thereof, which are described below.
[0074] The operating system 551 includes system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0075] The network communication module 552 is used to communicate with other electronic devices via one or more (wired or wireless) network interfaces 520, examples of which include Bluetooth, wireless compatibility authentication (WiFi), and universal serial bus (USB), etc.
[0076] a rendering module 553 for enabling rendering of information (e.g., a user interface for operating a peripheral device and displaying content and information) via one or more output devices 531 (e.g., a display screen, a speaker, etc.) associated with the user interface 530;
[0077] an input processing module 554 for detecting and translating one or more user inputs or interactions from one or more input devices 532.
[0078] In some embodiments, the apparatus provided by the embodiments of the present application can be implemented in software, Figure 2 A color processing apparatus 555 for a virtual scene stored in the memory 550 is shown, which can be software in the form of programs and plug-ins, etc., including the following software modules: a color acquisition module 5551, a first spatial transformation module 5552, a region determination module 5553, a complementary color processing module 5554, and a second spatial transformation module 5555. These modules are logical, and thus can be combined or further split according to the implemented functions. The functions of the various modules will be described below.
[0079] In some embodiments, the apparatus provided by the embodiments of the present application can be implemented in software,
[0080] The color processing method for a virtual scene provided by the embodiments of the present application will be described below. As mentioned above, the electronic device implementing the color processing method for a virtual scene provided by the embodiments of the present application can be a terminal, a server, or a combination of the two. Therefore, the execution subject of each step will not be repeated in the following description.
[0081] Referring to Figure 3A , Figure 3A is a first flowchart of the color processing method for a virtual scene provided by the embodiments of the present application, which will be combined with the description of the color processing apparatus for a virtual scene provided by the embodiments of the present application to describe the color processing method for a virtual scene provided by the embodiments of the present application.Figure 3A The steps 101 to 105 are shown for illustration.
[0082] In step 101, color information of the virtual scene in a color space is obtained.
[0083] As an example, the virtual scene can be a simulated scene in the process of implementing the embodiments of the present application, for example, the virtual scene is a village scene in a game scene, and the color processing method of the virtual scene is implemented in the village scene in the game scene.
[0084] As an example, the color space can be a commonly used RGB color space, and the color information of the virtual scene in the color space can be RGB color information of the virtual scene in the RGB color space.
[0085] As an example, the color information can be a pixel value of each channel of each pixel in the image in the color space.
[0086] As an example, the specific process of obtaining the color information of the virtual scene in the color space can be to first obtain an image of the virtual scene, and then traverse each pixel in the image to obtain the RGB value of each pixel in the image to obtain the color information corresponding to the final image of the virtual scene.
[0087] In step 102, the color information is subjected to first space transformation processing to obtain luminance color information of the virtual scene in a luminance color space.
[0088] As an example, the obtained color information is a mixed value containing the color intensity and luminance of each color channel, and the purpose of the color processing method of the virtual scene implemented by the present application is only to adjust the luminance of the image. If the color information in the color space is directly adjusted, the color of the adjusted image can be distorted, and therefore the color information in the color space needs to be converted to the color information in the luminance color space.
[0089] As an example, in the luminance color space, the color information is decomposed into luminance and color two parts. For example, the YCoCg space decomposes the color information into luminance (Y), chroma blue difference (Co) and chroma green difference (Cg).
[0090] In some embodiments, the color information in step 102 is subjected to first space transformation processing to obtain luminance color information of the virtual scene in a luminance color space, which can be realized by the following technical solution: a first color matrix is extracted from the color information; a first space transformation matrix and the first color matrix are subjected to matrix multiplication processing to obtain a second color matrix of the virtual scene in the luminance color space; and the luminance color information is determined based on the second color matrix.
[0091] As an example, taking the RGB color space as an example, the color information of the RGB color space can include color information of an R channel, color information of a G channel, and color information of a B channel, and the color information of each channel is taken as an element of the first color matrix to obtain the first color matrix.
[0092] As an example, taking the YCoCg space as an example, the process of matrix multiplication of the first space conversion matrix and the first color matrix can refer to the following formula (1):
[0093]
[0094] In formula (1), is a second color matrix, is a first space conversion matrix, is a first color matrix. Through the matrix in the above formula (1), the first color matrix can be converted into the second color matrix. Each element included in the second color matrix represents color information corresponding to each channel in the YCoCg space.
[0095] As an example, in the YCoCg space, the color information corresponding to the Y channel is luminance information, so the color information corresponding to the Y channel in the second color matrix can be taken as luminance color information.
[0096] Through the embodiments of the present application, the conversion of the color space can be realized only by one matrix multiplication, which improves the efficiency of the color space conversion and saves the computing resources occupied by the process of the color space conversion.
[0097] In some embodiments, the first space conversion processing of the color information in the above step 102 to obtain the luminance color information of the virtual scene in the luminance color space can be implemented through steps 1021 to 1023 as shown in the following: Figure 3B
[0098] In step 1021, the color information is encoded to obtain the first spherical harmonic coefficient corresponding to each color channel included in the color information.
[0099] As an example, after obtaining the color information of the color space, the color information can be fitted by a spherical harmonic function. Through the process of fitting the color information by the spherical harmonic function, the first spherical harmonic coefficient corresponding to each color channel is obtained.
[0100] As an example, a first-order spherical harmonic function is selected to fit the color information to obtain four spherical harmonic coefficients.
[0101] In step 1022, the first spatial transformation processing is performed on the first spherical harmonic coefficients corresponding to each color channel to obtain second spherical harmonic coefficients in the luminance color space.
[0102] In some embodiments, the first spatial transformation processing on the first spherical harmonic coefficients corresponding to each color channel to obtain second spherical harmonic coefficients in the luminance color space in step 1022 can be implemented by the following technical solutions: the first spherical harmonic coefficients corresponding to each color channel are grouped into a first spherical harmonic coefficient matrix; the first spatial transformation matrix and the first spherical harmonic coefficient matrix are multiplied to obtain a second spherical harmonic coefficient matrix in the luminance color space; and the second spherical harmonic coefficients in the luminance color space are extracted from the second spherical harmonic coefficient matrix.
[0103] For example, taking the RGB space as the color space, the R channel corresponds to four first spherical harmonic coefficients R0, R1, R2 and R3, the G channel corresponds to four first spherical harmonic coefficients G0, G1, G2 and G3, and the B channel corresponds to four first spherical harmonic coefficients B0, B1, B2 and B3. The first spherical harmonic coefficient matrix can be wherein the elements R in the matrix include the four coefficients R0, R1, R2 and R3, the elements G in the matrix include the four coefficients G0, G1, G2 and G3, and the elements B in the matrix include the four coefficients B0, B1, B2 and B3.
[0104] For example, taking the YCoCg space as the luminance color space, the matrix multiplication processing on the first spatial transformation matrix and the first spherical harmonic coefficient matrix can refer to the following formula (2).
[0105]
[0106] In formula (2), is the second spherical harmonic coefficient matrix, is the first spatial transformation matrix, is the first spherical harmonic coefficient matrix. Through the matrix in the above formula (2), the first spherical harmonic coefficient matrix can be converted into the second spherical harmonic coefficient matrix. The elements Y in the second spherical harmonic coefficient matrix include four second spherical harmonic coefficients Y0, Y1, Y2 and Y3, the elements Co include four second spherical harmonic coefficients Co0, Co1, Co2 and Co3, and the elements Cg include four second spherical harmonic coefficients Cg0, Cg1, Cg2 and Cg3.
[0107] As an example, according to the above formula (2), it can be known that Y0 included in the element Y can be 1 / 4R0+1 / 2G0+1 / 4B0, and Y1 included in the element Y can be 1 / 4R1+1 / 2G1+1 / 4B1, Y2 can be 1 / 4R2+1 / 2G2+1 / 4B2, and Y3 can be 1 / 4R3+1 / 2G3+1 / 4B3. Each second spherical harmonic coefficient included in the element Co and the element Cg can also be calculated based on the above formula (2). Since the embodiments of the present application mainly use the luminance color information (color information represented by the Y channel), each second spherical harmonic coefficient included in the element Co and the element Cg will not be described in detail.
[0108] According to the embodiments of the present application, the conversion of the color space can be realized only by one matrix multiplication, which improves the efficiency of the color space conversion and saves the computing resources occupied by the process of the color space conversion.
[0109] In step 1023, based on the second spherical harmonic coefficient, the luminance color information of the virtual scene in the luminance color space is determined.
[0110] As an example, after obtaining the second spherical harmonic coefficient, the second spherical harmonic coefficients Y0, Y1, Y2 and Y3 corresponding to the Y channel can be used. Since the spherical harmonic coefficient represents the luminance value corresponding to each direction, the value of the second spherical harmonic coefficient can be used as the luminance color information in the luminance color space.
[0111] In step 103, the color complementation area in the virtual scene is determined.
[0112] As an example, the color complementation area is an area in the virtual scene that needs to adjust the luminance.
[0113] In some embodiments, the determination of the color complementation area in the virtual scene in step 103 can be realized by the following technical solution: obtaining the first spherical harmonic coefficient corresponding to each color channel included in the color information; determining the brightest direction of the observation viewing angle in the virtual scene based on the first spherical harmonic coefficient corresponding to each color channel included in the color information; obtaining the opposite direction of the brightest direction of the observation viewing angle in the virtual scene as the color complementation direction; and obtaining the area corresponding to the color complementation direction as the color complementation area.
[0114] As an example, the first spherical harmonic coefficient corresponding to each color channel included in the color information of the color space can be obtained. Since the first spherical harmonic coefficient represents the color degree and luminance in each direction, the brightest direction in the color space can be calculated by the first spherical harmonic coefficient, and then the opposite direction of the brightest direction can be used as the color complementation direction, and the area of the color complementation direction can be used as the color complementation area.
[0115] For details, please refer to Figure 4A , Figure 4AThe first color-complementary pre-image provided by the embodiment of the present application.
[0116] In Figure 4A , the coordinate axis 401 is a three-dimensional coordinate direction of the image, and the sphere 402 is a sphere to be color-complemented. If the brightest direction of the sphere 402 is determined to be the negative direction of the X axis according to the first spherical harmonic coefficient, the positive direction of the X axis can be taken as the color-complementary direction, and the surface of the sphere 402 located in the positive direction of the X axis and taking the center of the sphere 402 as the coordinate axis origin can be taken as the region to be color-complemented.
[0117] In some embodiments, the luminance information includes the second spherical harmonic coefficient of the luminance channel, and the determination of the region to be color-complemented in the virtual scene in step 103 can be implemented by steps 1031 to 1033 as shown in the following. Figure 3C
[0118] In step 1031, the brightest direction of the observation viewing angle in the virtual scene is determined based on the second spherical harmonic coefficient of the luminance channel.
[0119] In some embodiments, the determination of the brightest direction of the observation viewing angle in the virtual scene based on the second spherical harmonic coefficient of the luminance channel in step 1031 can be implemented by the following technical solution: determining the luminance value corresponding to each second spherical harmonic coefficient; determining the luminance value of each direction of the observation viewing angle in the virtual scene based on the luminance value corresponding to each second spherical harmonic coefficient; and taking the direction with the highest luminance value as the brightest direction of the observation viewing angle in the virtual scene.
[0120] As an example, the second spherical harmonic coefficient describes the luminance information in each direction in the three-dimensional virtual space, and the observation viewing angle takes a certain point in the virtual space as an observation point, so the luminance value of the observation viewing angle can be the luminance value of each observation direction obtained by taking the observation point as the coordinate origin. Therefore, the process of converting the luminance value corresponding to the second spherical harmonic coefficient of the luminance channel into the luminance value of each direction of the observation viewing angle can be the process of coordinate system conversion.
[0121] As an example, the second spherical harmonic coefficient of the luminance channel represents the luminance value in each direction, so the luminance value of each direction can be determined through the second spherical harmonic coefficient of the luminance channel. Then, the luminance value corresponding to the second spherical harmonic coefficient of the luminance channel can be converted into the luminance value of each direction of the observation viewing angle, and then the direction with the highest luminance value of the observation viewing angle can be taken as the brightest direction of the observation viewing angle in the virtual scene.
[0122] As an example, the following will be described in combination with Figure 4B . Figure 4B The second color-complementary pre-image provided by the embodiment of the present application. In Figure 4B In some embodiments, the point 403 is an observation point, the direction 404 is the brightest direction of the observation view angle, and the direction 405 is the opposite direction of the brightest direction of the observation view angle. The region of the opposite direction of the brightest direction of the observation view angle is regarded as the region to be color complemented.
[0123] In step 1032, the opposite direction of the brightest direction of the observation view angle in the virtual scene is obtained as the color complementation direction.
[0124] As an example, the positive direction of the Y-axis of the observation view angle is the brightest direction, and the negative direction of the Y-axis of the observation view angle can be regarded as the color complementation direction.
[0125] In step 1033, the region corresponding to the color complementation direction is obtained as the region to be color complemented.
[0126] As an example, after determining that the negative direction of the Y-axis is the color complementation direction, the region of the negative direction of the Y-axis of the observation view angle can be regarded as the region to be color complemented.
[0127] According to the embodiments of the present application, the region to be color complemented can be determined by the brightest direction, without the need to determine the region to be color complemented by calculating the global brightness, thereby reducing the occupation of the computing resources.
[0128] In step 104, the region to be color complemented is color complemented based on the brightness information in the brightness color information, to obtain the color complementation brightness color information of the virtual scene in the brightness color space.
[0129] As an example, the color complementation brightness color information is the color complementation brightness color information in the brightness color space. Taking the YCoCg as an example, the brightness information in the brightness color space is the brightness information corresponding to the Y channel, and the color complementation brightness color information includes the color complementation brightness information of the brightness information corresponding to the Y channel, the color information corresponding to the Co channel, and the color information corresponding to the Cg channel.
[0130] In some embodiments, the color complementation brightness color information of the virtual scene in the brightness color space can be obtained by the following technical solution: determining the first brightness value of the brightest direction based on the brightness information in the brightness color information; obtaining the color complementation brightness positively related to the color complementation threshold and the first brightness value; and color complementing the region to be color complemented based on the color complementation brightness, to obtain the color complementation brightness color information of the virtual scene in the brightness color space.
[0131] As an example, if it is determined that the first brightness value of the brightest direction is 100 brightness units, and the complementary color threshold is 5%, the product of the first brightness value and the complementary color threshold can be taken as the complementary color brightness, that is, the complementary color brightness is 5 brightness units, and then the brightness value of each pixel in the region to be complemented can be increased by 5 brightness units to implement the complementary color processing on the region to be complemented, and the brightness value of each pixel after complementary color processing is taken as the complementary color brightness color information.
[0132] As an example, in combination with Figure 5A and Figure 5B are described, Figure 5A is a first complementary color image provided by an embodiment of the present application, Figure 5B is a second complementary color image provided by an embodiment of the present application.
[0133] In Figure 5A , the brightness value of the region to be complemented 502 of the sphere 501 is higher than Figure 4A the brightness value of the region to be complemented.
[0134] In Figure 5B , the brightness value of the region to be complemented 503 is higher than Figure 4B the brightness value of the region to be complemented.
[0135] In some embodiments, the complementary color processing on the region to be complemented based on the brightness information in the brightness color information to obtain the complementary color brightness color information of the virtual scene in the brightness color space in step 104 can be implemented by the following technical solution: when the brightness information in the brightness color information is a negative value, the complementary color processing on the region to be complemented is performed to obtain the complementary color brightness color information of the virtual scene in the brightness color space; when the brightness information in the brightness color information is a non-negative value, the brightness color information of the region to be complemented is kept unchanged.
[0136] As an example, since not every image needs to be complemented, after the region to be complemented is determined, the brightness value of the region to be complemented can be determined first, if the brightness value of the region to be complemented is a negative value, the complementary color processing on the region to be complemented is performed, and if the brightness value of the region to be complemented is a non-negative value, the complementary color processing on the region to be complemented is not performed.
[0137] As an example, if the brightness value of the region to be complemented A is 10, it is determined that the brightness value of the region to be complemented A is a non-negative value, and the complementary color processing on the region to be complemented A is not performed, and if the brightness value of the region to be complemented B is -20, it is determined that the brightness value of the region to be complemented B is a negative value, and the complementary color processing on the region to be complemented B is performed.
[0138] As an example, in actual application, the color complementation processing can be performed on the to-be-complemented region with the luminance value less than the luminance threshold, and the color complementation processing is not performed on the to-be-complemented region with the luminance value not less than the luminance threshold. The critical value of whether to perform the color complementation processing on the to-be-complemented region can be selected according to actual conditions, which is not limited here.
[0139] By the embodiment of the present application, the color complementation processing can be avoided on the region that does not need to be complemented, thereby ensuring the visual effect of the image.
[0140] In step 105, the color complementation luminance color information is subjected to the second spatial transformation processing, and the color complementation color information of the virtual scene in the color space is obtained.
[0141] In some embodiments, the color complementation luminance color information is subjected to the second spatial transformation processing in step 105, and the color complementation color information of the virtual scene in the color space can be realized by the following technical solution: the color complementation luminance color information is composed into a fourth color matrix; the second spatial transformation matrix and the fourth color matrix are subjected to the matrix multiplication processing, and the color complementation color information of the virtual scene in the color space is obtained.
[0142] As an example, taking the luminance color space as the YCoCg space and the color space as the RGB space, the process of the matrix multiplication processing of the second spatial transformation matrix and the fourth color matrix can be referred to the following formula (3):
[0143]
[0144] In formula (3), is the fourth color matrix, is the second spatial transformation matrix, is the matrix corresponding to the color complementation color information of the color space. The color complementation color information of the color space can be obtained based on the matrix corresponding to the color complementation color information of the color space.
[0145] Through the above scheme, only the luminance of the image can be adjusted without affecting the color of the image. Meanwhile, only two color space conversions are needed when determining the luminance information of the image, without calculating the global luminance in the virtual scene, thereby improving the utilization rate of the computing resources while improving the visual effect of the virtual scene.
[0146] In the following, an exemplary application of the embodiment of the present application in an actual application scenario will be described.
[0147] The scheme provided by the embodiments of the present application can be used in encoding calculation of spherical harmonic transfer (SH Transfer), meaning that the calculation is not pixel by pixel. Meanwhile, only one transfer is calculated, and the calculation can be completed through simple addition and subtraction, which has a small performance burden on a mobile terminal. More importantly, the process of calculating SH Transfer and reducing ringing through inverse complementary color both use YCoCg luminance space (luminance color space), so as to ensure color accuracy as much as possible. YCoCg is actually a lossless conversion of RGB color space, in which Y is luminance, Cg is chroma green, and Co is chroma blue.
[0148] It can be understood that in the embodiments of the present application, related data such as user information is involved, and when the embodiments of the present application are applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards.
[0149] The application process of the color processing method of a virtual scene provided by the embodiments of the present application in actual application will be described below. Figure 6 Figure 6 The overall flowchart of image rendering provided by the embodiments of the present application.
[0150] First, in the pre-work of image rendering, a container (Volume) for storing probes is created, and the container includes a plurality of probes. The process of processing probe 0 will be described below.
[0151] Radiation is emitted from the position of probe 0 to the surrounding to obtain scene color information and distance information of the detection point where probe 0 is located. Then the scene color information is converted into an expression of radiance in a spherical harmonic function through approximate fitting, and then the radiance spherical harmonic function of the probe is obtained. Then the radiance spherical harmonic functions of the probes are stored.
[0152] In the process of image rendering, the spherical harmonic coefficients of the radiance spherical harmonic function of each probe are obtained, and then the radiance corresponding to each probe is decoded. The weight of each radiance is calculated according to the distance from the rendering point to each probe. The global illumination contribution of each probe to the rendering point is obtained by using color multiplication weight. Then the global illumination contribution of each probe to the rendering point is added and multiplied by the integration domain and normalized to obtain the global illumination intensity of the rendering point.
[0153] The color processing method of a virtual scene introduced in the present application is mainly applicable to the process of determining the spherical harmonic functions of the probes.
[0154] The application process of the color processing method of a virtual scene provided by the embodiments of the present application in actual application will be described below. Figure 7 The color processing method of the virtual scene provided by the embodiment of the present application is described below. Figure 7 is a specific implementation flowchart of the color processing method of the virtual scene provided by the embodiment of the present application.
[0155] First, the color information (Radiance) obtained by the probe is encoded into spherical harmonic coefficients, and the irradiance is obtained by mathematical integration of the spherical harmonic coefficients. Because the original color information is in the RGB color space, the finally encoded spherical harmonic coefficients are also in the RGB color space. In this scheme, the first two orders of spherical harmonic coefficients are used for performance consideration, that is, 4 coefficients for each color channel.
[0156] Through the embodiment of the present application, the spherical harmonic coefficients of each color channel can be obtained, that is, three groups of spherical harmonic coefficients are obtained, each group of spherical harmonic coefficients corresponds to a color channel, and each group of spherical harmonic coefficients includes 4 coefficients. Then the spherical harmonic coefficients can be converted into spherical harmonic coefficients in the luminance color space. For details, please refer to the following formula (4).
[0157]
[0158] In formula (4), is a second color matrix, is a first space transformation matrix, is a first color matrix. Through the matrix in the above formula (4), the first color matrix can be converted into the second color matrix.
[0159] Since in the subsequent process of determining the brightest direction, the brightest direction can be determined through the data of the luminance channel, after the second color matrix is obtained, only the element Y in the second color matrix can be focused on. For details, please refer to Figure 8 , Figure 8 is a schematic diagram of the luminance color information provided by the embodiment of the present application.
[0160] In Figure 8 , the spherical harmonic coefficients corresponding to the Y channel are four, which are spherical harmonic coefficient Y0, spherical harmonic coefficient Y1, spherical harmonic coefficient Y2 and spherical harmonic coefficient Y3. Among them, the spherical harmonic coefficient Y0 is equal to 1 / 4 spherical harmonic coefficient R0 (spherical harmonic coefficient of R channel) plus 1 / 2 spherical harmonic coefficient G0 (spherical harmonic coefficient of G channel) plus 1 / 4 spherical harmonic coefficient B0 (spherical harmonic coefficient of B channel), and the coefficient before the spherical harmonic coefficient is obtained based on the first space transformation matrix. Similarly, the spherical harmonic coefficient Y1 is equal to 1 / 4 spherical harmonic coefficient R1 plus 1 / 2 spherical harmonic coefficient G1 plus 1 / 4 spherical harmonic coefficient B1, the spherical harmonic coefficient Y2 is equal to 1 / 4 spherical harmonic coefficient R2 plus 1 / 2 spherical harmonic coefficient G2 plus 1 / 4 spherical harmonic coefficient B2, and the spherical harmonic coefficient Y3 is equal to 1 / 4 spherical harmonic coefficient R3 plus 1 / 2 spherical harmonic coefficient G3 plus 1 / 4 spherical harmonic coefficient B3.
[0161] Since the spherical harmonic coefficients can represent the luminance information of each direction, the brightest direction can be determined based on the values of the first-order spherical harmonic coefficients of the obtained Y channel. Of course, the brightest direction can also be determined based on the values of the first-order spherical harmonic coefficients of the RGB color space after the spherical harmonic coefficients of the RGB color space are obtained.
[0162] After the brightest direction is determined, the direction opposite to the brightest direction is taken as the color-complementing region. The luminance value of the brightest direction can be directly supplemented to the color-complementing region by 5%, or the luminance value of the brightest direction can be supplemented to the color-complementing region by 5% after it is determined that the luminance value of the color-complementing region is negative.
[0163] Finally, the color-complemented luminance color information of the luminance color space (YCoCg lightness space) is converted into the RGB space to obtain three groups of spherical harmonic coefficients after luminance modification. For details, refer to the following formula:
[0164]
[0165] In formula (5), is a fourth color matrix, is a second spatial transformation matrix, is a matrix corresponding to the color-complementing color information of the color space. The color-complementing color information of the color space can be obtained based on the matrix corresponding to the color-complementing color information of the color space.
[0166] It can be understood that in the embodiments of the present application, related data such as user information are involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use, and processing of related data need to comply with relevant laws, regulations, and standards of countries and regions.
[0167] The following continues to describe an exemplary structure of the implementation of the color processing apparatus 555 of the virtual scene provided by the embodiments of the present application as a software module. In some embodiments, as shown in FIG. 5B, the software module stored in the color processing apparatus 555 of the virtual scene in the memory 550 can include: Figure 2
[0168] A color acquisition module 5551 is configured to acquire color information of a virtual scene in a color space.
[0169] A first spatial transformation module 5552 is configured to perform first spatial transformation processing on the color information to obtain luminance color information of the virtual scene in a luminance color space.
[0170] A region determination module 5553 is configured to determine a color-complementing region in the virtual scene.
[0171] The complementary color processing module 5554 is configured to perform complementary color processing on the region to be processed based on the luminance information in the luminance color information, to obtain complementary luminance color information of the virtual scene in the luminance color space.
[0172] The second space transformation module 5555 is configured to perform second space transformation processing on the complementary luminance color information, to obtain complementary color information of the virtual scene in the color space.
[0173] In some embodiments, the first space transformation module 5552 is further configured to extract a first color matrix from the color information; perform matrix multiplication processing on the first space transformation matrix and the first color matrix, to obtain a second color matrix of the virtual scene in the luminance color space; and determine the luminance color information based on the second color matrix.
[0174] In some embodiments, the first space transformation module 5552 is further configured to perform encoding processing on the color information, to obtain first spherical harmonic coefficients corresponding to each color channel included in the color information; perform first space transformation processing on the first spherical harmonic coefficients corresponding to each color channel, to obtain second spherical harmonic coefficients in the luminance color space; and determine the luminance color information of the virtual scene in the luminance color space based on the second spherical harmonic coefficients.
[0175] In some embodiments, the first space transformation module 5552 is further configured to form a first spherical harmonic coefficient matrix from the first spherical harmonic coefficients corresponding to each color channel; perform matrix multiplication processing on the first space transformation matrix and the first spherical harmonic coefficient matrix, to obtain a second spherical harmonic coefficient matrix in the luminance color space; and extract the second spherical harmonic coefficients in the luminance color space from the second spherical harmonic coefficient matrix.
[0176] In some embodiments, the region determination module 5553 is further configured to obtain first spherical harmonic coefficients corresponding to each color channel included in the color information; determine a brightest direction of the observation viewing angle in the virtual scene based on the first spherical harmonic coefficients corresponding to each color channel included in the color information; obtain an opposite direction of the brightest direction of the observation viewing angle in the virtual scene as a complementary color direction; and obtain a region corresponding to the complementary color direction as the region to be processed.
[0177] In some embodiments, the region determination module 5553 is further configured to determine a brightest direction of the observation viewing angle in the virtual scene based on the second spherical harmonic coefficients of the luminance channel; obtain an opposite direction of the brightest direction of the observation viewing angle in the virtual scene as a complementary color direction; and obtain a region corresponding to the complementary color direction as the region to be processed.
[0178] In some embodiments, the region determination module 5553 is further configured to determine a luminance value corresponding to each of the second spherical harmonic coefficients; determine a luminance value of each direction of the observation viewing angle in the virtual scene based on the luminance value corresponding to each of the second spherical harmonic coefficients; and determine a direction with the highest luminance value as the brightest direction of the observation viewing angle in the virtual scene.
[0179] In some embodiments, the region determination module 5553 is further configured to determine a first luminance value of the brightest direction based on luminance information in the luminance color information; obtain a complementary color luminance that is positively correlated with the first luminance value and a complementary color threshold; and perform complementary color processing on the region to be complemented based on the complementary color luminance to obtain complementary color luminance color information of the virtual scene in the luminance color space.
[0180] In some embodiments, the complementary color processing module 5554 is further configured to, when the luminance information in the luminance color information is a negative value, perform complementary color processing on the region to be complemented to obtain complementary color luminance color information of the virtual scene in the luminance color space; and when the luminance information in the luminance color information is a non-negative value, keep the luminance color information of the region to be complemented unchanged.
[0181] In some embodiments, the second space transformation module 5555 is further configured to group the complementary color luminance color information into a fourth color matrix; and perform matrix multiplication processing on the second space transformation matrix and the fourth color matrix to obtain complementary color information of the virtual scene in the color space.
[0182] Embodiments of the present application provide a computer program product, which includes a computer program or computer executable instructions stored in a computer readable storage medium. A processor of an electronic device reads the computer executable instructions from the computer readable storage medium. The processor executes the computer executable instructions, so that the electronic device performs the color processing method of the virtual scene provided in the embodiments of the present application.
[0183] Embodiments of the present application provide a computer readable storage medium, which stores computer executable instructions or computer programs. When the computer executable instructions or computer programs are executed by a processor, the processor will execute the color processing method of the virtual scene provided in the embodiments of the present application, for example, the color processing method of the virtual scene shown in Figure 3A .
[0184] In some embodiments, the computer readable storage medium can be a RAM, a ROM, a flash memory, a magnetic surface memory, an optical disc, or a CD-ROM memory, etc. The computer readable storage medium can also be various devices including one or any combination of the above-mentioned memories.
[0185] In some embodiments, the computer-executable instructions can take the form of programs, software, software modules, scripts, or code, written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages; and they can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0186] By way of example, a computer-executable instruction can take the form of a file in a file system, can be stored in a portion of a file that holds other programs or data, e.g., one or more scripts stored in a markup language document, in a single file dedicated to the program in question, or in multiple coordinated files, e.g., files that store one or more modules, sub programs, or portions of code.
[0187] By way of example, a computer-executable instruction can be deployed to be executed on one electronic device or on multiple electronic devices that are located at one site or that are distributed across multiple sites and that are interconnected by a communication network.
[0188] To sum up, through the embodiments of the present application, the following technical effects can be achieved at least:
[0189] The color information of the virtual scene in the color space is obtained, first space transformation processing is performed on the color information, and the luminance color information of the virtual scene in the luminance color space is obtained. The color information in the color space is converted into the luminance color space, so that only the luminance information in each position is adjusted, so that the color of the image is not affected in the process of adjusting the image luminance. The region to be color complementation in the virtual scene is determined. The region to be color complementation in the virtual scene is determined, so that only the determined region to be color complementation is processed in subsequent color complementation processing, and the entire image does not need to be processed, thereby saving the computing resources. The color complementation processing is performed on the region to be color complementation based on the luminance information in the luminance color information, and the color complementation luminance color information of the virtual scene in the luminance color space is obtained. The second space transformation processing is performed on the color complementation luminance color information, and the color complementation color information of the virtual scene in the color space is obtained. After the color complementation processing, the color complementation color information is converted into the color space, so that the virtual scene in the color space is finally obtained, so as to directly display the virtual scene or further process the virtual scene.
[0190] The above merely describes the embodiments of the present application, but is not used to limit the protection scope of the present application. Any modification, equivalent replacement, and improvement made within the spirit and scope of the present application shall be included in the protection scope of the present application.
Claims
1. A color processing method for a virtual scene, characterized in that, The method includes: Obtain the color information of the virtual scene in the color space; The color information is subjected to a first spatial transformation to obtain the luminance color information of the virtual scene in the luminance color space; Identify the area to be colored in the virtual scene; Based on the brightness information in the brightness color information, the area to be complemented is processed to obtain the complementary brightness color information of the virtual scene in the brightness color space; The complementary color brightness information is subjected to a second space transformation to obtain the complementary color information of the virtual scene in the color space.
2. The method according to claim 1, characterized in that, The step of performing a first spatial transformation on the color information to obtain the luminance and color information of the virtual scene in the luminance color space includes: Extract the first color matrix from the color information; The first spatial transformation matrix and the first color matrix are multiplied to obtain the second color matrix of the virtual scene in the luminance color space; The brightness and color information are determined based on the second color matrix.
3. The method according to claim 1, characterized in that, The step of performing a first spatial transformation on the color information to obtain the luminance and color information of the virtual scene in the luminance color space includes: The color information is encoded to obtain the first spherical harmonic coefficients corresponding to each color channel included in the color information; A first spatial transformation is performed on the first spherical harmonic coefficients corresponding to each color channel to obtain the second spherical harmonic coefficients in the luminance color space; Based on the second spherical harmonic coefficient, the luminance and color information of the virtual scene in the luminance color space are determined.
4. The method according to claim 3, characterized in that, The step of performing a first spatial transformation on the first spherical harmonic coefficients corresponding to each of the color channels to obtain the second spherical harmonic coefficients in the luminance color space includes: The first spherical harmonic coefficients corresponding to each of the color channels are combined to form a first spherical harmonic coefficient matrix; The first spatial transformation matrix and the first spherical harmonic coefficient matrix are multiplied to obtain the second spherical harmonic coefficient matrix in the brightness color space. Extract the second spherical harmonic coefficients in the luminance color space from the second spherical harmonic coefficient matrix.
5. The method according to claim 1, characterized in that, Determining the area to be colored in the virtual scene includes: Obtain the first spherical harmonic coefficient corresponding to each color channel included in the color information; Based on the first spherical harmonic coefficients corresponding to each color channel included in the color information, the brightest direction of the observation viewpoint in the virtual scene is determined. Obtain the opposite direction of the brightest direction from the observation perspective in the virtual scene as the complementary color direction; The region corresponding to the complementary color direction is obtained as the region to be complemented.
6. The method according to claim 1, characterized in that, The brightness information includes the second spherical harmonic coefficient of the brightness channel; determining the area to be complementary in the virtual scene includes: Based on the second spherical harmonic coefficient of the brightness channel, the brightest direction of the observation viewpoint in the virtual scene is determined; Obtain the opposite direction of the brightest direction from the observation perspective in the virtual scene as the complementary color direction; The region corresponding to the complementary color direction is obtained as the region to be complemented.
7. The method according to claim 6, characterized in that, The determination of the brightest direction of the observation viewpoint in the virtual scene based on the second spherical harmonic coefficient of the brightness channel includes: Determine the luminance value corresponding to each of the second spherical harmonic coefficients; Based on the brightness value corresponding to each of the second spherical harmonic coefficients, the brightness value of each direction of the observation viewpoint in the virtual scene is determined; The direction with the highest brightness value is taken as the brightest direction of the observation viewpoint in the virtual scene.
8. The method according to claim 6, characterized in that, The step of performing complementary color processing on the area to be complementary color based on the brightness information in the brightness color information to obtain the complementary brightness color information of the virtual scene in the brightness color space includes: Based on the brightness information in the brightness and color information, determine the first brightness value of the brightest direction; Obtain the complementary color brightness that is positively correlated with the complementary color threshold and the first brightness value; Based on the complementary color brightness, the area to be complementary color is processed to obtain the complementary color brightness information of the virtual scene in the brightness color space.
9. The method according to claim 1, characterized in that, The step of performing complementary color processing on the area to be complementary color based on the brightness information in the brightness color information to obtain the complementary brightness color information of the virtual scene in the brightness color space includes: When the brightness information in the brightness color information is negative, the area to be complementary color is processed to obtain the complementary brightness color information of the virtual scene in the brightness color space. The method further includes: When the brightness information in the brightness and color information is a non-negative value, the brightness and color information of the area to be complemented remains unchanged.
10. The method according to claim 1, characterized in that, The step of performing a second spatial transformation on the complementary color brightness information to obtain the complementary color information of the virtual scene in the color space includes: The complementary color brightness information is used to form a fourth color matrix; The second spatial transformation matrix and the fourth color matrix are multiplied together to obtain the complementary color information of the virtual scene in the color space.
11. A color processing device for a virtual scene, characterized in that, The device includes: The color acquisition module is used to acquire color information of the virtual scene in the color space; The first spatial transformation module is used to perform a first spatial transformation on the color information to obtain the brightness and color information of the virtual scene in the brightness color space; The region determination module is used to determine the region to be colored in the virtual scene; The complementary color processing module is used to perform complementary color processing on the area to be complementary color based on the brightness information in the brightness color information, so as to obtain the complementary brightness color information of the virtual scene in the brightness color space; The second spatial transformation module performs a second spatial transformation on the complementary color brightness information to obtain the complementary color information of the virtual scene in the color space.
12. An electronic device, characterized in that, The electronic device includes: Memory is used to store executable instructions for a computer; A processor, when executing computer-executable instructions stored in the memory, implements the color processing method for a virtual scene as described in any one of claims 1 to 10.
13. A computer-readable storage medium storing computer-executable instructions, characterized in that, When the computer-executable instructions are executed by the processor, they implement the color processing method for the virtual scene according to any one of claims 1 to 10.
14. A computer program product comprising computer-executable instructions, characterized in that, When the computer-executable instructions are executed by the processor, they implement the color processing method for the virtual scene according to any one of claims 1 to 10.