Color Gradient Map Generation Method, Apparatus, Electronic Device, and Storage Medium

By converting the virtual scene image to the HSV color space and generating a gradient map, the problem of high labor cost in the production of color gradient maps in the prior art is solved, and the automatic generation and efficient production of color gradient maps are realized.

CN114904271BActive Publication Date: 2025-06-20NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210524596.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-13
Publication Date
2025-06-20
Estimated Expiration
2042-05-13

AI Technical Summary

Technical Problem

The method of producing color gradient maps in the prior art is very labor-intensive and labor-intensive.

Method used

By obtaining the virtual scene image and converting it from the initial color space to the HSV color space, a gradient map is generated based on the converted brightness and saturation components, the tone component value is calculated, and the color gradient map is finally generated in the initial color space.

Benefits of technology

The automatic generation of color gradient maps is realized, reducing labor costs and improving work efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114904271B_ABST
    Figure CN114904271B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a method, apparatus, electronic device, and storage medium for generating a color gradient map, including: obtaining a virtual scene image; converting the initial color space to which the virtual scene image belongs to the HSV color space; obtaining the lightness component gradient map of the color gradient map to be generated according to the lightness component of the converted virtual scene image; obtaining the saturation component gradient map of the color gradient map to be generated according to the saturation component of the converted virtual scene image; calculating the hue component value of the color gradient map to be generated according to the hue component of the converted virtual scene image; generating a color gradient map in the initial color space based on the lightness component gradient map, the saturation component gradient map, and the hue component value. In the present application, by performing the above processing on the virtual scene image, the color gradient map corresponding to the virtual scene image can be obtained, thereby realizing the automatic generation of the color gradient map; the workload is small, and the consumption of human costs can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and particularly to a method, apparatus, electronic device, and storage medium for generating a color gradient map. Background Art

[0002] In the prior art, in order to enable virtual cartoon characters in games to have different performance effects in different scenes and environments, on the basis of the general process of coloring cartoon characters, a color gradient map is introduced, and the coloring effect of the cartoon characters is affected by using the color gradient map, so as to achieve the purpose that the coloring effect of the cartoon characters will have slight changes in different scenes and environments.

[0003] However, in the prior art, the color gradient map usually can only rely on artists to manually set colors for each gradient of the color gradient map. This method of making the color gradient map has a large workload and high labor costs. Summary of the Invention

[0004] Embodiments of this application provide a method, apparatus, electronic device, and storage medium for generating a color gradient map, which can improve the problems of large workload and high labor costs in the method of making a color gradient map in the prior art.

[0005] Embodiments of this application provide a method for generating a color gradient map, the method comprising:

[0006] Obtain a virtual scene image, where the virtual scene image is an image of the virtual scene where the virtual character is located;

[0007] Convert the initial color space to which the virtual scene image belongs to the HSV color space, where the HSV color space includes a lightness component, a saturation component, and a hue component;

[0008] Obtain a lightness component gradient map of the color gradient map to be generated according to the lightness component of the converted virtual scene image;

[0009] Obtain a saturation component gradient map of the color gradient map to be generated according to the saturation component of the converted virtual scene image;

[0010] Calculate the hue component value of the color gradient map to be generated according to the hue component of the converted virtual scene image;

[0011] Generate a color gradient map in the initial color space based on the lightness component gradient map, the saturation component gradient map, and the hue component value.

[0012] Embodiments of this application also provide a device for generating a color gradient map, the device comprising:

[0013] A scene image acquisition unit for acquiring a virtual scene image, where the virtual scene image is an image of the virtual scene where the virtual character is located;

[0014] A color space conversion unit for converting the initial color space to which the virtual scene image belongs to the HSV color space, where the HSV color space includes a lightness component, a saturation component, and a hue component;

[0015] A lightness gradient map unit for obtaining a lightness component gradient map of the color gradient map to be generated according to the lightness component of the converted virtual scene image;

[0016] A saturation gradient map unit for obtaining a saturation component gradient map of the color gradient map to be generated according to the saturation component of the converted virtual scene image;

[0017] A hue component value unit for calculating the hue component value of the color gradient map to be generated according to the hue component of the converted virtual scene image;

[0018] A gradient map generation unit for generating a color gradient map in the initial color space based on the lightness component gradient map, the saturation component gradient map, and the hue component value.

[0019] In some embodiments, the lightness gradient map unit includes:

[0020] A lightness histogram sub-unit for obtaining a lightness component histogram of the converted virtual scene image, where the lightness component histogram includes m first rectangular bars, each of the first rectangular bars corresponding to a different lightness component value on the abscissa of the lightness component histogram, and each of the first rectangular bars corresponding to a different percentage ratio on the ordinate of the lightness component histogram;

[0021] A lightness gradient map sub-unit for generating a lightness component gradient map according to the lightness component value corresponding to each of the m first rectangular bars and the percentage ratio corresponding to each of the first rectangular bars, where the lightness component gradient map includes m gradients, the gradient values of the m gradients are m lightness component values arranged in ascending order, and the proportion of each gradient in the lightness component gradient map is the same as the percentage ratio corresponding to the gradient value of the gradient in the lightness component histogram.

[0022] In some embodiments, the lightness histogram sub-unit includes:

[0023] A lightness component secondary sub-unit for obtaining a plurality of lightness components included in the converted virtual scene image;

[0024] The brightness ratio secondary unit is configured to, for each of the multiple brightness components, obtain the number of pixel points belonging to the same brightness component, and calculate the ratio of the number of pixel points belonging to the same brightness component to the total number of pixel points of the virtual scene image, thereby obtaining the ratio corresponding to each brightness component;

[0025] The brightness histogram secondary unit is configured to generate an initial brightness component histogram with the multiple brightness components as the abscissa values and the ratio corresponding to each brightness component as the ordinate values, in ascending order of the numerical values of the brightness components. The initial brightness component histogram is the brightness component histogram.

[0026] In some embodiments, the brightness histogram unit includes:

[0027] The brightness component secondary unit is configured to obtain the multiple brightness components included in the converted virtual scene image;

[0028] The brightness ratio secondary unit is configured to, for each of the multiple brightness components, obtain the number of pixel points belonging to the same brightness component, and calculate the ratio of the number of pixel points belonging to the same brightness component to the total number of pixel points of the virtual scene image, thereby obtaining the ratio corresponding to each brightness component;

[0029] The brightness histogram secondary unit is configured to generate an initial brightness component histogram with the multiple brightness components as the abscissa values and the ratio corresponding to each brightness component as the ordinate values, in ascending order of the numerical values of the brightness components. The initial brightness component histogram includes multiple initial brightness rectangular bars, and the number of the initial brightness rectangular bars is the same as the number of the brightness components;

[0030] The ratio removal secondary unit is configured to remove the initial brightness rectangular bars that are in the edge positions and account for a% of the total amount in the initial brightness component histogram, and stretch the height values of the remaining initial brightness rectangular bars by 1 / (1 - a%) times to obtain the brightness component histogram.

[0031] In some embodiments, the saturation gradient map unit includes:

[0032] The saturation histogram secondary unit is configured to obtain the saturation component histogram of the converted virtual scene image, where the saturation component histogram includes n second rectangular bars, each of the second rectangular bars corresponds to a different saturation component value on the abscissa of the saturation component histogram, and each of the second rectangular bars corresponds to a different percentage ratio on the ordinate of the saturation component histogram;

[0033] A saturation gradient map subunit, configured to generate a saturation component gradient map according to the saturation component value corresponding to each of the n second rectangular bars and the percentage ratio corresponding to each of the n second rectangular bars, where the saturation component gradient map includes n gradients, and the gradient values of the n gradients are n saturation component values arranged in ascending order, and the proportion of each gradient in the saturation component gradient map is the same as the percentage ratio corresponding to the gradient value of the gradient in the saturation component histogram.

[0034] In some embodiments, the saturation histogram subunit includes:

[0035] A saturation component sub-subunit, configured to obtain a plurality of saturation components included in the converted virtual scene image;

[0036] A saturation ratio sub-subunit, configured to, for each saturation component among the plurality of saturation components, obtain the number of pixel points belonging to the same saturation component, and calculate the ratio of the number of pixel points belonging to the same saturation component to the total number of pixel points of the virtual scene image, to obtain the ratio corresponding to each saturation component respectively;

[0037] A saturation histogram sub-subunit, configured to generate an initial saturation component histogram with a plurality of saturation components as abscissa values and the ratio corresponding to each of the saturation components as ordinate values, in ascending order of the numerical values of the saturation components, where the initial saturation component histogram is the saturation component histogram.

[0038] In some embodiments, the saturation histogram subunit includes:

[0039] A saturation component sub-subunit, configured to obtain a plurality of saturation components included in the converted virtual scene image;

[0040] A saturation ratio sub-subunit, configured to, for each saturation component among the plurality of saturation components, obtain the number of pixel points belonging to the same saturation component, and calculate the ratio of the number of pixel points belonging to the same saturation component to the total number of pixel points of the virtual scene image, to obtain the ratio corresponding to each saturation component respectively;

[0041] A saturation histogram sub-subunit, configured to generate an initial saturation component histogram with a plurality of saturation components as abscissa values and the ratio corresponding to each of the saturation components as ordinate values, in ascending order of the numerical values of the saturation components, where the initial saturation component histogram includes a plurality of initial saturation rectangular bars, and the number of the initial saturation rectangular bars is the same as the number of the saturation components;

[0042] A height-stretched secondary unit is used to remove the initial saturation rectangular bars at the edge positions and accounting for b% of the total amount in the initial saturation component histogram, and stretch the height values of the remaining initial saturation rectangular bars by 1 / (1 - b%) times to obtain the saturation component histogram.

[0043] In some embodiments, a hue component value unit is specifically configured to calculate the average value of the hue components of the converted virtual scene image, where the average value is the hue component value of the color gradient map to be generated.

[0044] In some embodiments, a gradient map generation unit includes:

[0045] An HSV gradient map sub-unit is used to generate a color gradient map in the HSV color space based on the lightness component gradient map, the saturation component gradient map, and the hue component value;

[0046] A color space sub-unit is used to convert the color gradient map in the HSV color space from the HSV color space to the initial color space to obtain a color gradient map in the initial color space.

[0047] An embodiment of the present application further provides a computer-readable storage medium, which stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps in any one of the color gradient map generation methods provided by the embodiments of the present application.

[0048] In the color gradient map generation method provided by the embodiments of the present application, a virtual scene image can be first obtained, and the virtual scene image can be converted from the original initial color space to the HSV color space. Subsequently, according to the lightness component and the saturation component of the converted virtual scene image, the lightness component gradient map and the saturation component gradient map of the color gradient map to be generated are respectively obtained; according to the hue component of the converted virtual scene image, the hue component value of the color gradient map to be generated is calculated; and then, according to the lightness component gradient map, the saturation component gradient map, and the hue component value, a color gradient map in the initial color space is generated.

[0049] In the present application, the color gradient map corresponding to the virtual scene image can be obtained by performing the above processing on the virtual scene image, so that the automatic generation of the color gradient map can be realized. Compared with the method in the prior art of relying on artists to manually set colors for each gradient of the color gradient map, the method provided by the embodiments of the present application has less workload and reduces the consumption of labor costs. Description of the Drawings

[0050] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those skilled in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0051] Figure 1a is a schematic diagram of the scenario of the color gradient map generation method provided by the embodiment of the present application;

[0052] Figure 1b is a schematic flowchart of the color gradient map generation method provided by an embodiment of the present application;

[0053] Figure 1c shows the histogram of the lightness component in a specific embodiment;

[0054] Figure 1d shows the histogram of the lightness component in another specific embodiment;

[0055] Figure 1e For Figure 1c is the lightness component gradient map corresponding to the shown histogram of the lightness component;

[0056] Figure 1f For Figure 1d is the lightness component gradient map corresponding to the shown histogram of the lightness component;

[0057] Figure 1g shows the schematic diagram corresponding to a specific implementation manner of the color gradient map;

[0058] Figure 2 is a schematic flowchart of the color gradient map generation method provided by another embodiment of the present application;

[0059] Figure 3 is a schematic structural diagram of a color gradient map generation device provided by an embodiment of the present application;

[0060] Figure 4 is a schematic structural diagram of the electronic device provided by the embodiment of the present application. Detailed implementation manners

[0061] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application.

[0062] Embodiments of the present application provide a method, apparatus, mobile terminal, and storage medium for generating a color gradient map.

[0063] Among them, the method for generating a color gradient map can be specifically integrated in an electronic device, and the electronic device can be a device such as a terminal or a server. Among them, the terminal can be a device such as a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, or a personal computer (PC); the server can be a single server or a server cluster composed of multiple servers.

[0064] In some embodiments, the method for generating a color gradient map can also be integrated in multiple electronic devices. For example, the method for generating a color gradient map can be integrated in multiple servers, and multiple servers are used to implement the method for generating a color gradient map of the present application.

[0065] In some embodiments, the server can also be implemented in the form of a terminal.

[0066] For example, please refer to Figure 1a , in some embodiments, the electronic device can be a mobile terminal. In this embodiment, a virtual scene image can be obtained, where the virtual scene image is an image of the virtual scene where the virtual character is located; the initial color space to which the virtual scene image belongs is converted to the HSV color space, and the HSV color space includes a lightness component, a saturation component, and a hue component; according to the lightness component of the converted virtual scene image, a lightness component gradient map of the color gradient map to be generated is obtained; according to the saturation component of the converted virtual scene image, a saturation component gradient map of the color gradient map to be generated is obtained; according to the hue component of the converted virtual scene image, the hue component value of the color gradient map to be generated is calculated; based on the lightness component gradient map, the saturation component gradient map, and the hue component value, a color gradient map in the initial color space is generated.

[0067] A method for generating a color gradient map in one of the embodiments of the present disclosure can run on a terminal device or a server. The terminal device can be a local terminal device. When the method for generating a color gradient map runs on the server, the method can be implemented and executed based on a cloud interaction system, where the cloud interaction system includes a server and a client device.

[0068] In an alternative embodiment, various cloud applications can run under a cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. Under the operation mode of cloud games, the running entity of the game program and the presenting entity of the game screen are separated. The storage and operation of the color gradient map generation method are completed on the cloud game server, and the role of the client device is for data reception, transmission, and the presentation of the game screen. For example, the client device can be a display device with data transmission function near the user side, such as a terminal, a television, a computer, a personal digital assistant, etc.; however, the terminal device for generating the color gradient map is the cloud game server in the cloud. When playing a game, the user operates the client device to send operation instructions, such as operation instructions for touch operations, to the cloud game server. The cloud game server runs the game according to the operation instructions, encodes and compresses data such as the game screen, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.

[0069] In an alternative embodiment, the terminal device can be a local terminal device. Taking a game as an example, the local terminal device stores the game program and is used to present the game screen. The local terminal device is used to interact with the user through a graphical user interface, that is, conventionally, the game program is downloaded and installed on an electronic device and run. The way the local terminal device provides the graphical user interface to the user can include various methods. For example, it can be rendered and displayed on the display screen of the terminal, or provided to the user through holographic projection. For example, the local terminal device can include a display screen and a processor. The display screen is used to present the graphical user interface, which includes the game screen, and the processor is used to run the game, generate the graphical user interface, and control the display of the graphical user interface on the display screen.

[0070] The game scene (or called virtual scene) is the virtual scene displayed (or provided) when the application program runs on the terminal or the server. Optionally, the virtual scene is a simulation environment of the real world, or a semi-simulation and semi-fictional virtual environment, or a purely fictional virtual environment. The virtual scene is any one of a two-dimensional virtual scene and a three-dimensional virtual scene. The virtual environment can be the sky, land, sea, etc. Among them, the land includes environmental elements such as deserts and cities. Among them, the virtual scene is a scene for the complete game logic of virtual objects such as user control. For example, in a sandbox 3D shooting game, the virtual scene is a 3D game world for the user to control virtual objects to fight. Exemplary virtual scenes can include at least one element of mountains, plains, rivers, lakes, seas, deserts, sky, plants, buildings, vehicles.

[0071] The game interface refers to the interface corresponding to an application provided or displayed through a graphical user interface, which includes a graphical user interface and a game screen for user interaction, and the game screen is the screen of the game scene.

[0072] In an alternative embodiment, the UI interface may include game controls (such as skill controls, action controls, function controls, etc.), indication marks (such as direction indication marks, character indication marks, etc.), information display areas (such as the number of kills, game time, etc.), or game setting controls (such as system settings, store, gold coins, etc.).

[0073] In an alternative embodiment, the game screen is the display screen corresponding to the virtual scene displayed by the terminal device, and the game screen may include virtual objects such as game objects executing game logic in the virtual scene, non-player characters (NPCs), artificial intelligence (AI) characters, etc.

[0074] For example, in some embodiments, the content displayed in the graphical user interface at least partially includes a game scene, where the game scene includes at least one game object.

[0075] In some embodiments, the game objects in the game scene include virtual objects controlled by player users, that is, user objects.

[0076] A game object refers to a virtual object in a virtual scene, including game characters, and a game character is a controllable dynamic object, that is, a dynamic virtual object. Optionally, the dynamic object may be a virtual person, a virtual animal, an anime character, etc. The virtual object is a character controlled by the user through an input device, or an AI set in a virtual environment battle through training, or an NPC set in a virtual scene battle.

[0077] Optionally, the virtual object is a virtual person competing in a virtual scene. Optionally, the number of virtual objects in the virtual scene battle is preset or dynamically determined according to the number of clients joining the battle, and the embodiments of the present application do not limit this.

[0078] In a possible implementation manner, the user can control the virtual object to perform game behaviors in the virtual scene, and the game behaviors may include moving, casting skills, using items, dialoguing, etc. For example, controlling the virtual object to run, jump, crawl, etc., and can also control the virtual object to use skills, virtual items, etc. provided by the application to fight with other virtual objects.

[0079] The virtual camera is a necessary component for presenting the game scene. One game scene corresponds to at least one virtual camera. Depending on actual needs, there can be two or more virtual cameras, which serve as game rendering windows to capture and present the game world's screen content to users. By setting the parameters of the virtual camera, the user's perspective of viewing the game world can be adjusted, such as the first-person perspective and the third-person perspective.

[0080] In an optional implementation, an embodiment of the present invention provides a method for generating a color gradient map, providing a graphical user interface through a terminal device, wherein the terminal device can be the local terminal device mentioned above, or can be a client device in the cloud interaction system mentioned above.

[0081] It should be noted that the serial numbers of the following embodiments are not intended to limit the preferred order of the embodiments.

[0082] In this embodiment, a color gradient image generation method is provided, such as Figure 1b As shown, the specific process of the method may include the following steps 110 to 160:

[0083] 110. Acquire a virtual scene image.

[0084] The virtual scene image is an image of a virtual scene in which the virtual character is located, and the image of the virtual scene may be an original scene painting produced by an artist. There may be multiple virtual scenes in which the virtual character is located; accordingly, steps 110 to 160 may be performed for each of the multiple virtual scenes to obtain a color gradient map corresponding to each virtual scene image.

[0085] 120. Convert an initial color space to which the virtual scene image belongs into an HSV color space.

[0086] The HSV color space includes a lightness component V, a saturation component S, and a hue component H.

[0087] The initial color space is the color space to which the virtual scene image originally belongs. The initial color space can be any color space among RGB color space, CMY / CMYK color space, Lab color space, and YUV / YcbCr color space. The specific color space type of the initial color space should not be understood as a limitation to the present application.

[0088] 130. Obtain a brightness component gradient map of a color gradient map to be generated according to the converted brightness component of the virtual scene image.

[0089] The color gradient map Ramp is a long strip-shaped gradient map, and the color changes gradually from one end to the other end of the long strip-shaped gradient map. The color gradient map to be generated is the color gradient map to be generated corresponding to the virtual scene image.

[0090] The lightness component gradient map is another long strip-shaped gradient map, and the lightness component changes gradually from one end to the other end of the long strip-shaped gradient map.

[0091] After obtaining the virtual scene image converted into the HSV color space, according to the lightness component (i.e., the V component) of the virtual scene image, obtain the lightness component gradient map of the color gradient map to be generated, which specifically may include the following steps 131 to step 132:

[0092] 131. Obtain the lightness component histogram of the converted virtual scene image, where the lightness component histogram includes m first rectangular bars, each of the first rectangular bars corresponds to a different lightness component value on the abscissa of the lightness component histogram, and each of the first rectangular bars corresponds to a different percentage ratio on the ordinate of the lightness component histogram.

[0093] m is a positive integer, and the specific value of m should not be construed as a limitation to this application. Each of the m first rectangular bars has its own corresponding lightness component value, and each of the first rectangular bars has its own corresponding percentage ratio, that is, each lightness component value has its own percentage ratio, and this percentage ratio is used to reflect the percentage of the lightness component value corresponding to itself in the m lightness component values. Therefore, the sum of the percentages of the m lightness component values is 100%.

[0094] Optionally, in a specific embodiment, step 131 may include the following steps A1 to step A3:

[0095] A1. Obtain the multiple lightness components included in the converted virtual scene image.

[0096] Specifically, the lightness component of each pixel point among all the pixel points included in the converted virtual scene image can be obtained, and then the pixel points with the same lightness component are aggregated together, so that multiple clusters of pixel point sets can be obtained. The lightness components corresponding to different clusters of pixel point sets are different, and the number of pixel point sets is the same as the number of lightness components. The multiple lightness components included in the converted virtual scene image can be obtained in the above manner.

[0097] A2. For each of the multiple lightness components, obtain the number of pixel points belonging to the same lightness component, and calculate the ratio of the number of pixel points belonging to the same lightness component to the total number of pixel points of the virtual scene image, to obtain the ratio corresponding to each lightness component respectively.

[0098] Specifically, when calculating the ratio corresponding to each brightness component, the number of pixels included in the set of pixel points corresponding to the current brightness component can be obtained first, then the total number of pixels included in the converted virtual scene image can be obtained, and then the ratio of the former to the latter can be calculated, and this ratio is the ratio corresponding to the current brightness component.

[0099] A3. Using multiple brightness components as the abscissa values and the ratio corresponding to each of the brightness components as the ordinate values, generating an initial brightness component histogram in ascending order of the numerical values of the brightness components, and the initial brightness component histogram is the brightness component histogram.

[0100] After obtaining multiple brightness components and the ratios corresponding to each brightness component respectively, the numerical value of the brightness component can be used as the abscissa value, the ratio corresponding to the brightness component can be used as the ordinate value, multiple rectangular bars can be generated, and these multiple rectangular bars can be arranged in the coordinate system in ascending order of the brightness components, and then the initial brightness component histogram can be generated.

[0101] In this embodiment, the initial brightness component histogram can be directly used as the brightness component histogram.

[0102] For details, please refer to Figure 1c , let's assume m takes 10, then the converted virtual scene image includes 10 brightness components, which are: v0, v1, v2, v3, v4, v5, v6, v7, v8, v9.

[0103] Then, by the same method as in step A2, calculate the ratio corresponding to each brightness component. Taking v0 as an example, according to the formula:

[0104]

[0105] Calculate the ratio r0 corresponding to v0, where f(vi) is the number of pixel points with the brightness component vi, and i is a positive integer.

[0106] By the same steps, the ratios corresponding to v1, v2, v3, v4, v5, v6, v7, v8, v9 can be obtained in turn: r1, r2, r3, r4, r5, r6, r7, r8, r9.

[0107] Subsequently, taking v0 as the abscissa value and r0 as the ordinate value, generate the first rectangular bar;

[0108] Taking v1 as the abscissa value and r1 as the ordinate value, generate the second rectangular bar;

[0109] Taking v2 as the abscissa value and r2 as the ordinate value, generate the third rectangular bar;

[0110] ……

[0111] Taking v9 as the abscissa value and r9 as the ordinate value, the tenth rectangular bar is generated.

[0112] Then, arrange the above ten rectangular bars in ascending order of lightness component in the coordinate system, and the initial lightness component histogram as shown in Figure 1c can be obtained. In this specific embodiment, the initial lightness component histogram is the lightness component histogram obtained in step 131.

[0113] In the above embodiment, multiple rectangular bars can be drawn based on the multiple lightness components included in the converted virtual scene image and the ratio corresponding to each lightness component, and then the multiple rectangular bars are arranged in ascending order of lightness component in the coordinate system to obtain the final lightness component histogram. This lightness component histogram can more accurately reflect the ratio corresponding to each lightness component, so as to obtain a lightness component histogram that fits better with the virtual scene image.

[0114] Optionally, in another specific embodiment, step 131 may include the following steps B1 to B4:

[0115] B1. Obtain multiple lightness components included in the converted virtual scene image.

[0116] B2. For each lightness component among the multiple lightness components, obtain the number of pixel points belonging to the same lightness component, and calculate the ratio of the number of pixel points belonging to the same lightness component to the total number of pixel points of the virtual scene image, so as to obtain the ratio corresponding to each lightness component respectively.

[0117] B3. Taking the multiple lightness components as the abscissa values and the ratio corresponding to each lightness component as the ordinate values, generate an initial lightness component histogram in ascending order of the numerical values of the lightness components. The initial lightness component histogram includes multiple initial lightness rectangular bars, and the number of the initial lightness rectangular bars is the same as the number of the lightness components.

[0118] Steps B1 to B3 are the same as steps A1 to A3 above, and will not be elaborated here.

[0119] B4. Remove the initial lightness rectangular bars at the edge positions and accounting for a% of the total amount in the initial lightness component histogram, and stretch the height values of the remaining initial lightness rectangular bars by 1 / (1 - a%) times to obtain the lightness component histogram.

[0120] After obtaining the initial lightness component histogram, the initial lightness rectangular bars at the edge positions and accounting for a% of the total amount of the rectangular bars in the initial lightness component histogram can be removed.

[0121] Optionally, the same number or different numbers of initial lightness bars can be removed from both side edge positions of the initial lightness component histogram; that is, a / 2% of the initial lightness bars can be removed from the left edge position of the initial lightness component histogram, and a / 2% of the initial lightness bars can be removed from the right edge position of the initial lightness component histogram; alternatively, a0% of the initial lightness bars can be removed from the left edge position of the initial lightness component histogram, and (a - a0)% of the initial lightness bars can be removed from the right edge position of the initial lightness component histogram, where a0 is a positive number.

[0122] After the removal operation is performed, the sum of the percentage ratios corresponding to the remaining initial lightness bars becomes 1 - a%, and 1 - a% is less than 100%. Therefore, in order to make the sum of the percentage ratios corresponding to the remaining initial lightness bars become 100% again, the height values of the remaining initial lightness bars (i.e., the ratios corresponding to the remaining lightness components) can be stretched by 1 / (1 - a%) times, so that the lightness component histogram can be obtained.

[0123] For details, please refer to Figure 1c and Figure 1d , let's assume Figure 1c The percentage ratio of the initial lightness bar commonly corresponding to v0 and v9 in accounts for a% of the total amount of bars; therefore, after removing the initial lightness bars corresponding to v0, r0, and v9, r9, the ratios corresponding to v1, v2, v3, v4, v5, v6, v7, v8: r1, r2, r3, r4, r5, r6, r7, r8 can be stretched by 1 / (1 - a%) times, so that the stretched ratios: z1, z2, z3, z4, z5, z6, z7, z8 can be obtained, and then the lightness component histogram as shown in Figure 1d is obtained. In this specific embodiment, Figure 1d the lightness component histogram shown in is the lightness component histogram obtained in step 131.

[0124] In the above embodiment, the bars that have less influence on the lightness component histogram can be removed, so that the obtained lightness component histogram has stronger practicability.

[0125] 132. Generate a lightness component gradient map according to the lightness component value corresponding to each of the m first bars and the percentage ratio corresponding to each of the m first bars, where the lightness component gradient map includes m gradients, the gradient values of the m gradients are m lightness component values arranged in ascending order, and the proportion of each gradient in the lightness component gradient map is the same as the percentage ratio of the gradient value of this gradient in the lightness component histogram.

[0126] The brightness component gradient map is a long strip-shaped gradient map. This gradient map includes m gradients, and the gradient values from one end to the other end of the long strip-shaped gradient map are m brightness component values arranged in ascending order. Among the m gradients, the proportion of each gradient in the entire brightness component gradient map is the same as the percentage ratio corresponding to the gradient value of this gradient in the brightness component histogram.

[0127] For details, please refer to Figure 1e and Figure 1f , where Figure 1e is the brightness component gradient map corresponding to the brightness component histogram shown in Figure 1c ; Figure 1f is the brightness component gradient map corresponding to the brightness component histogram shown in Figure 1d .

[0128] In one embodiment, let's assume m is 10 for example. Refer to Figure 1e , the 10 gradients of the brightness component gradient map are in the order from the left end to the right end, and the gradient values are: v0, v1, v2, v3, v4, v5, v6, v7, v8, v9; correspondingly, the ratios of the lengths where the above 10 gradients are located to the total length of the entire brightness component gradient map are: r0, r1, r2, r3, r4, r5, r6, r7, r8, r9.

[0129] In another embodiment, let's assume m is 8 for example. Refer to Figure 1f , the 8 gradients of the brightness component gradient map are in the order from the left end to the right end, and the gradient values are: v1, v2, v3, v4, v5, v6, v7, v8; correspondingly, the ratios of the lengths where the above 8 gradients are located to the total length of the entire brightness component gradient map are: z1, z2, z3, z4, z5, z6, z7, z8.

[0130] In the above implementation, first, according to the correspondence between all pixel points in the virtual scene image and the brightness component, the brightness component histogram corresponding to this virtual scene image can be determined. The brightness component histogram includes m first rectangular bars. Subsequently, based on the brightness component values corresponding to the abscissa of the above m first rectangular bars in the brightness component histogram and the percentage ratios corresponding to the ordinate of the m first rectangular bars in the brightness component histogram, the brightness component gradient map can be determined. The above implementation can obtain the gradient map of the corresponding brightness component based on the virtual scene image, so as to present the brightness component of the virtual scene image more intuitively.

[0131] 140. Obtain the saturation component gradient map of the to-be-generated color gradient map according to the saturation component of the converted virtual scene image.

[0132] The saturation component gradient map is another strip-shaped gradient map, and along one end to the other end of the strip-shaped gradient map, the saturation component changes progressively.

[0133] After obtaining the virtual scene image converted into the HSV color space, according to the saturation component (i.e., the V component) of the virtual scene image, obtain the saturation component gradient map of the color gradient map to be generated, which may specifically include the following steps 141 to step 142:

[0134] 141. Obtain the saturation component histogram of the converted virtual scene image, where the saturation component histogram includes n second rectangular bars, each of the second rectangular bars corresponds to a different saturation component value on the abscissa of the saturation component histogram, and each of the second rectangular bars corresponds to a different percentage ratio on the ordinate of the saturation component histogram.

[0135] n is a positive integer, and the specific value of n should not be construed as a limitation to this application. Each of the n second rectangular bars has its own corresponding saturation component, and each of the second rectangular bars has its own corresponding percentage ratio, that is, each saturation component has its own percentage ratio, and this percentage ratio is used to reflect the percentage of the saturation component corresponding to itself in the m saturation components. Therefore, the percentages of the m saturation components add up to 100%.

[0136] Optionally, in a specific embodiment, step 141 may include the following steps C1 to step C3:

[0137] C1. Obtain the multiple saturation components included in the converted virtual scene image.

[0138] Specifically, the saturation component of each pixel point in all the pixel points included in the converted virtual scene image can be obtained, and then the pixel points with the same saturation component are aggregated together, so that multiple clusters of pixel point sets can be obtained. The saturation components corresponding to different clusters of pixel point sets are different, and the number of pixel point sets is the same as the number of saturation components. The multiple saturation components included in the converted virtual scene image can be obtained in the above manner.

[0139] C2. For each of the multiple saturation components, obtain the number of pixel points belonging to the same saturation component, and calculate the ratio of the number of pixel points belonging to the same saturation component to the total number of pixel points of the virtual scene image, to obtain the ratio corresponding to each saturation component respectively.

[0140] Specifically, when calculating the ratio corresponding to each saturation component, the number of pixels included in the set of pixels corresponding to the current saturation component can be obtained first; then, the total number of pixels included in the converted virtual scene image can be obtained, and then the ratio of the former to the latter can be calculated, and this ratio is the ratio corresponding to the current saturation component.

[0141] C3. Using multiple saturation components as the abscissa values and the ratio corresponding to each saturation component as the ordinate values, generate an initial saturation component histogram in ascending order of the numerical values of the saturation components, and the initial saturation component histogram is the saturation component histogram.

[0142] After obtaining multiple saturation components and the ratios corresponding to each saturation component respectively, the numerical values of the saturation components can be used as the abscissa values, and the ratios corresponding to the saturation components can be used as the ordinate values to generate multiple rectangular bars, and these multiple rectangular bars can be arranged in the coordinate system in ascending order of the saturation components, so as to generate an initial saturation component histogram.

[0143] In this embodiment, the initial saturation component histogram can be directly used as the saturation component histogram.

[0144] In the above embodiment, multiple rectangular bars can be drawn based on the multiple saturation components included in the converted virtual scene image and the ratio corresponding to each saturation component, and then the multiple rectangular bars can be arranged in the coordinate system in ascending order of the saturation components to obtain the final saturation component histogram, which can more accurately reflect the ratio corresponding to each saturation component, so as to obtain a saturation component histogram that fits the virtual scene image better.

[0145] Optionally, in another specific embodiment, step 141 may include the following steps D1 to D4:

[0146] D1. Obtain multiple saturation components included in the converted virtual scene image.

[0147] D2. For each saturation component among the multiple saturation components, obtain the number of pixels belonging to the same saturation component, and calculate the ratio of the number of pixels belonging to the same saturation component to the total number of pixels of the virtual scene image, so as to obtain the ratio corresponding to each saturation component respectively.

[0148] D3. Using multiple saturation components as the abscissa values and the ratio corresponding to each saturation component as the ordinate value, generate an initial saturation component histogram in ascending order of the numerical values of the saturation components. The initial saturation component histogram includes multiple initial saturation rectangles, and the number of the initial saturation rectangles is the same as the number of the saturation components.

[0149] Steps D1 to D3 are the same as steps C1 to C3 described above, and will not be elaborated here.

[0150] D4. Remove the initial saturation rectangles that are in the edge positions and account for b% of the total in the initial saturation component histogram, and stretch the height values of the remaining initial saturation rectangles by 1 / (1 - b%) times to obtain the saturation component histogram.

[0151] After obtaining the initial saturation component histogram, the initial saturation rectangles that are in the edge positions and account for b% of the total number of rectangles in the initial saturation component histogram can be removed. After the removal operation, the sum of the percentages corresponding to the remaining initial saturation rectangles becomes 1 - b%, and 1 - b% is less than 100%. Therefore, in order to make the sum of the percentages corresponding to the remaining initial saturation rectangles become 100% again, the height values of the remaining initial saturation rectangles (i.e., the ratios corresponding to the remaining saturation components) can be stretched by 1 / (1 - b%) times, so that the saturation component histogram can be obtained.

[0152] In the above embodiment, the rectangles with less influence on the saturation component histogram can be removed, so that the obtained saturation component histogram has stronger practicability.

[0153] 142. Generate a saturation component gradient map according to the saturation component value corresponding to each of the n second rectangles and the percentage ratio corresponding to each of the n second rectangles, wherein the saturation component gradient map includes n gradients, and the gradient values of the n gradients are n saturation component values arranged in ascending order, and the proportion of each gradient in the saturation component gradient map is the same as the percentage ratio corresponding to the gradient value of the gradient in the saturation component histogram.

[0154] The saturation component gradient map is a long strip-shaped gradient map. The gradient map includes n gradients, and the gradient values from one end to the other end of the long strip-shaped gradient map are n saturation component values arranged in ascending order. Among the n gradients, the proportion of each gradient in the entire saturation component gradient map is the same as the percentage ratio corresponding to the gradient value of the gradient in the saturation component histogram.

[0155] In the above embodiments, the saturation component histogram corresponding to the virtual scene image may be determined first according to the correspondence between all pixel points in the virtual scene image and the saturation component. The saturation component histogram includes n second rectangular bars. Subsequently, according to the saturation component values corresponding to the abscissa of the n second rectangular bars in the saturation component histogram and the percentage ratios corresponding to the ordinate of the n second rectangular bars in the saturation component histogram, the saturation component gradient map is determined. The above embodiments can obtain the gradient map of the saturation component corresponding to the virtual scene image based on the virtual scene image, so as to present the saturation component of the virtual scene image more intuitively.

[0156] 150. Calculate the hue component value of the color gradient map to be generated according to the hue component of the converted virtual scene image.

[0157] Optionally, "calculating the hue component value of the color gradient map to be generated" can be specifically implemented through the following steps: calculating the average value of the hue components of the converted virtual scene image, where the average value is the hue component value of the color gradient map to be generated.

[0158] In the above embodiments, the average value of the hue components of the converted virtual scene image can be used as the hue component value of the color gradient map to be generated. It should be understood that other methods can also be used to calculate the hue component value of the color gradient map to be generated, and the specific calculation process of the hue component value of the color gradient map to be generated should not be construed as a limitation to this application.

[0159] 160. Generate a color gradient map in the initial color space based on the lightness component gradient map, saturation component gradient map, and hue component value.

[0160] After obtaining the color gradient map, the developer can also crop the color gradient map according to his own needs, so as to use the cropped color gradient map as a resource to participate in the rendering of the virtual character. For the cropped color gradient map, please refer to Figure 1g 。

[0161] Optionally, in a specific embodiment, step 160 may include the following steps 161 to 162:

[0162] 161. Generate a color gradient map in the HSV color space based on the lightness component gradient map, saturation component gradient map, and hue component value.

[0163] 162. Convert the color gradient map in the HSV color space to the initial color space to obtain a color gradient map in the initial color space.

[0164] In the above embodiments, a color gradient map in the HSV color space can be generated first according to the obtained lightness component gradient map, saturation component gradient map, and hue component value of the color gradient map to be generated. Subsequently, the above color gradient map is converted from the HSV color space to the initial color space for subsequent use of the color gradient map. In this application, after obtaining the image of the virtual scene where the virtual character is located, the above processing procedure can be executed to obtain the color gradient map corresponding to the virtual scene image, thereby realizing the automatic generation of the color gradient map corresponding to each virtual scene image.

[0165] In the color gradient map generation method provided by the embodiments of this application, a virtual scene image can be obtained first, and the virtual scene image is converted from the initial color space it originally belongs to to the HSV color space. Subsequently, according to the lightness component and saturation component of the converted virtual scene image, the lightness component gradient map and saturation component gradient map of the color gradient map to be generated are obtained respectively; according to the hue component of the converted virtual scene image, the hue component value of the color gradient map to be generated is calculated; then, according to the lightness component gradient map, saturation component gradient map, and hue component value, a color gradient map in the initial color space is generated. In this application, the color gradient map corresponding to the virtual scene image can be obtained by performing the above processing on the virtual scene image, thereby realizing the automatic generation of the color gradient map.

[0166] The method provided by the embodiments of this application can reduce the consumption of labor costs.

[0167] According to the method described in the above embodiments, further detailed description will be made below.

[0168] In this embodiment, taking the initial color space as the RGB color space as an example, the method of the embodiments of this application will be described in detail.

[0169] As Figure 2 shown, the specific process of a color gradient map generation method is as follows:

[0170] 201. Obtain a virtual scene image.

[0171] Among them, the virtual scene image is an image of the virtual scene where the virtual character is located.

[0172] 202. Convert the virtual scene image from the RGB color space to the HSV color space, where the HSV color space includes a lightness component, a saturation component, and a hue component.

[0173] 203. Obtain multiple lightness components included in the converted virtual scene image.

[0174] 204. For each of the multiple lightness components, obtain the number of pixel points belonging to the same lightness component, and calculate the ratio of the number of pixel points belonging to the same lightness component to the total number of pixel points in the virtual scene image, to obtain the ratio corresponding to each lightness component respectively.

[0175] 205. Using the multiple lightness components as the abscissa values and the ratio corresponding to each lightness component as the ordinate values, generate an initial lightness component histogram in ascending order of the numerical values of the lightness components.

[0176] Among them, the initial lightness component histogram includes multiple initial lightness rectangles, and the number of the initial lightness rectangles is the same as the number of the lightness components.

[0177] 206. Remove the initial lightness rectangles at the edge positions and accounting for a% of the total amount in the initial lightness component histogram, and stretch the height values of the remaining initial lightness rectangles by 1 / (1 - a%) times to obtain the lightness component histogram.

[0178] Among them, the lightness component histogram includes m first rectangles, each of the first rectangles corresponds to a different lightness component value on the abscissa of the lightness component histogram, and each of the first rectangles corresponds to a different percentage ratio on the ordinate of the lightness component histogram.

[0179] 207. Generate a lightness component gradient map according to the lightness component value corresponding to each of the m first rectangles and the percentage ratio corresponding to each of the m first rectangles.

[0180] Among them, the lightness component gradient map includes m gradients, the gradient values of the m gradients are m lightness component values arranged in ascending order in sequence, and the proportion of each gradient in the lightness component gradient map is the same as the percentage ratio corresponding to the gradient value of this gradient in the lightness component histogram.

[0181] 208. Obtain the multiple saturation components included in the converted virtual scene image.

[0182] 209. For each of the multiple saturation components, obtain the number of pixel points belonging to the same saturation component, and calculate the ratio of the number of pixel points belonging to the same saturation component to the total number of pixel points in the virtual scene image, to obtain the ratio corresponding to each saturation component respectively.

[0183] 210. Using the multiple saturation components as the abscissa values and the ratio corresponding to each saturation component as the ordinate values, generate an initial saturation component histogram in ascending order of the numerical values of the saturation components.

[0184] Among them, the initial saturation component histogram includes a plurality of initial saturation rectangles, and the number of the initial saturation rectangles is the same as the number of the saturation components.

[0185] 211. Remove the initial saturation rectangles that are at the edge positions and account for b% of the total amount in the initial saturation component histogram, and stretch the height values of the remaining initial saturation rectangles by 1 / (1 - b%) times to obtain the saturation component histogram.

[0186] The saturation component histogram includes n second rectangles. Each of the second rectangles corresponds to a different saturation component value on the abscissa of the saturation component histogram, and each of the second rectangles corresponds to a different percentage ratio on the ordinate of the saturation component histogram.

[0187] 212. Generate a saturation component gradient map according to the saturation component value corresponding to each of the n second rectangles and the percentage ratio corresponding to each of the n second rectangles.

[0188] Among them, the saturation component gradient map includes n gradients, and the gradient values of the n gradients are n saturation component values arranged in ascending order. The proportion of each gradient in the saturation component gradient map is the same as the percentage ratio corresponding to the gradient value of the gradient in the saturation component histogram.

[0189] 213. Calculate the average value of the hue components of the converted virtual scene image, where the average value is the hue component value of the color gradient map to be generated.

[0190] 214. Generate a color gradient map in the HSV color space based on the lightness component gradient map, the saturation component gradient map, and the hue component value.

[0191] 215. Convert the color gradient map in the HSV color space from the HSV color space to the initial color space to obtain a color gradient map in the initial color space.

[0192] As can be seen from the above, in the color gradient map generation method provided by the embodiments of the present application, a virtual scene image can be first obtained, and the virtual scene image can be converted from the original initial color space to the HSV color space. Subsequently, according to the lightness component and the saturation component of the converted virtual scene image, the lightness component gradient map and the saturation component gradient map of the color gradient map to be generated are respectively obtained; according to the hue component of the converted virtual scene image, the hue component value of the color gradient map to be generated is calculated; and then, according to the lightness component gradient map, the saturation component gradient map, and the hue component value, a color gradient map in the initial color space is generated.

[0193] In this application, the color gradient map corresponding to the virtual scene image can be obtained by performing the above processing on the virtual scene image, so as to realize the automatic generation of the color gradient map. Compared with the prior art in which artists manually set colors for each gradient of the color gradient map, the method provided in the embodiments of this application has less workload and reduces the consumption of labor costs.

[0194] To better implement the above method, the embodiments of this application also provide a color gradient map generation device, which can be specifically integrated in an electronic device, and the electronic device can be a terminal. Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, a personal computer and other devices.

[0195] For example, in this embodiment, the color gradient map generation device is specifically integrated in the terminal as an example to describe the device of the embodiments of this application in detail.

[0196] For example, as Figure 3 shown, the color gradient map generation device may include:

[0197] A scene image acquisition unit 301, configured to acquire a virtual scene image, where the virtual scene image is an image of a virtual scene where a virtual character is located;

[0198] A color space conversion unit 302, configured to convert the initial color space to which the virtual scene image belongs to the HSV color space, and the HSV color space includes a lightness component, a saturation component, and a hue component;

[0199] A lightness gradient map unit 303, configured to obtain a lightness component gradient map of the color gradient map to be generated according to the lightness component of the converted virtual scene image;

[0200] A saturation gradient map unit 304, configured to obtain a saturation component gradient map of the color gradient map to be generated according to the saturation component of the converted virtual scene image;

[0201] A hue component value unit 305, configured to calculate a hue component value of the color gradient map to be generated according to the hue component of the converted virtual scene image;

[0202] A gradient map generation unit 306, configured to generate a color gradient map in the initial color space based on the lightness component gradient map, the saturation component gradient map, and the hue component value.

[0203] In some embodiments, the lightness gradient map unit 303 includes:

[0204] A brightness histogram sub-unit for obtaining a brightness component histogram of the converted virtual scene image, where the brightness component histogram includes m first rectangular bars, each of the first rectangular bars corresponding to a different brightness component value on the abscissa of the brightness component histogram, and each of the first rectangular bars corresponding to a different percentage ratio on the ordinate of the brightness component histogram;

[0205] A brightness gradient map sub-unit for generating a brightness component gradient map according to the brightness component value corresponding to each of the m first rectangular bars and the percentage ratio corresponding to each of the first rectangular bars, where the brightness component gradient map includes m gradients, and the gradient values of the m gradients are m brightness component values arranged in ascending order, and the proportion of each gradient in the brightness component gradient map is the same as the percentage ratio corresponding to the gradient value of the gradient in the brightness component histogram.

[0206] In some embodiments, the brightness histogram sub-unit includes:

[0207] A brightness component secondary sub-unit for obtaining a plurality of brightness components included in the converted virtual scene image;

[0208] A brightness ratio secondary sub-unit for, for each brightness component among the plurality of brightness components, obtaining the number of pixel points belonging to the same brightness component and calculating the ratio of the number of pixel points belonging to the same brightness component to the total number of pixel points of the virtual scene image, to obtain the ratio corresponding to each brightness component respectively;

[0209] A brightness histogram secondary sub-unit for generating an initial brightness component histogram with a plurality of brightness components as abscissa values and the ratio corresponding to each brightness component as ordinate values, in ascending order of the numerical values of the brightness components, and the initial brightness component histogram is the brightness component histogram.

[0210] In some embodiments, the brightness histogram sub-unit includes:

[0211] A brightness component secondary sub-unit for obtaining a plurality of brightness components included in the converted virtual scene image;

[0212] A brightness ratio secondary sub-unit for, for each brightness component among the plurality of brightness components, obtaining the number of pixel points belonging to the same brightness component and calculating the ratio of the number of pixel points belonging to the same brightness component to the total number of pixel points of the virtual scene image, to obtain the ratio corresponding to each brightness component respectively;

[0213] The brightness histogram secondary unit is used to generate an initial brightness component histogram in ascending order of the numerical values of the brightness components, with multiple brightness components as the abscissa values and the ratio corresponding to each brightness component as the ordinate value. The initial brightness component histogram includes multiple initial brightness rectangular bars, and the number of the initial brightness rectangular bars is the same as the number of the brightness components;

[0214] The ratio removal secondary unit is used to remove the initial brightness rectangular bars at the edge positions and accounting for a% of the total amount in the initial brightness component histogram, and stretch the height values of the remaining initial brightness rectangular bars by 1 / (1 - a%) times to obtain the brightness component histogram.

[0215] In some embodiments, the saturation gradient map unit 304 includes:

[0216] The saturation histogram secondary unit is used to obtain the saturation component histogram of the converted virtual scene image. Among them, the saturation component histogram includes n second rectangular bars, and each second rectangular bar corresponds to a different saturation component value on the abscissa of the saturation component histogram, and each second rectangular bar corresponds to a different percentage ratio on the ordinate of the saturation component histogram;

[0217] The saturation gradient map secondary unit is used to generate a saturation component gradient map according to the saturation component value corresponding to each of the n second rectangular bars and the percentage ratio corresponding to each second rectangular bar. Among them, the saturation component gradient map includes n gradients, and the gradient values of the n gradients are n saturation component values arranged in ascending order, and the proportion of each gradient in the saturation component gradient map is the same as the percentage ratio corresponding to the gradient value of the gradient in the saturation component histogram.

[0218] In some embodiments, the saturation histogram secondary unit includes:

[0219] The saturation component secondary unit is used to obtain multiple saturation components included in the converted virtual scene image;

[0220] The saturation ratio secondary unit is used to, for each saturation component among the multiple saturation components, obtain the number of pixel points belonging to the same saturation component, and calculate the ratio of the number of pixel points belonging to the same saturation component to the total number of pixel points of the virtual scene image, so as to obtain the ratio corresponding to each saturation component respectively;

[0221] A saturation histogram secondary unit, configured to generate an initial saturation component histogram with multiple saturation components as abscissa values and the ratio corresponding to each saturation component as ordinate values, in ascending order of the numerical values of the saturation components, where the initial saturation component histogram is the saturation component histogram.

[0222] In some embodiments, the saturation histogram sub-unit includes:

[0223] A saturation component secondary unit, configured to obtain multiple saturation components included in the converted virtual scene image;

[0224] A saturation ratio secondary unit, configured to, for each saturation component among the multiple saturation components, obtain the number of pixel points belonging to the same saturation component, and calculate the ratio of the number of pixel points belonging to the same saturation component to the total number of pixel points of the virtual scene image, to obtain the ratio corresponding to each saturation component respectively;

[0225] A saturation histogram secondary unit, configured to generate an initial saturation component histogram with multiple saturation components as abscissa values and the ratio corresponding to each saturation component as ordinate values, in ascending order of the numerical values of the saturation components, where the initial saturation component histogram includes multiple initial saturation rectangular bars, and the number of the initial saturation rectangular bars is the same as the number of the saturation components;

[0226] A height elongation secondary unit, configured to remove the initial saturation rectangular bars at the edge positions and accounting for b% of the total amount in the initial saturation component histogram, and elongate the height values of the remaining initial saturation rectangular bars by 1 / (1 - b%) times, to obtain the saturation component histogram.

[0227] In some embodiments, the hue component value unit 305 is specifically configured to calculate the average value of the hue components of the converted virtual scene image, where the average value is the hue component value of the color gradient map to be generated.

[0228] In some embodiments, the gradient map generation unit 306 includes:

[0229] An HSV gradient map sub-unit, configured to generate a color gradient map in the HSV color space based on the lightness component gradient map, the saturation component gradient map, and the hue component value;

[0230] A color space sub-unit, configured to convert the color gradient map in the HSV color space from the HSV color space to the initial color space, to obtain a color gradient map in the initial color space.

[0231] In specific implementation, each of the above units can be implemented as an independent entity, or can be arbitrarily combined and implemented as the same or several entities. For the specific implementation of each of the above units, reference can be made to the foregoing method embodiments and will not be elaborated herein.

[0232] As can be seen from the above, the color gradient map corresponding to the virtual scene image can be obtained by performing the above processing on the virtual scene image, so that the automatic generation of the color gradient map can be realized. Compared with the prior art in which an artist manually sets colors for each gradient of the color gradient map, the method provided in the embodiments of the present application has less workload and reduces the consumption of labor costs.

[0233] The embodiments of the present application can reduce the workload of developers and save the time for game development.

[0234] The embodiments of the present application further provide an electronic device, which can be a device such as a terminal or a server. Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a notebook computer, a personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers, etc.

[0235] In some embodiments, the color gradient map generation device can also be integrated in multiple electronic devices. For example, the color gradient map generation device can be integrated in multiple servers, and the color gradient map generation method of the present application is implemented by multiple servers.

[0236] In this embodiment, the electronic device in this embodiment will be described in detail by taking the electronic device as an example. For example, as Figure 4 shown, it shows a schematic structural diagram of the electronic device involved in the embodiments of the present application. Specifically:

[0237] The electronic device may include a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, an input module 404, a communication module 405 and other components. Those skilled in the art can understand that Figure 4 the structural diagram of the electronic device shown in does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or different component arrangements. Among them:

[0238] The processor 401 is the control center of the electronic device, connecting various parts of the entire electronic device through various interfaces and circuits. By running or executing software programs and / or modules stored in the memory 402, and by invoking the data stored in the memory 402, it executes various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. In some embodiments, the processor 401 may include one or more processing cores; in some embodiments, the processor 401 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communications. It can be understood that the above-mentioned modem processor may not be integrated into the processor 401 either.

[0239] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as the sound playback function, image playback function, etc.); the data storage area can store data created according to the use of the electronic device. In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage devices. Correspondingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0240] The electronic device further includes a power supply 403 that powers each component. In some embodiments, the power supply 403 may be logically connected to the processor 401 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 403 may also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.

[0241] The electronic device may further include an input module 404, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0242] The electronic device may further include a communication module 405. In some embodiments, the communication module 405 may include a wireless module. The electronic device can perform short-range wireless transmission through the wireless module of the communication module 405, thereby providing users with wireless broadband Internet access. For example, the communication module 405 can be used to help users send and receive emails, browse web pages, and access streaming media, etc.

[0243] Although not shown, the electronic device may further include a display unit and the like, which will not be elaborated here. Specifically, in this embodiment, the processor 401 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402 to implement various functions as follows:

[0244] Obtain a virtual scene image, where the virtual scene image is an image of the virtual scene where the virtual character is located; convert the initial color space to which the virtual scene image belongs to the HSV color space, and the HSV color space includes a lightness component, a saturation component, and a hue component; obtain a lightness component gradient map of the color gradient map to be generated according to the lightness component of the virtual scene image after conversion; obtain a saturation component gradient map of the color gradient map to be generated according to the saturation component of the virtual scene image after conversion; calculate the hue component value of the color gradient map to be generated according to the hue component of the virtual scene image after conversion; generate a color gradient map in the initial color space based on the lightness component gradient map, the saturation component gradient map, and the hue component value.

[0245] For the specific implementation of each of the above operations, reference may be made to the previous embodiments, which will not be elaborated here.

[0246] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions or by controlling relevant hardware through instructions. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0247] Therefore, an embodiment of the present application provides a computer-readable storage medium, which stores multiple instructions that can be loaded by a processor to execute the steps in any of the color gradient map generation methods provided by the embodiments of the present application. For example, the instructions can execute the following steps:

[0248] Obtain a virtual scene image, where the virtual scene image is an image of the virtual scene where the virtual character is located; convert the initial color space to which the virtual scene image belongs to the HSV color space, and the HSV color space includes a lightness component, a saturation component, and a hue component; obtain a lightness component gradient map of the color gradient map to be generated according to the lightness component of the virtual scene image after conversion; obtain a saturation component gradient map of the color gradient map to be generated according to the saturation component of the virtual scene image after conversion; calculate the hue component value of the color gradient map to be generated according to the hue component of the virtual scene image after conversion; generate a color gradient map in the initial color space based on the lightness component gradient map, the saturation component gradient map, and the hue component value.

[0249] Among them, the storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc.

[0250] According to one aspect of the present application, there is provided a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the various optional implementation manners provided in the above embodiments.

[0251] Since the instructions stored in the storage medium can execute the steps in any of the color gradient map generation methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any of the color gradient map generation methods provided in the embodiments of the present application can be realized. For details, please refer to the previous embodiments and will not be repeated here.

[0252] The above has introduced in detail a color gradient map generation method, device, electronic device, and computer-readable storage medium provided by the embodiments of the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.

Claims

1. A method for generating a color gradient map, characterized in that, The method includes: Obtaining a virtual scene image, where the virtual scene image is an image of the virtual scene where the virtual character is located; Converting the initial color space to which the virtual scene image belongs to the HSV color space, where the HSV color space includes a lightness component, a saturation component, and a hue component; Obtaining a lightness component gradient map of the color gradient map to be generated according to the lightness component of the virtual scene image after conversion, where the lightness component gradient map is determined based on the lightness component histogram of the virtual scene image after conversion; Obtaining a saturation component gradient map of the color gradient map to be generated according to the saturation component of the virtual scene image after conversion, where the saturation component gradient map is determined based on the saturation component histogram of the virtual scene image after conversion; Calculating the hue component value of the color gradient map to be generated according to the hue component of the virtual scene image after conversion; Generating a color gradient map in the initial color space based on the lightness component gradient map, the saturation component gradient map, and the hue component value; the color gradient map is a long strip-shaped gradient map, and the color changes gradually from one end to the other end of the long strip-shaped gradient map; The calculating the hue component value of the color gradient map to be generated according to the hue component of the virtual scene image after conversion includes: Calculating the average value of the hue components of the virtual scene image after conversion, where the average value is the hue component value of the color gradient map to be generated.

2. The method according to claim 1, characterized in that, The obtaining a lightness component gradient map of the color gradient map to be generated according to the lightness component of the virtual scene image after conversion includes: Obtaining a lightness component histogram of the virtual scene image after conversion, where the lightness component histogram includes m first rectangular bars, each of the first rectangular bars corresponds to a different lightness component value on the abscissa of the lightness component histogram, and each of the first rectangular bars corresponds to a different percentage ratio on the ordinate of the lightness component histogram; Generating a lightness component gradient map according to the lightness component value corresponding to each of the m first rectangular bars and the percentage ratio corresponding to each of the first rectangular bars, where the lightness component gradient map includes m gradients, and the gradient values of the m gradients are m lightness component values arranged in ascending order, and the proportion of each gradient in the lightness component gradient map is the same as the percentage ratio corresponding to the gradient value of the gradient in the lightness component histogram.

3. The method according to claim 2, characterized in that, The obtaining a lightness component histogram of the virtual scene image after conversion includes: Obtaining a plurality of lightness components included in the virtual scene image after conversion; For each lightness component among the plurality of lightness components, obtaining the number of pixel points belonging to the same lightness component, and calculating the ratio of the number of pixel points belonging to the same lightness component to the total number of pixel points of the virtual scene image, to obtain the ratio corresponding to each lightness component respectively; Using multiple lightness components as the abscissa values and the ratio corresponding to each of the lightness components as the ordinate values, an initial lightness component histogram is generated in ascending order of the numerical values of the lightness components, and the initial lightness component histogram is the lightness component histogram.

4. The method according to claim 2, characterized in that, The obtaining of the lightness component histogram of the converted virtual scene image includes: Obtaining multiple lightness components included in the converted virtual scene image; For each lightness component among the multiple lightness components, obtaining the number of pixel points belonging to the same lightness component, and calculating the ratio of the number of pixel points belonging to the same lightness component to the total number of pixel points of the virtual scene image, to obtain the ratio corresponding to each lightness component respectively; Using multiple lightness components as the abscissa values and the ratio corresponding to each of the lightness components as the ordinate values, an initial lightness component histogram is generated in ascending order of the numerical values of the lightness components. The initial lightness component histogram includes multiple initial lightness rectangles, and the number of the initial lightness rectangles is the same as the number of the lightness components; Removing the initial lightness rectangles at the edge positions and accounting for a% of the total amount in the initial lightness component histogram, and stretching the height values of the remaining initial lightness rectangles by 1 / (1 - a%) times to obtain the lightness component histogram.

5. The method according to claim 1, characterized in that, The obtaining of the saturation component gradient map of the to-be-generated color gradient map according to the saturation component of the converted virtual scene image includes: Obtaining the saturation component histogram of the converted virtual scene image, where the saturation component histogram includes n second rectangles, each of the second rectangles corresponds to a different saturation component value on the abscissa of the saturation component histogram, and each of the second rectangles corresponds to a different percentage ratio on the ordinate of the saturation component histogram; Generating a saturation component gradient map according to the saturation component value corresponding to each of the n second rectangles and the percentage ratio corresponding to each of the n second rectangles, where the saturation component gradient map includes n gradients, the gradient values of the n gradients are n saturation component values arranged in ascending order, and the proportion of each gradient in the saturation component gradient map is the same as the percentage ratio corresponding to the gradient value of the gradient in the saturation component histogram.

6. The method according to claim 5, characterized in that, The obtaining of the saturation component histogram of the converted virtual scene image includes: Obtaining multiple saturation components included in the converted virtual scene image; For each saturation component among the multiple saturation components, obtaining the number of pixel points belonging to the same saturation component, and calculating the ratio of the number of pixel points belonging to the same saturation component to the total number of pixel points of the virtual scene image, to obtain the ratio corresponding to each saturation component respectively; Using multiple saturation components as the abscissa values and the ratio corresponding to each of the saturation components as the ordinate values, an initial saturation component histogram is generated in ascending order of the numerical values of the saturation components, and the initial saturation component histogram is the saturation component histogram.

7. The method according to claim 5, characterized in that, Obtaining the saturation component histogram of the converted virtual scene image includes: Obtaining a plurality of saturation components included in the converted virtual scene image; For each saturation component among the plurality of saturation components, obtaining the number of pixel points belonging to the same saturation component, and calculating the ratio of the number of pixel points belonging to the same saturation component to the total number of pixel points of the virtual scene image, to obtain the ratio corresponding to each saturation component respectively; Using the plurality of saturation components as the abscissa values and the ratio corresponding to each saturation component as the ordinate values, generating an initial saturation component histogram in ascending order of the numerical values of the saturation components, where the initial saturation component histogram includes a plurality of initial saturation rectangular bars, and the number of the initial saturation rectangular bars is the same as the number of the saturation components; Removing the initial saturation rectangular bars at the edge positions and accounting for b% of the total amount in the initial saturation component histogram, and stretching the height values of the remaining initial saturation rectangular bars by 1 / (1 - b%) times, to obtain the saturation component histogram.

8. The method according to claim 1, characterized in that Generating the color gradient map in the initial color space based on the lightness component gradient map, saturation component gradient map, and hue component value includes: Generating a color gradient map in the HSV color space based on the lightness component gradient map, saturation component gradient map, and hue component value; Converting the color gradient map in the HSV color space from the HSV color space to the initial color space, to obtain the color gradient map in the initial color space.

9. A color gradient map generation device, characterized in that The apparatus includes: A scene image acquisition unit, configured to acquire a virtual scene image, where the virtual scene image is an image of a virtual scene where a virtual character is located; A color space conversion unit, configured to convert the initial color space to which the virtual scene image belongs to the HSV color space, where the HSV color space includes a lightness component, a saturation component, and a hue component; A lightness gradient map unit, configured to obtain a lightness component gradient map of a color gradient map to be generated according to the lightness component of the converted virtual scene image, where the lightness component gradient map is determined based on the lightness component histogram of the converted virtual scene image; A saturation gradient map unit, configured to obtain a saturation component gradient map of the color gradient map to be generated according to the saturation component of the converted virtual scene image, where the saturation component gradient map is determined based on the saturation component histogram of the converted virtual scene image; A hue component value unit, configured to calculate the hue component value of the color gradient map to be generated according to the hue component of the converted virtual scene image; A gradient map generation unit, configured to generate a color gradient map in the initial color space based on the lightness component gradient map, saturation component gradient map, and hue component value; the color gradient map is a long strip-shaped gradient map, and the color changes gradually from one end to the other end of the long strip-shaped gradient map; The hue component value unit is further configured to calculate an average value of the hue components of the converted virtual scene image, where the average value is the hue component value of the color gradient map to be generated.

10. An electronic device, characterized in that It includes a processor and a memory, and the memory stores multiple instructions; the processor loads the instructions from the memory to execute the steps in the color gradient map generation method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the color gradient map generation method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Image enhancement method and device and computing equipment

    CN109919846A