Illumination detection method and device, computer device and storage medium
By assigning different colors to different parts of the virtual object and segmenting the image frames, combined with the illumination detection model, the problem of inaccurate detection of illumination anomalies in virtual objects was solved, and the accurate positioning of abnormal parts was achieved, thus improving the detection accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TENCENT TECH (CHENGDU) CO LTD
- Filing Date
- 2024-12-05
- Publication Date
- 2026-06-05
AI Technical Summary
Existing technologies cannot accurately determine the parts of virtual objects with abnormal lighting in virtual scenes, resulting in insufficient accuracy in lighting anomaly detection.
By assigning different colors to different parts of the virtual object, the image frame is acquired and then divided into multiple sub-images. The illumination detection model is then used to perform illumination detection on each sub-image to obtain the illumination anomaly results for each part.
It enables precise location of abnormal lighting areas in virtual objects, improving the accuracy of lighting anomaly detection.
Smart Images

Figure CN122156441A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a light detection method, apparatus, computer device, and storage medium. Background Technology
[0002] There are many virtual light sources in a virtual scene. Virtual light sources can provide illumination for the virtual scene, and the display effect of virtual objects in the virtual scene will also be affected by the illumination. For example, the display effect of virtual objects will be different under different lighting conditions.
[0003] Virtual objects in virtual scenes also face the problem of abnormal lighting, so lighting detection is needed to determine whether there is an abnormality. Related technologies determine parameters such as brightness or contrast of pixels in the area where the virtual object is located, and compare them with thresholds to determine if there is an abnormality in lighting.
[0004] The above method can only determine which pixels have abnormal lighting, but it cannot accurately locate which parts of the virtual object are abnormal, and the detection of abnormal lighting is not precise enough. Summary of the Invention
[0005] This application provides a lighting detection method, apparatus, computer device, and storage medium, which can accurately pinpoint the location of lighting anomalies in virtual objects, thus improving the accuracy of lighting anomaly detection. The technical solution is as follows:
[0006] On the one hand, a light detection method is provided, the method comprising:
[0007] Adjust the colors of multiple parts of the virtual object, where the color of each part refers to the color that each part needs to present during light detection, and the colors of different parts are different;
[0008] Acquire an image frame, the image frame including the virtual object located in the illuminated area;
[0009] Based on the colors of the multiple parts, the image frame is divided into multiple sub-images, and each of the multiple sub-images corresponds to a part of the virtual object;
[0010] The illumination detection result of each sub-image is obtained, and the illumination detection result of each sub-image indicates whether the corresponding part of each sub-image has abnormal illumination.
[0011] On the other hand, a light detection device is provided, the device comprising:
[0012] An adjustment module is used to adjust the color of multiple parts of a virtual object. The color of each part refers to the color that each part needs to present during light detection, and the colors of different parts are different.
[0013] The first acquisition module is used to acquire an image frame, the image frame including the virtual object located in the illuminated area;
[0014] The segmentation module is used to segment the image frame into multiple sub-images based on the colors of the multiple parts, wherein each sub-image corresponds to a part of the virtual object;
[0015] The second acquisition module is used to acquire the illumination detection result of each sub-image, wherein the illumination detection result of each sub-image indicates whether the corresponding part of each sub-image has abnormal illumination.
[0016] Optionally, the adjustment module is used to:
[0017] Locate the part component corresponding to each part bound to the virtual object;
[0018] Adjust the color of the component corresponding to each part to the color of each part.
[0019] Optionally, the segmentation module is used for:
[0020] For the i-th part among the plurality of parts, a region in the image frame that has the same color as the i-th part is identified, and the identified region is determined as the sub-image corresponding to the i-th part; where i is a positive integer not greater than the number of the plurality of parts.
[0021] Optionally, the second acquisition module is used for:
[0022] The illumination detection results for each sub-image are obtained using the illumination detection model.
[0023] The illumination detection model is used to detect whether there is an illumination anomaly.
[0024] Optionally, the second acquisition module is used for:
[0025] For the i-th part among the plurality of parts, a lighting detection model corresponding to the i-th part is determined. The lighting detection model corresponding to the i-th part is used to detect whether the i-th part has abnormal lighting. Different parts among the plurality of parts have their own lighting detection models. Here, i is a positive integer not greater than the number of the plurality of parts.
[0026] The illumination detection result of the sub-image corresponding to the i-th part is obtained by using the illumination detection model corresponding to the i-th part.
[0027] Optionally, the second acquisition module is used for:
[0028] Extract the illumination features of the sub-image;
[0029] The illumination features of the sub-image are detected using the illumination detection model to obtain the illumination detection result of the sub-image.
[0030] Optionally, the second acquisition module is used for:
[0031] Based on the pixel values of multiple pixels in the sub-image, the multiple pixels in the sub-image are clustered to obtain multiple pixel sets, and each pixel set in the multiple pixel sets includes at least one central pixel.
[0032] The illumination features of the sub-image are determined based on the number of pixels in each set of pixels.
[0033] Optionally, the second acquisition module is used for:
[0034] Determine the vector features formed by the number of pixels in each set of pixels;
[0035] The vector features are normalized to obtain the illumination features of the sub-image.
[0036] Optionally, the device further includes a training module for:
[0037] Obtain sample sub-images and sample labels corresponding to the parts of the virtual object. The color of the part in the sample sub-image is the color that the part needs to present during illumination detection. The sample label indicates whether the part is under abnormal illumination.
[0038] The illumination detection results of the sample sub-image are obtained through the illumination detection model.
[0039] The illumination detection model is trained based on the illumination detection results of the sample sub-images and the sample labels.
[0040] On the other hand, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to perform the operations performed by the illumination detection method as described above.
[0041] On the other hand, a computer-readable storage medium is provided, wherein at least one computer program is stored therein, the at least one computer program being loaded and executed by a processor to perform the operations performed by the illumination detection method as described above.
[0042] On the other hand, a computer program product is provided, including a computer program loaded and executed by a processor to perform the operations performed by the illumination detection method as described above.
[0043] The solution provided in this application, when performing illumination detection on a virtual object, assigns different colors to different parts of the virtual object. After obtaining the image of the virtual object, the sub-images corresponding to each part can be segmented in the image based on the colors corresponding to different parts. Illumination detection is then performed on the sub-images corresponding to different parts to obtain the illumination detection results for each part and identify the parts with abnormal illumination. Therefore, it is possible to accurately pinpoint which part of the virtual object has an abnormal illumination problem, thus improving the accuracy of illumination anomaly detection. Attached Figure Description
[0044] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0045] Figure 1 This is a schematic diagram of a computer system provided in an embodiment of this application;
[0046] Figure 2 This is a flowchart of a light detection method provided in an embodiment of this application;
[0047] Figure 3 This is a flowchart of another illumination detection method provided in the embodiments of this application;
[0048] Figure 4 This is a schematic diagram of an image frame provided in an embodiment of this application;
[0049] Figure 5 This is a schematic diagram of another image frame provided in an embodiment of this application;
[0050] Figure 6 This is a flowchart of a training method for an illumination detection model provided in an embodiment of this application;
[0051] Figure 7 This is a flowchart of another illumination detection method provided in the embodiments of this application;
[0052] Figure 8 This is a flowchart of another illumination detection method provided in the embodiments of this application;
[0053] Figure 9 This is a schematic diagram of a game scene image provided in an embodiment of this application;
[0054] Figure 10 This is a schematic diagram of the structure of a light detection device provided in an embodiment of this application;
[0055] Figure 11 This is a schematic diagram of another light detection device provided in the embodiments of this application;
[0056] Figure 12 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application;
[0057] Figure 13 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation
[0058] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0059] It is understood that the terms “first,” “second,” etc., used in this application may be used to describe various concepts herein, but unless otherwise stated, these concepts are not limited by these terms. These terms are used only to distinguish one concept from another.
[0060] "At least one" refers to one or more parts. For example, at least one part can be one part, two parts, three parts, or any integer number of parts greater than or equal to one. "Multiple" refers to two or more parts. For example, multiple parts can be two parts, three parts, or any integer number of parts greater than or equal to two. "Each" refers to each of the at least one parts. For example, each part refers to each of the multiple parts. If the multiple parts are three parts, then each part refers to each of the three parts.
[0061] It should be noted that all information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals (including but not limited to signals transmitted between the user terminal and other devices) involved in this application have been fully authorized by the user or relevant parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the virtual objects and image frames involved in this disclosure were obtained under full authorization.
[0062] The illumination detection method provided in this application can be used in computer devices. Optionally, the computer device is a terminal or a server. Optionally, the server is 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 communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the terminal is a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, smart voice interaction device, smart home appliance, vehicle terminal, aircraft, etc., but is not limited to these. This application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving.
[0063] Figure 1 This is a schematic diagram of a computer system provided in an embodiment of this application. See also... Figure 1 The computer system includes a terminal 101 and a server 102. The terminal 101 and the server 102 are connected via a wireless or wired network.
[0064] Terminal 101 has at least one client installed and running. The client can be a game client, social application client, online payment client, online shopping client, medical service client, video client, etc. When terminal 101 runs a client, the client's user interface is displayed on the screen of terminal 101. Terminal 101 is the terminal used by user 121.
[0065] Optionally, terminal 101 may refer to one of a number of terminals, including: smartphones, tablets, laptops, desktop computers, smart voice interaction devices, smart home appliances, in-vehicle terminals, aircraft, VR (Virtual Reality) devices, AR (Augmented Reality) devices, etc., but not limited to these.
[0066] Those skilled in the art will understand that the number of terminals described above can be more or less. For example, there may be only one terminal, or there may be six, eight, or more terminals. This application does not limit the number of terminals or the type of device.
[0067] Figure 1Only one terminal is shown in the diagram, but in different embodiments, multiple other terminals 103 can access the server 102. Optionally, one or more terminals 103 may also be terminals corresponding to developers, on which a client development and editing platform is installed. Developers can edit and update the client on the terminal 103 and transmit the updated client installation package to the server 102 via wired or wireless network. Terminal 101 can download the client installation package from the server 102 to update the client.
[0068] Terminal 101 and other terminals 103 are connected to server 102 via wired or wireless networks.
[0069] Server 102 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. Server 102 is used to provide backend services to clients. Optionally, server 102 undertakes the primary computing work, and terminal 101 undertakes the secondary computing work; or, server 102 undertakes the secondary computing work, and terminal 101 undertakes the primary computing work; or, server 102 and terminal 101 collaborate on computing using a distributed computing architecture.
[0070] In one possible implementation, terminal 101 runs a client that includes a rendering engine, such as Unity3D or Unreal Engine. The client provides a virtual object, adjusts the colors of multiple parts of the virtual object using the rendering engine, and renders the virtual object to the illuminated area, thereby obtaining a rendered image frame. Terminal 101 sends the image frame to server 102, which then segments the image frame into sub-images corresponding to each part of the virtual object and obtains the illumination detection results for each sub-image.
[0071] It should be noted that the above implementation environment is only an example. The method provided in this application embodiment can also be executed by the terminal 101 alone, or by other computer devices. This application embodiment does not limit this.
[0072] Figure 2 This is a flowchart of a light detection method provided in an embodiment of this application. This embodiment is executed by a computer device. See also... Figure 2 The method includes:
[0073] 201. The computer device adjusts the color of multiple parts of a virtual object. The color of each part refers to the color that each part needs to present during light detection. Different parts of the multiple parts have different colors.
[0074] A virtual object refers to any object. It can be an active object, such as a virtual character, animal, or cartoon character; for example, it can be a virtual avatar representing the user. It can also be a passive object, such as a plant, oil drum, stone, or house.
[0075] Optionally, the virtual object resides in a virtual scene, and each virtual object has its own shape and volume within the virtual scene, occupying a portion of the space in the virtual scene. Optionally, when the virtual scene is a three-dimensional virtual scene, the virtual object can be a three-dimensional model, such as a three-dimensional character constructed based on three-dimensional human skeleton technology. The same virtual object can display different appearances by wearing different skins. In some embodiments, the virtual object can also be implemented using a 2.5D or 2D model, and this application embodiment does not limit this.
[0076] Virtual objects typically have multiple parts, which refer to a specific area of the virtual object. For example, if the virtual object is a virtual character, it can be divided into multiple parts based on the human anatomy of the virtual character, including the head, limbs, and torso. Similarly, if the virtual object is a virtual plant, it can be divided into multiple parts based on the plant's structure, including the stem, leaves, and flowers.
[0077] In this embodiment, each part of the virtual object has its own color. However, when lighting detection is required, the colors of each part of the virtual object are adjusted to the colors required for lighting detection. That is, each part of the virtual object has two colors: one is the color displayed normally, and the other is the color required for lighting detection. For example, taking a virtual character as an example, the head of the virtual character is black when displayed normally, but orange is required for lighting detection. Therefore, the color of the virtual character's head needs to be adjusted from black to orange.
[0078] In this embodiment of the application, the purpose of readjusting the colors of multiple parts of the virtual object during illumination detection is to ensure that the colors of each part of the virtual object are different, so as to distinguish the different parts of the virtual object in the future.
[0079] 202. A computer device acquires an image frame, which includes a virtual object located in a lit area.
[0080] After adjusting the colors of multiple parts of the virtual object, the computer device renders the virtual object to the illuminated area and captures an image frame of the virtual object. Therefore, in the captured image frame, the virtual object is located in the illuminated area, and the colors of multiple parts of the virtual object are the adjusted colors, that is, the colors of multiple parts of the virtual object are different.
[0081] 203. The computer device divides the image frame into multiple sub-images based on the color of multiple parts, and each sub-image in the multiple sub-images corresponds to a part of the virtual object.
[0082] Since each part has its own unique color, and these colors are all different, different parts in an image frame will have different colors, while the same part will have the same color. In other words, pixels belonging to the same part in an image frame will have the same color, while pixels belonging to different parts will have different colors. Therefore, based on the colors of multiple parts, we can determine which region of the image frame each part falls within, thus dividing the image frame into multiple sub-images. Each sub-image corresponds to a part of the virtual object. The sub-image corresponding to any part includes the portion of the image frame containing that part, but excludes the portions containing other parts, thereby distinguishing the multiple parts of the virtual object.
[0083] For example, taking a virtual character as an example, the parts of a virtual character include the head, limbs, and torso. A computer device can divide an image frame into a head sub-image, a limbs sub-image, and a torso sub-image. The head sub-image only includes the part of the image frame where the virtual character's head is located, the limbs sub-image only includes the part of the image frame where the virtual character's limbs are located, and the torso sub-image only includes the part of the image frame where the virtual character's torso is located.
[0084] 204. The computer equipment acquires the illumination detection results of each sub-image. The illumination detection results of each sub-image indicate whether the corresponding part of each sub-image has abnormal illumination.
[0085] For each sub-image, the computer device acquires the lighting detection result for that sub-image, which indicates whether the corresponding part of the sub-image has abnormal lighting. Taking the head sub-image as an example, the lighting detection result for the head sub-image indicates whether the virtual character's head has abnormal lighting.
[0086] The method provided in this application, when performing illumination detection on a virtual object, assigns different colors to different parts of the virtual object. After obtaining the image of the virtual object, the sub-images corresponding to each part can be segmented in the image based on the colors corresponding to different parts. Illumination detection is then performed on the sub-images corresponding to different parts to obtain the illumination detection results for each part and identify the parts with abnormal illumination. Therefore, it can accurately pinpoint which part of the virtual object has an abnormal illumination problem, improving the accuracy of illumination anomaly detection.
[0087] The above Figure 2 The diagram shown is only the basic process of this application. The following is a further explanation of the solution provided in this application based on a specific implementation method. Figure 3 This is a flowchart of another illumination detection method provided in this application embodiment. This application embodiment is executed by a computer device. See also... Figure 3 The method includes:
[0088] 301. Computer equipment adjusts the color of multiple parts of a virtual object. The color of each part refers to the color that each part needs to present during light detection. Different parts have different colors.
[0089] Each part of the virtual object has its own color, which can be called the original color. The color that each part needs to display during lighting detection can be called the annotation color. Step 301 is that, in response to the lighting detection command, for each part of the virtual object, the color of that part is adjusted from its original color to its annotation color. The original colors of different parts can be the same or different, and the annotation colors of different parts can be different, so that different parts of the virtual object can be distinguished during lighting detection.
[0090] In one possible implementation, a client runs on the computer device, providing a virtual scene, and the virtual object is a virtual object within that virtual scene. The virtual scene is displayed (or provided) by the client while running on the computer device. This virtual scene can be a simulation of the real world, a semi-simulated / semi-fictional environment, or a purely fictional environment. The virtual scene can be any of a two-dimensional, 2.5-dimensional, or three-dimensional virtual scene; this application embodiment does not limit the dimension of the virtual scene. For example, the virtual scene may include sky, land, ocean, etc., and the land may include environmental elements such as deserts and cities. Optionally, the user can control the virtual object to move within the virtual scene. Optionally, the virtual scene can provide a battle environment for the virtual object, containing virtual resources available for the virtual object to use, such as virtual items needed for battle, virtual medicines needed for treatment, and virtual items needed for upgrades.
[0091] In one possible implementation, the computer device locates the part component corresponding to each part bound to the virtual object; and adjusts the color of the part component corresponding to each part to the color of each part.
[0092] Different parts of a virtual object are bound to different part components. These part components not only represent different parts of the virtual object, but also carry attributes such as material, texture, and color. By adjusting the attributes of the part components, the appearance of each part of the virtual object can be controlled independently. Adjusting the color of the part component corresponding to each part means setting the color of each part of the virtual object separately.
[0093] Optionally, a client runs on the computer device. The virtual object is the virtual object displayed on the client. The client includes a rendering engine, which includes SDK (Software Development Kit) plugin code. This SDK plugin code is used to adjust the colors of multiple parts of the virtual object. By running the SDK plugin code, the virtual object to be subjected to lighting detection is determined. Multiple parts of the virtual object are traversed. For each part, the part component bound to that part is determined, the color of that part is determined, and the color attribute of the part component is modified to match the color of that part.
[0094] For example, if a virtual object has multiple parts, including a head and limbs, and the head is yellow and the limbs are red, then the color attribute of the head component bound to the head is set to yellow, and the color attribute of the limb component bound to the limbs is set to red, thus adjusting the different parts of the virtual object to different colors.
[0095] In this implementation, by binding each part of the virtual object to a corresponding part component, it is beneficial to quickly and accurately locate each part of the virtual object, thus improving the efficiency of color adjustment. Furthermore, since different parts have their own part components, it is possible to perform independent color adjustments for different parts, thereby distinguishing different parts of the virtual object by differentiating their colors.
[0096] Furthermore, by binding part components to virtual objects, it is easy to dynamically modify the color of virtual objects during game operation, which is beneficial for adapting to the lighting detection scheme for virtual objects in this application.
[0097] 302. A computer device acquires an image frame, which includes a virtual object located in a lit area.
[0098] In one possible implementation, the virtual object is a virtual object within a virtual scene, which contains a virtual light source. The illuminated area is the region generated within the virtual scene under the illumination of the virtual light source. The purpose of this embodiment is to detect whether there is abnormal lighting when the virtual object is located within the illuminated area. Therefore, after adjusting the colors of multiple parts of the virtual object, the computer device renders the virtual object onto the illuminated area in the virtual scene and captures an image frame of the virtual object. In the captured image frame, the virtual object is located within the illuminated area, and the colors of multiple parts of the virtual object are the adjusted colors, meaning that the colors of multiple parts of the virtual object are different.
[0099] In one possible implementation, a client runs on the computer device, and the virtual object is the virtual object displayed on the client. The client includes a rendering engine, which includes a scene capture component for capturing the rendering results of the rendering engine. The computer device renders the virtual object to the illuminated area through the rendering engine and captures image frames of the virtual object through the scene capture component.
[0100] Optionally, the scene capture component has attributes such as capture position, capture viewpoint, capture range, and post-processing. The capture position refers to the location where the image frame is captured, and the capture viewpoint refers to the perspective from which the image frame is captured. For example, the capture position of the scene capture component can be set to the position of the virtual camera in the virtual scene, and the capture viewpoint can be set to the shooting perspective of the virtual camera in the virtual scene. The capture range refers to the content to be presented when the scene capture component captures the image frame. For example, setting the capture range to multiple parts of the virtual object ensures that the captured image frame only includes multiple parts of the virtual object and not other content in the virtual scene. Post-processing refers to color correction and other processing on the captured image frame. Since the captured image frame in this application is used for illumination detection, the post-processing attribute of the scene capture component can be turned off, meaning that no post-processing is performed on the captured image frame, ensuring that subsequent image frame segmentation is not interfered with by post-processing. After setting all the attributes of the scene capture component, the image capture interface of the scene capture component can be called to capture image frames including virtual objects.
[0101] As mentioned above, since the colors of multiple parts of the virtual object are adjusted and the properties of the scene capture component are adjusted during the lighting detection, the image frame captured when the virtual object is displayed normally in the client is different from the image frame captured during the lighting detection in step 302. Figure 4 This is a schematic diagram of an image frame provided in an embodiment of this application. Figure 4 The image frame shown is a screenshot taken when the virtual object is displayed normally in the client. The lighting of the virtual object in this image frame is abnormal. Under normal lighting conditions, the head of the virtual object is black, but under abnormal lighting conditions, the head of the virtual object turns white. Figure 5 This is a schematic diagram of another image frame provided in an embodiment of this application. Figure 5 The displayed image frames are those captured during illumination detection, where the blue areas correspond to the body parts of the virtual object and the orange areas correspond to the hair parts of the virtual object.
[0102] 303. The computer device divides the image frame into multiple sub-images based on the color of multiple parts, and each sub-image in the multiple sub-images corresponds to a part of the virtual object.
[0103] Since each part has its own color, and the colors of each part are different, the region in the image frame where each part is located can be determined based on the colors of multiple parts. This allows the image frame to be divided into multiple sub-images, with each sub-image corresponding to a part of the virtual object.
[0104] In one possible implementation, for the i-th part among multiple parts, the computer device identifies a region in the image frame that has the same color as the i-th part, and determines the identified region as the sub-image corresponding to the i-th part; where i is a positive integer not greater than the number of multiple parts.
[0105] For example, if the i-th part is the hair part and the color of the hair part is orange, then the orange area in the image frame is segmented to obtain a sub-image, which is the sub-image corresponding to the hair part.
[0106] In this implementation, by identifying regions in the image frame that match the color of the part, the region corresponding to each part can be accurately distinguished. Therefore, this accurate segmentation method can better segment the regions corresponding to different parts, avoid errors and overlaps, and help improve the accuracy of the sub-images corresponding to each segmented part.
[0107] 304. The computer equipment obtains the illumination detection results of each sub-image through the illumination detection model. The illumination detection results of each sub-image indicate whether the corresponding part of each sub-image has abnormal illumination.
[0108] A lighting detection model is used to detect abnormal lighting conditions. This model can be an artificial intelligence model, such as a machine learning model or a deep learning model. Optionally, the lighting detection model includes a CNN (Convolutional Neural Network). Optionally, the lighting detection model can be an SVM (Support Vector Machine). The training process of this lighting detection model can be found below. Figure 6 Examples of implementations.
[0109] In this embodiment, the illumination detection results of each sub-image are obtained through an illumination detection model. Since the illumination detection model usually has a fast processing speed, it can quickly complete the illumination detection, enabling the illumination detection results to be obtained quickly in scenarios with high real-time requirements, such as games or videos.
[0110] In one possible implementation, the illumination detection model is a binary classification model, and the illumination detection result is a binary classification result, such as a first value or a second value. If the illumination detection result of the sub-image is the first value, it indicates that the corresponding part of the sub-image has normal illumination; if the illumination detection result of the sub-image is the second value, it indicates that the corresponding part of the sub-image has abnormal illumination. In another possible implementation, the illumination detection result is a probability value between 0 and 1. This probability value in the illumination detection result of the sub-image represents the probability that the corresponding part of the sub-image has abnormal illumination, or it represents the probability that the corresponding part of the sub-image has normal illumination. In this embodiment, the form of the illumination detection result is not limited.
[0111] In one possible implementation, for the i-th part among multiple parts, a lighting detection model corresponding to the i-th part is determined. The lighting detection model corresponding to the i-th part is used to detect whether the i-th part has abnormal lighting. Different parts among the multiple parts have their own lighting detection models. Here, i is a positive integer not greater than the number of multiple parts. The lighting detection result of the sub-image corresponding to the i-th part is obtained through the lighting detection model corresponding to the i-th part.
[0112] For example, taking a virtual object including hair and body parts as an example, the computer device determines the lighting detection model corresponding to the hair part, and obtains the lighting detection result of the sub-image corresponding to the hair part using the lighting detection model. The computer device determines the lighting detection model corresponding to the body part, and obtains the lighting detection result of the sub-image corresponding to the body part.
[0113] In this implementation, since different parts of the virtual object have different colors, a dedicated lighting detection model is set for each part. This allows for more accurate detection of the lighting state of different parts, avoiding the inability of a general lighting detection model to identify subtle differences between parts, thus improving the accuracy of lighting detection. Furthermore, in complex lighting environments, different parts may be affected by lighting from different directions and intensities. Using a part-specific lighting detection model can better adapt to various lighting conditions, eliminating the need to use a single model to handle multiple situations, further improving the accuracy of lighting detection.
[0114] In one possible implementation, for each sub-image, the computer device inputs the sub-image into a lighting detection model, which processes the sub-image and outputs the lighting detection result for that sub-image. That is, the lighting detection result is obtained by processing the sub-image.
[0115] In one possible implementation, step 304 includes steps 3041-3043.
[0116] 3041. Extract the illumination features of the sub-image.
[0117] For any sub-image, the computer device extracts the illumination features of that sub-image. The illumination features of a sub-image represent illumination-related information within the sub-image, reflecting the illumination conditions and distribution within the sub-image. They can be used to describe bright and dark areas, light source direction, light intensity, or shadow positions, etc., and can help understand the specific effects of lighting in the image. For example, the illumination features can be matrix features or vector features, etc., and this application does not limit the specific form of the illumination features.
[0118] Optionally, the computer device clusters multiple pixels in the sub-image based on the pixel values of multiple pixels in the sub-image to obtain multiple pixel sets, each of the multiple pixel sets including at least one central pixel; and determines the illumination features of the sub-image based on the number of pixels in each pixel set.
[0119] The purpose of clustering multiple pixels is to group pixels with similar values into the same set of pixels. In other words, pixels within the same set have closer values, while pixels in different sets have greater differences in value. The central pixel in a set of pixels is called the cluster center.
[0120] For example, the computer device uses the K-means clustering algorithm to cluster multiple pixels based on their pixel values, resulting in multiple pixel sets. The computer device determines the number of clusters K, where K represents the desired number of pixel sets. K initial center pixels are randomly initialized from among the pixels. The difference between the pixel value of each pixel and the pixel values of all initial center pixels is determined. Pixels are assigned to the pixel set containing the initial center pixel with the smallest difference. For each pixel set, the average pixel value of all pixels in that set is calculated, and the pixel closest to this average pixel value is selected as the new center pixel. This assignment and update process is iterated until the center pixel no longer changes significantly or the maximum number of iterations is reached. After iteration, all pixels will be assigned to K different pixel sets, resulting in K pixel sets. For example, K can be equal to 300.
[0121] For example, the pixel value of a pixel can be an RGB (Red-Green-Blue) value.
[0122] Optionally, the computer device determines the illumination features of the sub-image based on the number of pixels in each pixel set, including: determining the vector features formed by the number of pixels in each pixel set; and normalizing the vector features to obtain the illumination features of the sub-image.
[0123] For example, if a set of pixels contains 300 pixels, the number of pixels in each set is determined. This count of pixels across the 300 sets forms a vector feature, resulting in a 300-dimensional vector feature. This 300-dimensional vector feature is then normalized to obtain the illumination feature. The values in the normalized illumination feature are all between 0 and 1. For example, a computer device normalizes the vector feature by dividing the value of each dimension by the total number of pixels in that sub-image.
[0124] In this implementation, by clustering pixels, regions with similar illumination in a sub-image can be identified, effectively capturing the distribution characteristics of illumination on the sub-image. This helps the illumination detection model more accurately understand the illumination situation of the sub-image. Furthermore, clustering pixels with similar illumination reduces noise interference in the sub-image while preserving key illumination information. This approach reduces reliance on individual pixels and improves the stability of feature extraction. Moreover, the illumination features obtained after clustering represent the overall illumination characteristics of the sub-image, reducing the amount of data that the illumination detection model needs to process, thus improving illumination detection efficiency and making it more suitable for real-time detection scenarios.
[0125] Furthermore, by transforming the number of pixels in each pixel set into vector features, the overall illumination distribution of the sub-image can be concisely represented, making the expression of illumination information both simple and rich. Moreover, normalization ensures that the illumination features have a consistent value range; therefore, the normalized illumination features are unaffected by the size of the sub-image, making the illumination detection model more adaptable to illumination detection of sub-images of different sizes, thus helping to ensure the accuracy of illumination detection.
[0126] 3042. Using the illumination detection model, detect the illumination features of the sub-image to obtain the illumination detection results of the sub-image.
[0127] For each sub-image, after the computer device acquires the illumination features of that sub-image, it inputs these features into the illumination detection model. The illumination detection model processes these features and outputs the illumination detection result for that sub-image. In other words, the illumination detection result is obtained by processing the illumination features of the sub-image.
[0128] In this implementation, the illumination features of the sub-images are first extracted. The illumination detection model then performs illumination detection based on these features, enabling it to analyze illumination-related information in the sub-images more meticulously, thus improving the accuracy of illumination detection. Furthermore, by providing only the illumination features to the illumination detection model, it focuses solely on these features, effectively avoiding the influence of other image features unrelated to illumination. This reduces interference with the illumination detection process and results in more accurate illumination detection results.
[0129] The method provided in this application, when performing illumination detection on a virtual object, assigns different colors to different parts of the virtual object. After obtaining the image of the virtual object, the sub-images corresponding to each part can be segmented in the image based on the colors corresponding to different parts. Illumination detection is then performed on the sub-images corresponding to different parts to obtain the illumination detection results for each part and identify the parts with abnormal illumination. Therefore, it can accurately pinpoint which part of the virtual object has an abnormal illumination problem, improving the accuracy of illumination anomaly detection.
[0130] The following examples illustrate the training process of the illumination detection model. Figure 6 This is a flowchart illustrating a training method for an illumination detection model provided in an embodiment of this application. This embodiment is executed by a computer device. See also... Figure 6 The method includes:
[0131] 601. The computer device acquires sample sub-images and sample labels corresponding to parts of a virtual object. The color of the part in the sample sub-image is the color that the part needs to present during illumination detection, and the sample label indicates whether the part is under abnormal illumination.
[0132] The sample sub-image corresponding to the part includes that part of the virtual object. The sample sub-image and its corresponding sample label can be either a positive sample or a negative sample. If the sample label corresponding to the sample sub-image indicates that the lighting of the part is normal, then the sample sub-image and its sample label are positive samples. If the sample label corresponding to the sample sub-image indicates that the lighting of the part is abnormal, then the sample sub-image and its sample label are negative samples.
[0133] In one possible implementation, the computer device adjusts the colors of multiple parts of a virtual object to the colors required for each part during illumination detection, with different parts having different colors. The computer device acquires a sample image frame, which includes the virtual object located in the illuminated area, and segments the image frame into multiple sample sub-images corresponding to the various parts based on their colors. Figure 6 In step 601 of the embodiment, the color that the part needs to display during light detection is the same as described above. Figure 3In step 301 of the embodiment, the color required for the region to appear during illumination detection is the same. The process of obtaining the sample sub-image corresponding to the region in step 301 is the same as the process of obtaining the sub-image corresponding to the region in steps 301-303 above, and will not be described in detail here.
[0134] In one possible implementation, the illumination detection model trained in this embodiment is used to perform illumination detection on a sub-image corresponding to any part of the virtual object. That is, the illumination detection model is applicable to multiple parts, so the sample sub-images in step 601 include sample sub-images corresponding to multiple parts of the virtual object. In another possible implementation, the illumination detection model trained in this embodiment is used to perform illumination detection on a sub-image corresponding to one part of the virtual object. That is, the illumination detection model is only applicable to one part and is a dedicated model for a specific part. In this case, the sample sub-images in step 601 only include the sample sub-images corresponding to that part of the virtual object and do not include sample sub-images corresponding to other parts.
[0135] It should be noted that, Figure 6 The virtual objects in the embodiments are the same as those described above. Figure 3 In the embodiments, the virtual objects can be the same virtual object or different virtual objects, as long as the color required to be presented by the part is the same during light detection.
[0136] 602. The computer equipment obtains the illumination detection results of the sample sub-images through the illumination detection model.
[0137] The illumination detection result of each sample sub-image indicates whether the corresponding part of each sample sub-image has abnormal illumination.
[0138] In one possible implementation, the computer device inputs the sample sub-image into a lighting detection model, which processes the sample sub-image and outputs the lighting detection result for the sample sub-image. In another possible implementation, the computer device extracts the lighting features of the sample sub-image, inputs these features into a lighting detection model, processes the lighting features, and outputs the lighting detection result for the sample sub-image.
[0139] The process of obtaining the illumination detection results of the sample sub-image in step 602 is the same as the process of obtaining the illumination detection results of the sub-image in step 304 above, and will not be described in detail here.
[0140] 603. The computer equipment trains the illumination detection model based on the illumination detection results and sample labels of the sample sub-images.
[0141] In this embodiment, the illumination detection result is obtained through an illumination detection model, and the sample label is a true result reflecting whether the illumination is abnormal. If the illumination detection model is accurate enough, the illumination detection result should be sufficiently close to the sample label. Therefore, the computer device trains the illumination detection model based on the illumination detection result and the sample label to increase the similarity between the illumination detection result obtained by the trained illumination detection model and the sample label, that is, to reduce the difference between the obtained illumination detection result and the sample label, thereby improving the processing capability of the illumination detection model and thus improving the accuracy of the illumination detection model.
[0142] In one possible implementation, the computer device determines a loss parameter based on the difference between the illumination detection result and the sample label, and this loss parameter is positively correlated with the difference. Based on this loss parameter, the computer device trains an illumination detection model to reduce the loss parameter obtained from the trained illumination detection model, thereby obtaining a more accurate illumination detection model.
[0143] In one possible implementation, to train the illumination detection model, a computer device acquires multiple sample sub-images and their corresponding sample labels as a sample dataset. The process based on this sample dataset includes multiple iterations, with training performed on one or more sample sub-images and their corresponding sample labels in each iteration. It should be noted that steps 501-504 in this embodiment are illustrated using only one iteration as an example.
[0144] For example, the computer device repeats steps 601-603 above to iteratively train the illumination detection model. Training of the illumination detection model stops when the first threshold is reached in the current iteration; or, training stops when the loss parameter obtained in the current iteration is not greater than a second threshold. The first and second thresholds are arbitrary values, for example, the first threshold is 1000 or 1500, and the second threshold is 0.004 or 0.003.
[0145] The method provided in this application, through comparative training based on the illumination detection results and labels of sample sub-images, enables the illumination detection model to quickly find the differences between the illumination detection results and the actual labels, optimize the detection logic, thereby efficiently learning illumination detection and improving the accuracy of illumination detection.
[0146] Furthermore, the color of the part being trained is consistent with the color required for the part during illumination detection. This effectively avoids interference from color differences during model training and model use, allowing the illumination detection model to focus more on detecting illumination anomalies and improving the accuracy of illumination detection.
[0147] Figure 7 This is a flowchart of another illumination detection method provided in the embodiments of this application, such as... Figure 7 As shown, the method includes the following steps.
[0148] (1) Traverse the parts components bound to the virtual object. The virtual object is bound to multiple parts components, such as hair components and skin components. Based on the name of the part, find the part component corresponding to each part.
[0149] (2) Adjust the part components of the virtual object to the annotation color. The annotation color refers to the color that the part needs to appear in during illumination detection. Different parts correspond to different annotation colors. The purpose of adjusting the part components to the annotation color is to make different parts of the virtual object appear in different colors so that the sub-images corresponding to different parts can be segmented later.
[0150] (3) Capture image frames based on the scene capture component, divide the image frames into sub-images corresponding to each part, and create a scene capture based on the game interface.
[0151] (4) Extract the illumination features of the sub-image.
[0152] (5) Training the illumination detection model. The computer device collects positive samples of virtual objects with normal illumination and negative samples with abnormal illumination, and trains the illumination detection model based on the positive and negative samples.
[0153] (6) The illumination features of the sub-image are detected by the illumination detection model to obtain the illumination detection results.
[0154] In the illumination detection process, sub-images corresponding to different parts of the virtual object are first obtained through steps (1), (2), and (3) above. Then, the illumination features of the sub-images are extracted through step (4). The illumination features of the sub-images are used as input to the illumination detection model trained in step (5) to obtain the output illumination detection results.
[0155] In related technologies, the brightness or contrast of an image frame is determined by comparing it to a preset threshold to identify whether a virtual object in the image frame has lighting anomalies. However, this method is prone to misjudging dynamic objects and changes in lighting within the virtual scene. Furthermore, because it is difficult to distinguish different parts of a virtual object on an image frame, it is difficult to accurately locate areas with lighting anomalies.
[0156] In this embodiment, different colors are assigned to different parts during illumination detection. Therefore, different parts of the image frame can be accurately distinguished based on color, enabling precise segmentation of sub-images corresponding to different parts. This improves the accuracy of illumination anomaly detection and exhibits good robustness against dynamic objects. Furthermore, since this embodiment directly segments the sub-images corresponding to different parts, the trained illumination detection model has strong versatility, eliminating the need for additional training of models for segmenting different parts and enhancing the general applicability of the solution in this embodiment.
[0157] The lighting detection method provided in this application can be applied to any scenario where it is necessary to detect whether the lighting of virtual objects is abnormal. For example, in a video game scenario, it can detect whether the lighting of game characters in a virtual scene is abnormal. If the lighting of game characters in a virtual scene is abnormal, it will affect the game scene image. Figure 8 This is a schematic diagram of a game scene image provided in an embodiment of this application. Figure 8 The game scene images shown are frames captured when the game character is displayed normally in the game client. The lighting of the game character in the game scene image is abnormal. Under normal lighting conditions, the upper body of the game character's clothes is red, but under abnormal lighting conditions, the upper body of the game character's clothes turns black.
[0158] For a detailed explanation of the lighting detection process for game characters in a virtual scene, please refer to the following: Figure 9 Examples of implementations. Figure 9 This is a flowchart of another illumination detection method provided in the embodiments of this application, executed by a computer device. See also... Figure 9 The method includes the following steps.
[0159] 901. Computer equipment identifies the game character to be detected in the virtual scene.
[0160] 902. The computer equipment adjusts the colors of multiple parts on the game character to the corresponding labeled colors. The labeled color of each part refers to the color that each part needs to appear when the light is detected. The labeled colors of different parts are different.
[0161] 903. The computer equipment uses a rendering engine to render the color-adjusted game character onto the illuminated area of the virtual scene, and captures the rendered game scene image, which includes virtual objects located in the illuminated area.
[0162] It should be noted that the game scene image in step 903 is captured by the scene capture component in the rendering engine. The game scene image only includes the game character located in the lighting area of the virtual scene, and does not include other content in the virtual scene.
[0163] 904. The computer device divides the game scene image into multiple sub-images based on the color markings of multiple parts, and each sub-image corresponds to a part of the game character.
[0164] 905. The computer equipment acquires the illumination detection results of each sub-image, and the illumination detection results of each sub-image indicate whether the corresponding part of each sub-image has abnormal illumination.
[0165] This application proposes a scheme for detecting lighting anomalies in game characters based on part segmentation. By segmenting different parts of the game character, the scheme solves the problem of automatically identifying lighting anomalies in game characters in video games. It eliminates the need for manual detection, improves the efficiency of game testing, enhances the quality of the game experience, and increases the accuracy of detecting lighting anomalies in game characters.
[0166] Figure 10 This is a schematic diagram of the structure of a light detection device provided in an embodiment of this application. See also... Figure 10 The device includes:
[0167] The adjustment module 1001 is used to adjust the color of multiple parts of a virtual object. The color of each part refers to the color that each part needs to present during light detection. The colors of different parts are different.
[0168] The first acquisition module 1002 is used to acquire an image frame, the image frame including a virtual object located in the illuminated area;
[0169] The segmentation module 1003 is used to segment an image frame into multiple sub-images based on the colors of multiple parts, and each sub-image in the multiple sub-images corresponds to a part of the virtual object;
[0170] The second acquisition module 1004 is used to acquire the illumination detection result of each sub-image, and the illumination detection result of each sub-image indicates whether the corresponding part of each sub-image has abnormal illumination.
[0171] The illumination detection device provided in this application assigns different colors to different parts of a virtual object when performing illumination detection on the virtual object. After acquiring the image of the virtual object, the device can segment the image into sub-images corresponding to each part based on the colors corresponding to different parts. Then, illumination detection is performed on the sub-images corresponding to different parts to obtain the illumination detection results for each part and identify the parts with abnormal illumination. Therefore, it can accurately pinpoint which part of the virtual object has an abnormal illumination problem, thus improving the accuracy of illumination anomaly detection.
[0172] Optionally, the adjustment module 1001 is used for:
[0173] Find the part component corresponding to each part bound to the virtual object;
[0174] Adjust the color of the component corresponding to each part to the color of each part.
[0175] Optionally, the segmentation module 1003 is used for:
[0176] For the i-th part among multiple parts, identify the region in the image frame that has the same color as the i-th part, and determine the identified region as the sub-image corresponding to the i-th part; where i is a positive integer not greater than the number of multiple parts.
[0177] Optionally, the second acquisition module 1004 is used for:
[0178] The illumination detection results for each sub-image are obtained using the illumination detection model.
[0179] Among them, the illumination detection model is used to detect whether there is an illumination anomaly.
[0180] Optionally, the second acquisition module 1004 is used for:
[0181] For the i-th part among multiple parts, determine the lighting detection model corresponding to the i-th part. The lighting detection model corresponding to the i-th part is used to detect whether the i-th part has abnormal lighting. Different parts among the multiple parts have their own lighting detection models; where i is a positive integer not greater than the number of multiple parts.
[0182] The illumination detection result of the sub-image corresponding to the i-th part is obtained by using the illumination detection model corresponding to the i-th part.
[0183] Optionally, the second acquisition module 1004 is used for:
[0184] Extract the illumination features of the sub-image;
[0185] The illumination features of the sub-image are detected using an illumination detection model, and the illumination detection results of the sub-image are obtained.
[0186] Optionally, the second acquisition module 1004 is used for:
[0187] Based on the pixel values of multiple pixels in a sub-image, the multiple pixels in the sub-image are clustered to obtain multiple pixel sets. Each pixel set in the multiple pixel sets includes at least one central pixel.
[0188] The illumination features of a sub-image are determined based on the number of pixels in each pixel set.
[0189] Optionally, the second acquisition module 1004 is used for:
[0190] Determine the vector features formed by the number of pixels in each set of pixels;
[0191] Normalize the vector features to obtain the illumination features of the sub-image.
[0192] Optionally, see Figure 11 The device also includes a training module 1005, used for:
[0193] Obtain sample sub-images and sample labels corresponding to the parts of the virtual object. The color of the part in the sample sub-image is the color that the part needs to present during illumination detection. The sample label indicates whether the part is under abnormal illumination.
[0194] The illumination detection results of the sample sub-images are obtained through the illumination detection model;
[0195] An illumination detection model is trained based on the illumination detection results and sample labels of sample sub-images.
[0196] It should be noted that the light detection device provided in the above embodiments is only an example of the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the light detection device and the light detection method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0197] This application also provides a computer device, which includes a processor and a memory. The memory stores at least one computer program, which is loaded and executed by the processor to perform the operations performed in the light detection method of the above embodiments.
[0198] Optionally, the computer device is provided as a terminal. Figure 12 A schematic diagram of the structure of a terminal 1200 provided in an exemplary embodiment of this application is shown.
[0199] Terminal 1200 includes a processor 1201 and a memory 1202.
[0200] Processor 1201 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 1201 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). Processor 1201 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1201 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 1201 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0201] The memory 1202 may include one or more computer-readable storage media, which may be non-transitory. The memory 1202 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1202 are used to store at least one computer program, which is used by the processor 1201 to implement the light detection method provided in the method embodiments of this application.
[0202] In some embodiments, the terminal 1200 may also optionally include: a peripheral device interface 1203 and at least one peripheral device. The processor 1201, memory 1202, and peripheral device interface 1203 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 1203 via a bus, signal line, or circuit board. Optionally, the peripheral device includes at least one of: a radio frequency circuit 1204, a display screen 1205, a camera assembly 1206, an audio circuit 1207, and a power supply 1208.
[0203] Peripheral device interface 1203 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 1201 and memory 1202. In some embodiments, processor 1201, memory 1202 and peripheral device interface 1203 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 1201, memory 1202 and peripheral device interface 1203 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0204] The radio frequency (RF) circuit 1204 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 1204 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 1204 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 1204 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 1204 can communicate with other devices via at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: metropolitan area networks (MANs), various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks (WLANs), and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 1204 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.
[0205] Display screen 1205 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 1205 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 1201 for processing. In this case, display screen 1205 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 1205, disposed on the front panel of terminal 1200; in other embodiments, there may be at least two display screens, disposed on different surfaces of terminal 1200 or in a folded design; in still other embodiments, display screen 1205 may be a flexible display screen, disposed on a curved or folded surface of terminal 1200. Furthermore, display screen 1205 may also be configured as a non-rectangular, irregular shape, i.e., a non-rectangular screen. The display screen 1205 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0206] The camera assembly 1206 is used to acquire images or videos. Optionally, the camera assembly 1206 includes a front-facing camera and a rear-facing camera. The front-facing camera is disposed on the front panel of the terminal 1200, and the rear-facing camera is disposed on the back of the terminal 1200. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 1206 may also include a flash. The flash may be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cool light flash, which can be used for light compensation at different color temperatures.
[0207] The audio circuit 1207 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting the sound waves into electrical signals that are input to the processor 1201 for processing, or input to the radio frequency circuit 1204 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each positioned at a different location on the terminal 1200. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert electrical signals from the processor 1201 or the radio frequency circuit 1204 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 1207 may also include a headphone jack.
[0208] Power supply 1208 is used to power the various components in terminal 1200. Power supply 1208 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 1208 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0209] Those skilled in the art will understand that Figure 12 The structure shown does not constitute a limitation on terminal 1200 and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0210] Optionally, the computer device is provided as a server. Figure 13 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 1300 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 1301 and one or more memories 1302. The memories 1302 store at least one computer program, which is loaded and executed by the processor 1301 to implement the methods provided in the above-described method embodiments. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated upon here.
[0211] This application also provides a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to implement the operations performed by the light detection method of the above embodiments.
[0212] This application also provides a computer program product, including a computer program loaded and executed by a processor to perform the operations performed by the illumination detection method of the above embodiments.
[0213] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0214] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present application should be included within the protection scope of the present application.
Claims
1. A method for detecting illumination, characterized in that, The method includes: Adjust the colors of multiple parts of the virtual object, where the color of each part refers to the color that each part needs to present during light detection, and the colors of different parts are different; Acquire an image frame, the image frame including the virtual object located in the illuminated area; Based on the colors of the multiple parts, the image frame is divided into multiple sub-images, and each of the multiple sub-images corresponds to a part of the virtual object; The illumination detection result of each sub-image is obtained, and the illumination detection result of each sub-image indicates whether the corresponding part of each sub-image has abnormal illumination.
2. The method according to claim 1, characterized in that, Adjusting the color of multiple parts of the virtual object includes: Locate the part component corresponding to each part bound to the virtual object; Adjust the color of the component corresponding to each part to the color of each part.
3. The method according to claim 1, characterized in that, The step of segmenting the image frame into multiple sub-images based on the colors of the multiple regions includes: For the i-th part among the plurality of parts, identify the region in the image frame that has the same color as the i-th part, and determine the identified region as the sub-image corresponding to the i-th part; Where i is a positive integer not greater than the number of the plurality of parts.
4. The method according to any one of claims 1 to 3, characterized in that, The process of obtaining the illumination detection results for each sub-image includes: The illumination detection results for each sub-image are obtained using the illumination detection model. The illumination detection model is used to detect whether there is an illumination anomaly.
5. The method according to claim 4, characterized in that, The step of obtaining the illumination detection results for each sub-image through the illumination detection model includes: For the i-th part among the plurality of parts, a lighting detection model corresponding to the i-th part is determined. The lighting detection model corresponding to the i-th part is used to detect whether the i-th part has abnormal lighting. Different parts among the plurality of parts have their own lighting detection models. Here, i is a positive integer not greater than the number of the plurality of parts. The illumination detection result of the sub-image corresponding to the i-th part is obtained by using the illumination detection model corresponding to the i-th part.
6. The method according to claim 4, characterized in that, The step of obtaining the illumination detection results for each sub-image through the illumination detection model includes: Extract the illumination features of the sub-image; The illumination features of the sub-image are detected using the illumination detection model to obtain the illumination detection result of the sub-image.
7. The method according to claim 6, characterized in that, The extraction of illumination features from the sub-image includes: Based on the pixel values of multiple pixels in the sub-image, the multiple pixels in the sub-image are clustered to obtain multiple pixel sets, and each pixel set in the multiple pixel sets includes at least one central pixel. The illumination features of the sub-image are determined based on the number of pixels in each set of pixels.
8. The method according to claim 7, characterized in that, Determining the illumination features of the sub-image based on the number of pixels in each pixel set includes: Determine the vector features formed by the number of pixels in each set of pixels; The vector features are normalized to obtain the illumination features of the sub-image.
9. The method according to claim 4, characterized in that, The training process of the illumination detection model includes: Obtain sample sub-images and sample labels corresponding to the parts of the virtual object. The color of the part in the sample sub-image is the color that the part needs to present during illumination detection. The sample label indicates whether the part is under abnormal illumination. The illumination detection results of the sample sub-image are obtained through the illumination detection model. The illumination detection model is trained based on the illumination detection results of the sample sub-images and the sample labels.
10. A light detection device, characterized in that, The device includes: An adjustment module is used to adjust the color of multiple parts of a virtual object. The color of each part refers to the color that each part needs to present during light detection, and the colors of different parts are different. The first acquisition module is used to acquire an image frame, the image frame including the virtual object located in the illuminated area; The segmentation module is used to segment the image frame into multiple sub-images based on the colors of the multiple parts, wherein each sub-image corresponds to a part of the virtual object; The second acquisition module is used to acquire the illumination detection result of each sub-image, wherein the illumination detection result of each sub-image indicates whether the corresponding part of each sub-image has abnormal illumination.
11. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one computer program, which is loaded and executed by the processor to perform the operations of the illumination detection method as described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to perform the operations of the illumination detection method as described in any one of claims 1 to 9.
13. A computer program product, comprising a computer program, characterized in that, The computer program is loaded and executed by a processor to perform the operations of the illumination detection method as described in any one of claims 1 to 9.