User interface background image generation method and device and electronic equipment
By blurring the user's avatar and detecting its hue to generate a mask image, the problem of mismatch between the user interface background image and the avatar style is solved, the coordination of the interface and the user experience are improved, and resource consumption is reduced.
Patent Information
- Application Number
- CN202510806239.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-09-26
AI Technical Summary
The existing user interface background image cannot be adapted according to the visual style of the user's avatar, resulting in poor interface coordination, difficulty in dynamic adaptation, and consumption of a large amount of memory resources.
By blurring the user's portrait and detecting the hue, a mask image corresponding to the target color is generated, and the mask image is superimposed on the blurred image to generate a background image. The brightness and darkness are adjusted to enhance visual consistency and depth of field.
This achieves a high degree of coordination between the background image and the user's avatar, improving visual consistency and user experience while reducing generation time and memory usage.
Smart Images

Figure CN120707681A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method, device and electronic device for generating a user interface background image. Background Art
[0002] With the development of the internet, users' demand for personalization is growing. In many applications, user profile pictures have become an important identifier of their personal identity, possessing unique styles and characteristics. However, existing user interface background images cannot adapt to the visual style of user profile pictures, resulting in poor interface coordination. Summary of the Invention
[0003] In order to at least overcome the above-mentioned deficiencies in the prior art, the purpose of the present application is to provide a method, device and electronic device for generating a user interface background image.
[0004] In a first aspect, an embodiment of the present application provides a method for generating a user interface background image, the method comprising: Get the user's avatar; Performing image blurring processing on the user portrait to obtain a blurred image corresponding to the user portrait; Performing color tone detection on the user portrait to determine a target color, and generating a mask image corresponding to the target color based on the target color; Adding the mask image to the blurred image to obtain a target image; The target image is set as a background image of the user interface of the target user.
[0005] In a possible implementation, after the step of adding the mask image to the blurred image to obtain the target image, the method further includes: Perform brightness and darkness adjustment on the target image.
[0006] In a possible implementation, the step of adjusting the brightness of the target image includes: adding a black mask layer on the target image to darken the target image, wherein the transparency of the black mask layer includes 70%; Alternatively, a white mask is added to the target image to brighten the target image, wherein the transparency of the white mask is 70%.
[0007] In a possible implementation, the method further includes: The target image after darkening or brightening is selected according to the current time as the background image of the user interface of the target user.
[0008] In a possible implementation, the step of performing image blurring on the user portrait to obtain a blurred image corresponding to the user portrait includes: Obtaining image width information of the user's avatar; Determine the Gaussian blur radius according to the image width information; Gaussian blur processing is performed on the user portrait based on the Gaussian blur radius to obtain a blurred image corresponding to the user portrait.
[0009] In one possible implementation, the step of performing color tone detection on the user avatar to determine the target color includes: Performing color tone detection on the user avatar to determine the proportion of each color in the user avatar; Color extraction is performed on the user avatar according to the proportions corresponding to each color in the user avatar, and the color with the highest proportion in the user avatar is determined as the target color.
[0010] In one possible implementation, the step of performing color tone detection on the user avatar to determine the target color includes: Performing color tone detection on the user avatar to determine the proportion of each color in the user avatar; Performing color extraction on the user avatar according to the proportions of each color in the user avatar, and determining the color with the highest proportion in the user avatar as the main color; Obtain at least two candidate colors, and determine a color distance between the main color and each of the candidate colors based on a color distance algorithm; The candidate color corresponding to the minimum value of each color distance is determined as the target color.
[0011] In a second aspect, an embodiment of the present application further provides a user interface background image generating device, comprising: Receiving module, used to obtain user avatar; A blur processing module, configured to perform image blur processing on the user portrait to obtain a blurred image corresponding to the user portrait; a hue detection module, configured to perform hue detection on the user's avatar, determine a target color, and generate a mask image corresponding to the target color based on the target color; a mask adding module, configured to add the mask image to the blurred image to obtain a target image; A background setting module is configured to set the target image as the background image of the user interface of the target user.
[0012] In a third aspect, an embodiment of the present application further provides an electronic device, including: a memory for storing one or more programs; The processor implements the user interface background image generation method provided in the first aspect when the one or more programs are executed by the processor.
[0013] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored, characterized in that when the computer program is executed by a processor, the user interface background image generation method provided in the first aspect above is implemented.
[0014] Based on any one of the above aspects, the user interface background image generation method, device and electronic device provided in the embodiments of the present application can achieve high coordination between the background image and the user avatar and improve visual consistency by superimposing a mask image corresponding to the target color on the blurred image corresponding to the user avatar to obtain the background image of the user interface. In addition, by superimposing the blurred image and the mask image, the depth of field can be enhanced while weakening the details of the avatar, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.
[0016] Figure 1 This is a flowchart of the method for generating a user interface background image provided in this embodiment; Figure 2 This is a second flow chart of the method for generating a user interface background image provided in this embodiment; Figure 3 A schematic diagram of sub-steps of step S120 provided in this embodiment; Figure 4 This is one of the sub-step schematic diagrams of step S130 provided in this embodiment; Figure 5 The second sub-step diagram of step S130 provided in this embodiment; Figure 6a A schematic diagram of a user avatar provided in this embodiment; Figure 6b A schematic diagram of a background image provided in this embodiment; Figure 7 A schematic structural block diagram of an electronic device provided in this embodiment; Figure 8This is a schematic diagram of the functional modules of the device for generating a user interface background image provided in this embodiment.
[0017] Icons: 700 - electronic device; 710 - processor; 720 - computer-readable storage medium; 730 - user interface background image generating device; 731 - receiving module; 732 - blur processing module; 733 - hue detection module; 734 - mask adding module; 735 - background setting module. DETAILED DESCRIPTION
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Generally, the components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations.
[0019] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for protection, but merely represents selected embodiments of the present application. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments in the present application without creative work are within the scope of protection of the present application.
[0020] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not require further definition or explanation in subsequent drawings.
[0021] In the description of this application, it should be noted that the terms "upper" and "lower" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, or the orientations or positional relationships in which the product of this application is typically placed when in use. These terms are intended solely to facilitate the description of this application and simplify the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, be constructed, or operate in a specific orientation. Therefore, they should not be construed as limitations on this application. Furthermore, the terms "first" and "second" and the like are used solely for distinction and should not be construed as indicating or implying relative importance.
[0022] It should be noted that, in the absence of conflict, different features in the embodiments of the present application can be combined with each other.
[0023] The inventors' research has revealed that user interface background images are typically designed using fixed colors or preset templates. For example, some minimalist apps might choose basic colors like white, black, or gray as their backgrounds to create a clean, simple visual effect. Preset templates are pre-designed background patterns or styles. Developers can choose the appropriate template and apply it to their interfaces based on different application scenarios and themes, making it easier for them to quickly build interfaces.
[0024] However, the background images generated by these two methods cannot adapt to the visual style of the user's profile picture, and dynamic adaptation is difficult. For example, if the user's profile picture uses a colorful, artistic anime-style image, but the background image used is a monotonous gray tone, this creates a strong visual contrast between the profile picture and the background, making it impossible to form a harmonious and unified overall effect, resulting in poor interface coordination and a reduced user experience. Alternatively, when the background image is cropped and scaled, it may cause the image to be disproportionate, content to be missing, or deformed, resulting in a noticeable sense of disconnection between the background image and other interface elements.
[0025] Furthermore, to address the issue of background image adaptation for user avatars or different usage scenarios, some developers manually design background adaptation methods. However, this approach leads to excessive memory usage and low efficiency. When an application starts or switches backgrounds, the corresponding background image file needs to be loaded, which consumes a large amount of memory resources.
[0026] This embodiment provides a solution that can solve the above-mentioned problem. The specific implementation methods of this application are described in detail below with reference to the accompanying drawings.
[0027] Please refer to Figure 1 , Figure 1 This is a flow chart of the method for generating a user interface background image provided in this embodiment. The method for generating a user interface background image may include the following steps.
[0028] Step S110: Obtain the user's profile picture.
[0029] In this embodiment, a user avatar corresponding to the target user may be obtained, wherein the user avatar may be an image in RGB format.
[0030] Exemplarily, the user avatar may be square, and the size of the user avatar may be 1024×1024 px.
[0031] Step S120: performing image blurring processing on the user portrait to obtain a blurred image corresponding to the user portrait.
[0032] In this embodiment, an image blurring processing technique may be used to process the user portrait obtained in step S110 to obtain a corresponding blurred image, wherein the blurred image may retain the outline of the user portrait but eliminate details of the user portrait.
[0033] For example, the image blurring technique may be Gaussian blurring, which is typically used to reduce image noise and detail levels. From a mathematical perspective, Gaussian blurring is the convolution of an image with a normal distribution. Since the normal distribution is also called a Gaussian distribution, this technique is called Gaussian blurring.
[0034] Step S130 , performing color tone detection on the user portrait, determining a target color, and generating a mask image corresponding to the target color according to the target color.
[0035] In this embodiment, a color tone detection may be performed on the user portrait acquired in step S110 to determine a target color, and a corresponding mask image may be generated according to the target color.
[0036] In some examples, the target color can be the color that has the highest percentage in the user's profile picture. For example, if the color that has the highest percentage in the user's profile picture is red, the target color can be red, and the generated mask image can also be a red mask image. If the color that has the highest percentage in the user's profile picture is blue, the target color can be blue, and the generated mask image can also be a blue mask image.
[0037] Step S140: adding the mask image to the blurred image to obtain a target image.
[0038] In this embodiment, the mask image obtained in step S130 may be superimposed on the blurred image obtained in step S120 to generate a target image.
[0039] In some examples, a mask image of a first transparency may be superimposed on the blurred image to obtain a target image. For details, please refer to the following formula:
[0040] in, can represent the target image, Can represent blurred images, Can represent mask images, It can indicate the first transparency.
[0041] Exemplarily, the value of the first transparency may be 50%, that is, a 50% mask image may be superimposed on the blurred image.
[0042] Step S150: setting the target image as the background image of the user interface of the target user.
[0043] In this embodiment, the target image obtained in step S140 may be set as the background image of the user interface (UI) of the target user, so as to achieve a high degree of adaptation between the background image and the user's avatar.
[0044] Specifically, before setting the target image as the background image, you can also perform edge softening and color smoothing on the target image to avoid visual discontinuity. In addition, when exporting the target image, you can export it to PNG or JPG format to adapt to different terminal resolutions.
[0045] It can be seen that based on the above design, the user interface background image generation method provided in the embodiment of the present application can achieve a high degree of coordination between the background image and the user avatar and improve visual consistency by superimposing the mask image corresponding to the target color on the blurred image corresponding to the user avatar to obtain the background image of the user interface. In addition, by superimposing the blurred image and the mask image, the depth of field can be enhanced while weakening the details of the avatar, thereby improving the user experience.
[0046] In addition, the user interface background image generation method provided in the embodiment of the present application does not require pre-stored background image templates, and the time consumption for generating background images is relatively short (for example, for a 1080p user avatar, the generation time can be less than 50 milliseconds), which can improve resource utilization.
[0047] In a possible implementation, after the mask image is added to the blurred image to obtain the target image, the brightness of the target image may be adjusted.
[0048] After superimposing the mask image corresponding to the target color on the blurred image, the target image may have uneven brightness and darkness. Therefore, in this embodiment, the brightness and darkness of the target image can be adjusted to neutralize the brightness and darkness differences of the target image color, thereby improving the user experience.
[0049] In one possible implementation, see Figure 2 When adjusting the brightness and darkness of the target image, the method for generating a user interface background image may further include the following steps.
[0050] Step S210 , adding a black mask layer on the target image to darken the target image, wherein the transparency of the black mask layer is 70%.
[0051] After superimposing the mask image corresponding to the target color on the blurred image, some areas of the target image may be too bright. Therefore, in this embodiment, a black mask can be superimposed on the target image to reduce the color brightness in the target image, avoid local overexposure, and make the overall background tone more uniform. By superimposing the black mask, the depth of field can be enhanced while weakening the details of the user's portrait.
[0052] In addition, you can set the transparency of the black mask to 70%. The black mask can be in RGBA format, where R represents the red channel and the red channel value of the black mask is 0, G represents the green channel and the green channel value of the black mask is 0, B represents the blue channel and the blue channel value of the black mask is 0, and A represents the transparency channel and the transparency channel value of the black mask can be 0.7.
[0053] It should be noted that the transparency of the black mask is not limited to 70%, but can also be 50%, 90%, etc., and can be adjusted according to actual needs, and is not specifically limited here.
[0054] Specifically, the formula for superimposing a black mask on the target image is as follows:
[0055] in, It can represent the target image after darkening. It can represent the target image before darkening. Can represent a black mask, It can represent the transparency of the black mask. .
[0056] Step S220 , or, adding a white mask layer on the target image to brighten the target image, wherein the transparency of the white mask layer is 70%.
[0057] After superimposing the mask image corresponding to the target color on the blurred image, it may cause the brightness of some areas of the target image to be too low. Therefore, in this embodiment, a white mask can be superimposed on the target image to increase the brightness of the target image, strengthen the light-colored areas in the target image, and make the overall background tone more uniform. In addition, by superimposing the white mask, the depth of field can be enhanced while weakening the details of the user's portrait.
[0058] In addition, you can set the transparency of the white mask to 70%. The white mask can be in RGBA format, where R represents the red channel and the red channel value of the white mask is 255, G represents the green channel and the green channel value of the white mask is 255, B represents the blue channel and the blue channel value of the white mask is 255, and A represents the transparency channel and the transparency channel value of the white mask can be 0.7.
[0059] It should be noted that the transparency of the white mask is not limited to 70%, but can also be 50%, 90%, etc., and can be adjusted according to actual needs, and is not specifically limited here.
[0060] Specifically, the formula for superimposing a white mask on the target image is as follows:
[0061] in, It can represent the target image after brightening processing. It can represent the target image before brightening. Can represent a white mask, It can indicate the transparency of the white mask. .
[0062] In a possible implementation, after a black mask or a white mask is superimposed on the target image, the target image after darkening or brightening may be selected as the background image of the user interface of the target user according to the current time.
[0063] In this embodiment, two target images that have been subjected to a darkening process and a brightening process respectively may be acquired in advance, and one of the target images may be selected as the background image according to the current time.
[0064] For example, if the current time is daytime, the target image after brightening processing can be selected as the background image of the target user's user interface to adapt to high ambient light and reduce screen glare; if the current time is night, the target image after darkening processing can be selected as the background image of the target user's user interface to reduce background brightness, reduce blue light stimulation, and avoid visual fatigue at night.
[0065] In a possible implementation, a fixed Gaussian blur radius is used to blur the user portrait. For example, the user portrait may be blurred by a Gaussian kernel ( ) to perform a convolution operation to generate a blurred image.
[0066] In another possible implementation, please refer to Figure 3 , step S120 may include the following sub-steps.
[0067] Step S121: Obtain image width information of the user avatar.
[0068] Step S122: determining a Gaussian blur radius according to the image width information.
[0069] Step S123 , performing Gaussian blur processing on the user portrait based on the Gaussian blur radius to obtain a blurred image corresponding to the user portrait.
[0070] In this embodiment, the image width information of the user portrait can be obtained first, and then the blur parameter of the Gaussian blur (such as the standard deviation σ) can be calculated based on the image width information, and the Gaussian blur radius can be determined based on the blur parameter, so that the user portrait is blurred based on the Gaussian blur radius to obtain a corresponding blurred image.
[0071] For example, ,in, is a constant, The value of can be 0.005.
[0072] It should be noted that The value is not limited to 0.005, and can also be 0.001, 0.008, etc., and can be adjusted according to actual needs, and is not specifically limited here.
[0073] When blurring a user's portrait using a fixed Gaussian blur radius, if the user's portrait is a low-resolution image, the portrait may be overly blurred. If the user's portrait is a high-resolution image, the blurring effect may be poor and some details may not be weakened.
[0074] Therefore, in this embodiment, the Gaussian blur radius can also be determined by the image width information of the user portrait, and dynamic adjustment of the Gaussian blur radius can be achieved, so that the blur effect of the Gaussian blur is adapted to the resolution of the user portrait, ensuring that user portraits of different resolutions can obtain visually consistent blur intensity.
[0075] In one possible implementation, see Figure 4 , step S130 may include the following sub-steps.
[0076] Step S131 : performing color tone detection on the user avatar to determine the proportion of each color in the user avatar.
[0077] In this embodiment, a general open source library may be used to detect the color tone of the user's avatar to determine the proportion of each color in the user's avatar.
[0078] Specifically, a Median Cut Quantization algorithm may be used to calculate the values of the R, G, and B channels of all pixels in the user's avatar, thereby determining the proportion of each color in the user's avatar.
[0079] Step S132 , performing color extraction on the user avatar according to the proportions of each color in the user avatar, and determining the color with the highest proportion in the user avatar as the target color.
[0080] In this embodiment, based on the proportions of each color in the user avatar obtained in step S131, the color with the highest proportion in the user avatar can be extracted as the target color, and a mask image corresponding to the target color can be generated. In this way, the coordination between the background image and the user avatar can be improved.
[0081] In one possible implementation, see Figure 5 , step S130 may further include the following sub-steps.
[0082] Step S133: performing color tone detection on the user avatar to determine the proportion of each color in the user avatar.
[0083] Step S134 , performing color extraction on the user avatar according to the proportions of the respective colors in the user avatar, and determining the color with the highest proportion in the user avatar as the main color.
[0084] Step S135 , obtaining at least two candidate colors, and determining the color distance between the main color and each candidate color based on a color distance algorithm.
[0085] Step S136 : determining the candidate color corresponding to the minimum value among the color distances as the target color.
[0086] In this embodiment, for some scenes (e.g., a community), multiple candidate colors may be obtained first. Then, the color distance between the primary color obtained in step S134 and each candidate color may be calculated using a Euclidean distance algorithm or a LAB space distance algorithm. The smaller the color distance, the closer the candidate color is to the primary color. Therefore, the candidate color with the minimum color distance may be selected as the target color. The candidate color may be a pre-set color different from the primary color.
[0087] For example, for some application software's super-topic communities, multiple candidate colors can be determined based on the community's content. For example, if the community's content is about games, dark blue and purple can be used as candidate colors; if the community's content is about the anime and manga, pink and white can be used as candidate colors. The target color is then determined based on the color closest to the main color among the multiple candidate colors.
[0088] In some examples, when calculating the color distance between the primary color and each candidate color using the LAB space distance algorithm, the colors may be first converted to the LAB space, and then the Euclidean distance between the two colors may be calculated, that is: ,in, 、 、 It can represent the difference between the main color and the candidate color in different components. represents the color distance between the main color and the candidate color, The smaller the value, the closer the main color is to the candidate color. In LAB space, L represents lightness, A represents the difference between red and green, and B represents the difference between blue and yellow.
[0089] In the above design, by selecting the candidate color closest to the main color as the target color and generating the corresponding mask image based on the target color, it is possible to preserve the personalization of the user's avatar while meeting the community's visual consistency needs and avoiding interface clutter.
[0090] Please refer to Figure 6a and Figure 6b , Figure 6a A schematic diagram illustrating the user avatar obtained in this embodiment. Figure 6b The schematic diagram of the background image of the user interface obtained in this embodiment is shown. It can be seen that the user portrait and the background image are highly coordinated, which can improve the aesthetics of the user interface.
[0091] Based on the same inventive concept, this embodiment also provides an electronic device 700, please refer to Figure 7 , Figure 7 The block diagram of the electronic device 700 is shown as an example. The electronic device 700 includes a user interface background image generating device 730 , a computer-readable storage medium 720 , and a processor 710 .
[0092] The computer-readable storage medium 720 and the processor 710 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these elements can be electrically connected to each other via one or more communication buses or signal lines. The user interface background image generating device 730 includes a plurality of software function modules that can be stored in the computer-readable storage medium 720 in the form of software or firmware or solidified in the operating system (OS) of the user interface background image generating device 730. The processor 710 is used to execute the executable modules stored in the computer-readable storage medium 720, such as the software function modules and computer programs included in the user interface background image generating device 730.
[0093] The computer-readable storage medium 720 may be, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The computer-readable storage medium 720 is used to store a program, and the processor 710 executes the program after receiving an execution instruction.
[0094] The processor 710 may be an integrated circuit chip with signal processing capabilities. The processor 710 may be a general-purpose processor, including a central processing unit (CPU) or a network processor (NP). It may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor 710 may be a microprocessor or any conventional processor.
[0095] Please refer to Figure 8 The present embodiment also provides a user interface background image generating device 730. The user interface background image generating device 730 includes multiple functional modules that can be stored in a computer-readable storage medium 720 in software form. Functionally, the user interface background image generating device 730 may include a receiving module 731, a blur processing module 732, a hue detection module 733, a mask adding module 734, and a background setting module 735. Among them: The receiving module 731 can be used to obtain a user's profile picture.
[0096] In this embodiment, the receiving module 731 can be used to perform Figure 1 As shown in step S110, for a detailed description of the receiving module 731, reference may be made to the description of step S110.
[0097] The blur processing module 732 may be configured to perform image blur processing on the user portrait to obtain a blurred image corresponding to the user portrait.
[0098] In this embodiment, the fuzzy processing module 732 can be used to perform Figure 1 As shown in step S120 , for a detailed description of the fuzzy processing module 732 , reference may be made to the description of step S120 .
[0099] The color tone detection module 733 can be used to perform color tone detection on the user portrait, determine a target color, and generate a mask image corresponding to the target color based on the target color.
[0100] In this embodiment, the hue detection module 733 can be used to perform Figure 1 As shown in step S130 , for a detailed description of the hue detection module 733 , reference may be made to the description of step S130 .
[0101] The mask adding module 734 may be configured to add the mask image to the blurred image to obtain a target image.
[0102] In this embodiment, the mask adding module 734 can be used to perform Figure 1 As shown in step S140, for the detailed description of the mask adding module 734, please refer to the description of step S140.
[0103] The background setting module 735 may be configured to set the target image as the background image of the user interface of the target user.
[0104] In this embodiment, the background setting module 735 can be used to perform Figure 1 As shown in step S150, for the detailed description of the background setting module 735, reference may be made to the description of step S150.
[0105] In summary, the embodiments of the present application provide a method, device and electronic device for generating a user interface background image. By superimposing a mask image corresponding to a target color on a blurred image corresponding to a user avatar to obtain a background image of the user interface, a high degree of coordination between the background image and the user avatar can be achieved, thereby improving visual consistency. In addition, by superimposing the blurred image and the mask image, the depth of field can be enhanced while weakening the details of the avatar, thereby improving the user experience.
[0106] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
[0107] It will be apparent to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above and that the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the present application is defined by the appended claims, not the foregoing description, and all variations within the meaning and range of equivalents of the claims are intended to be included therein. Any reference sign in a claim should not be construed as limiting the claim to which it relates.
Claims
1. A method for generating a user interface background image, characterized in that: The method comprises: Get the user's avatar; Performing image blurring processing on the user portrait to obtain a blurred image corresponding to the user portrait; Performing color tone detection on the user portrait to determine a target color, and generating a mask image corresponding to the target color based on the target color; Adding the mask image to the blurred image to obtain a target image; The target image is set as a background image of the user interface of the target user.
2. The method for generating a user interface background image according to claim 1, wherein: After the step of adding the mask image to the blurred image to obtain the target image, the method further includes: Perform brightness and darkness adjustment on the target image.
3. The method for generating a user interface background image according to claim 2, wherein: The step of adjusting the brightness and darkness of the target image includes: adding a black mask layer on the target image to darken the target image, wherein the transparency of the black mask layer includes 70%; Alternatively, a white mask is added to the target image to brighten the target image, wherein the transparency of the white mask is 70%.
4. The method for generating a user interface background image according to claim 3, wherein: The method further comprises: The target image after darkening or brightening is selected according to the current time as the background image of the user interface of the target user.
5. The method for generating a user interface background image according to any one of claims 1 to 4, characterized in that: The step of performing image blurring processing on the user portrait to obtain a blurred image corresponding to the user portrait includes: Obtaining image width information of the user's avatar; Determine the Gaussian blur radius according to the image width information; Gaussian blur processing is performed on the user portrait based on the Gaussian blur radius to obtain a blurred image corresponding to the user portrait.
6. The method for generating a user interface background image according to any one of claims 1 to 4, characterized in that: The step of detecting the color tone of the user portrait and determining the target color includes: Performing color tone detection on the user avatar to determine the proportion of each color in the user avatar; Color extraction is performed on the user avatar according to the proportions corresponding to each color in the user avatar, and the color with the highest proportion in the user avatar is determined as the target color.
7. The method for generating a user interface background image according to any one of claims 1 to 4, characterized in that: The step of detecting the color tone of the user portrait and determining the target color includes: Performing color tone detection on the user avatar to determine the proportion of each color in the user avatar; Performing color extraction on the user avatar according to the proportions of each color in the user avatar, and determining the color with the highest proportion in the user avatar as the main color; Obtain at least two candidate colors, and determine a color distance between the main color and each of the candidate colors based on a color distance algorithm; The candidate color corresponding to the minimum value of each color distance is determined as the target color.
8. A user interface background image generating device, characterized in that: include: Receiving module, used to obtain user avatar; A blur processing module, configured to perform image blur processing on the user portrait to obtain a blurred image corresponding to the user portrait; a hue detection module, configured to perform hue detection on the user's avatar, determine a target color, and generate a mask image corresponding to the target color based on the target color; a mask adding module, configured to add the mask image to the blurred image to obtain a target image; A background setting module is configured to set the target image as the background image of the user interface of the target user.
9. An electronic device, characterized in that: include: a memory for storing one or more programs; The processor implements the method according to any one of claims 1 to 7 when the one or more programs are executed by the processor.
10. A computer-readable storage medium, characterized in that A computer program is stored thereon, characterized in that when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.