Image display method and electronic device

By generating a gradient background, using the fractal model technology of electronic devices, the single background problem caused by mismatch in size when displaying pictures by electronic devices is solved, and the display effect and clarity are improved.

CN118485741BActive Publication Date: 2024-12-27HONOR DEVICE CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410046021.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2023-11-08
Filing Date
2024-01-10
Publication Date
2024-12-27
Estimated Expiration
2044-01-10

Smart Images

  • Figure CN118485741B_ABST
    Figure CN118485741B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a method for displaying an image and an electronic device, which relates to the field of image processing, and can generate a display background of an image according to the colors in the image, so that the transition between the image and the surrounding display background is softer, thereby improving the display effect. The method includes: obtaining the display size of the image. When the display size of the image is smaller than the size of the display area in the electronic device, the pixel ratio and brightness of each color in the image are obtained. The background color is generated according to the pixel ratio and brightness of each color in the image. Among them, when the sum of the pixel ratios of three colors in the image is greater than a preset first threshold, and the sum of the pixel ratios of any two of the three colors is less than the first threshold, the three colors are processed according to the brightness of the three colors to obtain the background color. The background color is input into a preset fractal model to generate a gradient color background. The gradient color background is displayed synchronously when the image is displayed.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office on November 8, 2023, with application number 202311484952.0 and invention name “A method and electronic device for intelligent color selection to generate a blurred gradient background”, the entire contents of which are incorporated by reference in this application. Technical Field

[0002] The embodiments of the present application relate to the field of image processing, and in particular to a picture display method and an electronic device. Background Art

[0003] When a display screen of an electronic device displays a picture, the picture may not fill the entire display area of ​​the display screen due to reasons such as the display size of the display screen not matching the picture size.

[0004] Electronic devices usually use white or black to fill the unfilled display area of ​​the above picture. This will cause the display background around the picture to be relatively simple, the picture and the surrounding display background to be relatively separated, and the display effect is poor. Summary of the invention

[0005] An image display method and electronic device provided in the embodiments of the present application can generate a display background around the image according to the colors in the image, so that the transition between the image and the display background around the image is softer and more natural, thereby improving the overall display effect.

[0006] In order to achieve the above purpose, the embodiment of the present application adopts the following technical solution:

[0007] In a first aspect, a method for displaying an image is provided, which is applied to an electronic device, wherein the electronic device includes an image to be displayed. The method comprises: obtaining a display size of the image. When the display size of the image is smaller than the size of the display area in the electronic device, obtaining the pixel ratio and brightness of each color in the image. A background color is generated according to the pixel ratio and brightness of each color in the image. Among them, when the sum of the pixel ratios of three colors in the image is greater than a preset first threshold value, and the sum of the pixel ratios of any two of the three colors is less than the first threshold value, the three colors are processed according to the brightness of the three colors to obtain the background color. The background color is input into a preset fractal model to generate a gradient color background. The gradient color background is composed of gradient colors of at least one background color at different brightnesses. The gradient color background is displayed synchronously when the image is displayed.

[0008] Based on this scheme, there are three colors in the picture whose pixel proportions are greater than the first threshold, and the sum of the pixel proportions of any two colors in the three colors is less than the first threshold, indicating that most of the colors in the picture are these three colors, and the proportions of these three colors are relatively large. Therefore, the embodiment of the present application generates background colors according to the three colors, which can ensure that the transition between the background generated according to the background colors and the picture is relatively natural and soft, which is conducive to improving the display effect. In addition, the electronic device can also remove the extreme colors in the above three colors. Among them, extreme colors refer to colors with extremely high brightness and colors with extremely low brightness, colors with extremely low brightness refer to colors with brightness less than the minimum value of the first interval, and colors with extremely high brightness refer to colors with brightness greater than the maximum value of the first interval. The electronic device can also reduce the brightness of colors with higher brightness, such as reducing the brightness of colors whose brightness is in the first interval and greater than the second threshold to the maximum value of the first interval. In this way, it can be ensured that the background generated according to the background colors does not affect the display clarity of other display contents around the picture, such as text, icons, etc., which is conducive to improving the display effect.

[0009] In a possible implementation, the three colors are processed according to the brightness of the three colors to obtain the background color, including: reducing the brightness of the color that meets the first condition to a preset second threshold, and eliminating the color that meets the second condition. The color whose brightness is reduced to the preset second threshold is used as the background color. The first condition is that the brightness of the color is within a preset first interval and greater than the second threshold. The second condition is that the brightness of the color is outside the first interval.

[0010] In a possible implementation, the background color is generated according to the pixel ratio and brightness of each color in the picture, and further includes: when the pixel ratio of the first color in the picture is greater than the first threshold, and the brightness of the first color is greater than the minimum value of the first interval and less than the second threshold, the first color is used as the background color. When the pixel ratio of the first color in the picture is greater than the first threshold, and the brightness of the first color is less than the minimum value of the first interval, the brightness of the first color is increased to the minimum value of the first interval to obtain the background color. When the pixel ratio of the first color in the picture is greater than the first threshold, and the brightness of the first color is greater than the second threshold, the brightness of the first color is reduced to the second threshold to obtain the background color.

[0011] In a possible implementation, the background color is generated according to the pixel proportion and brightness of each color in the image, and further includes: when the sum of the pixel proportions of n colors in the image is greater than a preset first threshold, and the sum of the pixel proportions of any n-1 colors among the n colors is less than the first threshold, the n colors are subjected to a first processing according to the brightness of the n colors to obtain at least one background color. n is an integer of 2 or greater than or equal to 4. The first processing includes: reducing the brightness of the color that meets the first condition to a preset second threshold, and eliminating the color that meets the second condition. The first condition is: the brightness of the color is in a preset first interval and is greater than the second threshold. The second condition is: the brightness of the color is outside the first interval.

[0012] In a possible implementation, the background colors include m types, where m is a positive integer. Inputting the background colors into a preset fractal model to generate a gradient color background includes: inputting the m types of background colors into a preset fractal model. The fractal model divides the display area of ​​the electronic device into m areas. Gradient colors of a background color at different brightnesses are filled in the m areas respectively to obtain a gradient color background.

[0013] In a possible implementation, among the m regions, background colors of adjacent regions are adjacent colors in the color wheel.

[0014] In a possible implementation, the display size of the picture is smaller than the size of the display area in the electronic device, including: the picture is an album picture in a music playback interface, and the picture is a picture in a standby screen interface.

[0015] In a possible implementation, the gradient color background is synchronously displayed when the picture is displayed, including: setting the gradient color background in a layer below the picture, and displaying it synchronously with the picture.

[0016] In a possible implementation, the first threshold is 80%, the second threshold is 60, and the first interval is greater than 10 and less than 90.

[0017] In a second aspect, an electronic device is provided, the electronic device comprising one or more processors, one or more memories, and a display screen. The one or more processors are connected to the display screen, the one or more memories are coupled to the one or more processors, and the one or more memories store a computer program. When the one or more processors execute the computer program, the electronic device executes the image display method as described in any one of the first aspects.

[0018] In a third aspect, a computer-readable storage medium is provided, the computer-readable storage medium comprising a computer program, and when the computer program is run, the image display method as described in any one of the first aspects is executed.

[0019] In a fourth aspect, a chip system is provided, the chip comprising a processing circuit and an interface. The processing circuit is used to call and run a computer program stored in a storage medium from a storage medium to execute a picture display method as in the first aspect and any one of its possible designs.

[0020] It should be understood that the technical solutions provided in the second, third and fourth aspects above and their technical features can all correspond to the image display methods provided in the first aspect and its possible designs, so the beneficial effects that can be achieved are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 A schematic diagram of displaying a picture in a mobile phone provided in an embodiment of the present application;

[0022] Figure 2 A schematic diagram of the composition of an electronic device provided in an embodiment of the present application;

[0023] Figure 3 A schematic diagram of an electronic device provided in an embodiment of the present application;

[0024] Figure 4 A schematic diagram of a mobile phone usage scenario provided in an embodiment of the present application;

[0025] Figure 5 A schematic diagram of another mobile phone usage scenario provided in an embodiment of the present application;

[0026] Figure 6 A schematic diagram of a flow chart of a method for displaying an image provided in an embodiment of the present application;

[0027] Figure 7 A schematic diagram of an execution flow of generating background color provided in an embodiment of the present application;

[0028] Figure 8 A schematic diagram of another execution flow of generating background color provided in an embodiment of the present application;

[0029] Fig. 9 A schematic diagram of another execution flow of generating background color provided in an embodiment of the present application;

[0030] Fig.10 A schematic diagram of another execution flow of generating background color provided in an embodiment of the present application;

[0031] Fig.11 A schematic diagram of a fractal method for a fractal model provided in an embodiment of the present application;

[0032] Fig.12 A schematic diagram of a fractal method for another fractal model provided in an embodiment of the present application;

[0033] Fig.13 A schematic diagram of a fractal method for another fractal model provided in an embodiment of the present application;

[0034] Fig.14 A schematic diagram of a fractal method for another fractal model provided in an embodiment of the present application. DETAILED DESCRIPTION

[0035] The words "first", "second" and "third" in the embodiments of the present application are used to distinguish different objects rather than to limit a specific order. In addition, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way.

[0036] For ease of understanding, the application background of the image display method provided in the embodiment of the present application is explained below.

[0037] Please refer to Figure 1 , is a schematic diagram of displaying a picture in a mobile phone provided in an embodiment of the present application. Figure 1 As shown, the mobile phone displays a picture 101. It can be seen that the picture 101 does not fill the display area of ​​the mobile phone display.

[0038] In the related solution, the electronic device will use white, black and other colors to fill the unfilled display area of ​​the above picture 101 as the display background around the picture 101. Since the contrast between the color in the picture 101 and black and white is usually large, using black or white as the display background around the picture 101 will make the color difference between the picture 101 and the surrounding display background too large, resulting in a more fragmented visual effect, affecting the overall display effect of the picture.

[0039] In order to solve the above problems, an image display method provided in an embodiment of the present application can generate a display background around the image according to the colors in the image, so that the transition between the image and the display background around the image is softer and more natural, thereby improving the overall display effect.

[0040] The scheme provided by the embodiment of the present application is described in detail below in conjunction with the accompanying drawings. It should be noted that the picture display method provided by the embodiment of the present application can be applied to an electronic device. The electronic device can be a device with a display function. For example, the electronic device can be a portable mobile device such as a mobile phone, a tablet computer, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, a media player, etc. The electronic device can also be a wearable electronic device such as a smart watch. The embodiment of the present application does not impose any special restrictions on the specific form of the device.

[0041] As an example, see Figure 2 , is a schematic diagram of the composition of an electronic device provided in an embodiment of the present application. The picture display method provided in the embodiment of the present application can be applied to Figure 2 In the electronic device 200 shown.

[0042] like Figure 2 As shown, the electronic device 200 may include a processor 201, a display screen 202, a communication module 203, etc.

[0043] The processor 201 may include one or more processing units, for example, the processor 201 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video stream codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated in one or more processors 201.

[0044] The controller may be the nerve center and command center of the electronic device 200. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0045] The processor 201 may also be provided with a memory for storing instructions and data.

[0046] The electronic device 200 implements the display function through a GPU, a display screen 202, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 202 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 201 may include one or more GPUs, and the GPU may execute program instructions to generate or change display information. In a possible implementation, in the picture display method provided in the embodiment of the present application, the display background around the picture can be generated by GPU rendering.

[0047] The display screen 202 is used to display images, video streams, etc. The display screen 202 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 200 may include 1 or N display screens 202, where N is a positive integer greater than 1.

[0048] The communication module 203 is used to implement the communication functions of the electronic device, such as making calls, answering calls, sending and receiving text messages, connecting to the Internet, etc.

[0049] In some implementations, the electronic device 200 may also include an external memory interface 205, an internal memory 206, a USB (universal serial bus, USB) interface 204, a charging management module 207, a power management module 208, a battery 209, an audio module 210, a sensor module 211, a camera 212, etc.

[0050] The external memory interface 205 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 200 .

[0051] The internal memory 206 may be used to store computer executable program codes, which include instructions. The processor 201 executes the instructions stored in the internal memory 206 to perform various functional applications and data processing of the electronic device 200.

[0052] The charging management module 207 is used to receive a charging input from an external power source from a charger to charge the battery 209 or the electronic device 209 .

[0053] The power management module 208 is connected to the battery 209, the charging management module 207 and the processor 201. The power management module 208 receives input from the battery 209 and / or the charging management module 207 to power the processor 201, the internal memory 206, the external memory, the display screen 202, the camera 212, and the communication module 203.

[0054] The battery 209 can be used to supply power to the electronic device 200. The audio module 210 can be used to play or receive audio. The sensor module 211 is used to sense and obtain different signals. The camera 212 allows the user to take photos or videos.

[0055] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 200. In other embodiments, the electronic device 200 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0056] Please refer to Figure 3 , is a schematic diagram of an electronic device provided in an embodiment of the present application. The picture display method provided in an embodiment of the present application is applied to Figure 2 When the electronic device 200 is shown, the software in the electronic device 200 can be divided into the following Figure 3 The application layer 301 , the hardware abstraction layer (HAL) 302 and the driver layer 303 are shown.

[0057] A plurality of applications may be installed in the application layer 301 , which may include an underlying display application for implementing a display function.

[0058] The hardware abstraction layer 302 is a software located between the operating system kernel and the hardware circuit, and is generally used to abstract the hardware to enable the interaction between the operating system and the hardware circuit at the logical layer. In the embodiment of the present application, the hardware abstraction layer 302 may include a display hardware abstraction layer that enables the interaction between the underlying display application and the display screen at the logical layer.

[0059] A plurality of drivers for driving hardware operation may be installed in the driver layer 303. In the embodiment of the present application, the driver layer 303 may include a display driver for driving the display screen 304 to operate.

[0060] It should be noted that the application layer 301, the hardware abstraction layer 302 and the driver layer 303 may also include other contents, and the software of the electronic device 200 may also be divided into other layers, which are not specifically limited here.

[0061] Combine the following Figure 2 The hardware structure of the electronic equipment provided and Figure 3 The software architecture of the electronic device provided is used to describe in detail the image display method provided in the embodiment of the present application.

[0062] It should be noted that the picture display method provided in the embodiment of the present application is applied to Figure 1 The scene shown is a scene in which a picture is displayed on the display screen of the electronic device, and the picture does not fill the display area of ​​the display screen.

[0063] Taking mobile phones as an example, there are many usage scenarios in mobile phones. Figure 1 The display scene shown.

[0064] For example, the mobile phone can display the interface of the local music player in response to the user clicking the icon of the local music player. Then, in response to the user clicking the music in the interface of the local music player, the mobile phone can enter the following Figure 4 The music playback interface shown. Please refer to Figure 4 , is a schematic diagram of a mobile phone usage scenario provided in an embodiment of the present application. Figure 4 As shown, the mobile phone will display the album cover picture 401 in the music playing interface of the local music player, and the album cover picture 401 usually does not fill the display area of ​​the display screen.

[0065] For another example, Standby is a display function in a mobile phone. A mobile phone that supports the Standby function will display a Standby interface after being placed horizontally for a period of time. The interface can display user-defined pictures, clocks, music playback interfaces, etc. The mobile phone can respond to detecting that the length of time it has been placed horizontally after the screen is off meets the preset time length, and enter the following state: Figure 5 The standby interface is shown. Please refer to Figure 5 , is a schematic diagram of another mobile phone usage scenario provided in an embodiment of the present application. Figure 5 As shown, the standby interface displays a user-defined image, which usually does not fill the display area of ​​the display screen.

[0066] For another example, when the lock screen image or wallpaper image set by the user for the mobile phone is smaller than the size of the mobile phone display screen, the lock screen image or wallpaper image will not fill the display area of ​​the display screen.

[0067] For another example, when a user views a picture in a mobile phone gallery or previews a slide show of pictures, if the size of the picture is smaller than the size of the mobile phone display, the picture will not fill the display area of ​​the display.

[0068] The image display method provided in the embodiment of the present application can be applied to any of the above-mentioned mobile phone usage scenarios. It should be understood that electronic devices may also have other usage scenarios where Figure 1 The display scenarios shown above are merely exemplary descriptions and do not limit the present application to these.

[0069] Please refer to Figure 6 , is a flow chart of a method for displaying an image provided by an embodiment of the present application. The method can be Figure 2 The electronic device shown is executed, for example, it can be executed by a mobile phone, and the electronic device includes a picture to be displayed. For ease of explanation, the picture to be displayed in the following embodiments is referred to as a picture. Figure 6 As shown, the method may include the following steps.

[0070] S601: Obtain the display size of the image.

[0071] Exemplarily, the display size of the picture is stored in the parameter information of the picture, and the parameter information of the picture may be pre-stored in the electronic device. The electronic device may determine the display size of the picture according to the parameter information of the picture.

[0072] S602: When the display size of the image is smaller than the size of the display area in the electronic device, obtain the pixel ratio and brightness of each color in the image.

[0073] The display size of the image is smaller than the size of the display area in the electronic device, indicating that the image cannot fill the display area of ​​the electronic device. For example, before the electronic device displays the album cover image in the music playback interface of the local music player, the image display method provided by the embodiment of the present application can be executed. For another example, before the electronic device displays the user-defined image in the standby interface, the image display method provided by the embodiment of the present application can also be executed.

[0074] The picture described in this application may include one color (or referred to as color) or multiple colors, for example, the picture may include a first color, a second color, a third color, etc. This application is described by taking the example of a picture including multiple colors.

[0075] Optionally, the pixel ratio of each color in the image refers to the ratio of the number of pixels of each color in the image to the total number of pixels in the image. For example, assume that the image includes a first color, a second color, and a third color. The total number of pixels in the image is t, the number of pixels of the first color is n1, the number of pixels of the second color is n2, and the number of pixels of the third color is n3. Then, the pixel ratio of the first color in the image is n1 / t, the pixel ratio of the second color is n2 / t, and the pixel ratio of the third color is n3 / t.

[0076] Optionally, the three elements of color include hue, brightness, and purity. Hue refers to the appearance of color and is the main basis for distinguishing colors. For example, green, red, etc. are describing the hue of color. Brightness is used to describe the brightness of color. A brightness of 0 indicates that the color is the darkest and appears black, and a brightness of 100 indicates that the color is the brightest and appears white. Purity is also called saturation, which refers to the vividness of color.

[0077] In the present application, at least one of the three elements of the type of color, the number of pixels of the color, and the color included in the picture can be used as the parameter information of the picture. The parameter information of the picture can be pre-stored in the electronic device. Subsequently, the electronic device can display the picture on the display screen based on the parameter information of the picture. For example, when the parameter information of the picture includes the type of color and the number of pixels of each color, the electronic device can calculate the ratio of the number of pixels of each color to the total number of pixels according to the parameter information of the picture to obtain the pixel proportion of each color in the picture. For another example, when the parameter information of the picture includes the three elements of each color, specifically including the brightness of each color, the electronic device can obtain the brightness of each color in the picture through the parameter information of the picture.

[0078] S603: Generate at least one background color according to the pixel proportion and brightness of each color in the image.

[0079] The background color may include one or several colors.

[0080] Here are some specific solutions for generating background colors.

[0081] In one possible scenario, there is only a first color in the picture, and the proportion of pixels of the first color is greater than a first threshold. In other words, there is only one color (ie, the first color) in the picture, and the proportion of pixels of the first color is greater than the first threshold.

[0082] In this scenario, the electronic device can determine the relationship between the brightness of the first color and the minimum value of the first interval (such as 10) and the second threshold value (such as 60). When the brightness of the first color is greater than the minimum value of the first interval and less than the second threshold value, the electronic device can use the first color as the background color. When the brightness of the first color is less than the minimum value of the first interval, the brightness of the first color is increased to the minimum value of the first interval to obtain the background color. When the brightness of the first color is greater than the second threshold value, the brightness of the first color is reduced to the second threshold value to obtain the background color. In this way, it can ensure that the transition between the background generated according to the background color and the picture is more natural and soft, and it can also ensure that the background generated according to the background color does not affect other displayed content around the picture.

[0083] Specifically, the process of generating background color in this scene can refer to the following Figure 7 As described in the corresponding embodiments. In each embodiment of the present application, the first threshold can be set as needed, for example, the first threshold can be a value between 75% and 85%, such as 80%. If the pixel proportion of a certain color is greater than the first threshold, it means that most of the colors in the picture are of that color. If the sum of the pixel proportions of n colors is greater than the first threshold, n≥2, and the sum of the pixel proportions of any n-1 colors among the n colors is less than the first threshold, it means that most of the colors in the picture are these n colors.

[0084] In another possible scenario, there are n colors in the picture, n is an integer greater than or equal to 2, the sum of pixel proportions of the n colors is greater than a preset first threshold, and the sum of pixel proportions of any n-1 colors among the n colors is less than the first threshold. In this scenario, the n colors can be processed based on their brightness to obtain at least one background color.

[0085] Specifically, processing the n colors based on the brightness of the n colors to obtain at least one background color may include: reducing the brightness of the colors that meet the first condition to a preset second threshold, eliminating the colors that meet the second condition, and obtaining at least one background color based on the colors whose brightness is reduced to the second threshold, such as using the colors whose brightness is reduced to the second threshold as the background color. The first condition is: the brightness of the color is in a preset first interval and is greater than the second threshold. The second condition is: the brightness of the color is outside the first interval. The brightness of the color outside the first interval may include that the brightness of the color is less than the minimum value of the first interval; or, the brightness of the color is greater than the maximum value of the first interval.

[0086] In each embodiment of the present application, the second threshold value can be set as needed, for example, the second threshold value is a value between 55 and 65, such as 60. The first interval can be set as needed, and the first interval can be called a brightness interval. Colors with brightness in the first interval meet the sensory requirements of users and are relatively comfortable brightness. Brightness outside the first interval can cause sensory discomfort to users. Colors with brightness outside the first interval can be replaced and described as extreme colors. Specifically, the minimum boundary value of the first interval can be a value between 8 and 12, such as 10; the maximum boundary value of the first interval can be a value between 88 and 92, such as 90. This will not be described in detail later.

[0087] Taking n=2 as an example, that is, when the sum of the pixel proportions of two colors in the picture is greater than the preset first threshold, and the sum of the pixel proportions of any one of the two colors is less than the first threshold, it means that most of the colors in the picture are these two colors, and the proportions of these two colors are both large. Therefore, the embodiment of the present application determines the background color based on the two colors, which can ensure that the transition between the background generated based on the background color and the picture is more natural and soft, which is conducive to improving the display effect.

[0088] In order to ensure that the background generated based on the background color does not affect the display clarity of other display contents around the picture, such as text, icons, etc., the electronic device can remove the extreme colors of the above two colors in the above scenario. That is, delete the colors with brightness less than the minimum value of the first interval (such as 10) and the colors with brightness greater than the maximum value of the first interval (such as 90). In addition, the electronic device can also reduce the brightness of the colors with higher brightness, such as reducing the brightness of the colors whose brightness is in the first interval and greater than the second threshold to the maximum value of the first interval.

[0089] Specifically, the process of generating background color in the n=2 scene can refer to the following Figure 8 As described in the corresponding embodiments.

[0090] Taking n=3 as an example, the sum of the pixel proportions of three colors in the picture is greater than the preset first threshold, and the sum of the pixel proportions of any two of the three colors is less than the first threshold. In this scenario, the electronic device can perform a first processing on the three colors according to their brightness to obtain at least one background color.

[0091] In the present application, the first processing may include: reducing the brightness of the color that meets the first condition to a preset second threshold value, and eliminating the color that meets the second condition. The first condition is: the brightness of the color is within the preset first interval and greater than the second threshold value. The second condition is: the brightness of the color is outside the first interval.

[0092] In the above scenario, the sum of the pixel proportions of the three colors is greater than the first threshold, and the sum of the pixel proportions of any two of the three colors is less than the first threshold, indicating that most of the colors in the picture are these three colors, and the proportions of these three colors are relatively large. Therefore, the embodiment of the present application generates background colors based on these three colors, which can ensure that the transition between the background generated based on the background colors and the picture is more natural and soft, which is conducive to improving the display effect.

[0093] In order to ensure that the background subsequently generated according to the background color does not affect the display clarity of other display contents around the picture, such as text, icons and other contents, the electronic device can remove the extreme colors of the above three colors in the above scenario. Among them, extreme colors refer to colors with extremely high brightness and colors with extremely low brightness, colors with extremely low brightness refer to colors with brightness less than the minimum value of the first interval (such as 10), and colors with extremely high brightness refer to colors with brightness greater than the maximum value of the first interval (such as 90). In addition, the electronic device can also reduce the brightness of colors with higher brightness, such as reducing the brightness of colors whose brightness is in the first interval and greater than the second threshold to the maximum value of the first interval.

[0094] Specifically, the process of generating background color in the n=3 scene can refer to the following Fig. 9 As described in the corresponding embodiments.

[0095] In the above picture, there is a scene where the sum of the pixel proportions of the three colors is greater than the preset first threshold, and the sum of the pixel proportions of any two of the three colors is less than the first threshold. The background color generation method can be extended to the scene where n is an integer greater than 3 in the picture, and will not be described in detail here. Specifically, the process of generating background color in the scene where n is an integer greater than 3 can refer to the following Fig.10 As described in the corresponding embodiments.

[0096] The above scenarios introduce the specific scheme for generating background colors. Figure 7-10 An execution flow of the above-mentioned specific scheme for generating background color is introduced. It should be noted that this execution flow is only one of the execution flows of the above-mentioned specific scheme for generating background color, and does not mean that the present application is limited thereto. For ease of explanation, in the following execution flow, the first interval is taken as (10, 90), the first threshold is taken as 80%, and the second threshold is taken as 60.

[0097] Please refer to Figure 7 , is a schematic diagram of an execution flow of generating background color provided by an embodiment of the present application. Figure 7 As shown, the process may include the following steps.

[0098] S701: Determine whether there are pixels of a single color in the image that account for more than 80%. If yes, execute S702; if no, execute Figure 8S801 in.

[0099] In the embodiment of the present application, the color in which the pixel proportion is greater than 80% may also be referred to as the first color.

[0100] S702, determine the relationship between the lightness of the color and 10, 60, 90. If the lightness of the color is greater than 10 and less than 60, execute S703a; if the lightness of the color is greater than 60, execute S703b; if the lightness of the color is less than 10, execute S703c.

[0101] S703a, using the color as the background color.

[0102] S703b, reducing the brightness of the color to 60 and using it as the background color.

[0103] S703c, increase the brightness of the color to 10 and use it as the background color.

[0104] It can be seen that Figure 7 The execution process shown corresponds to the scenario in the above embodiment where the sum of the pixel proportions of one and only one color in the picture is greater than the first threshold. Through this execution process, a background color with moderate brightness can be obtained, thereby ensuring that the transition between the background generated based on the background color and the picture is more natural and soft, and does not affect other displayed content around the picture.

[0105] If the electronic device determines in step S701 that the proportion of pixels of a single color not exceeding 80% in the image is not positive, the following steps may be performed: Figure 8 S801 in.

[0106] Please refer to Figure 8 , is another schematic diagram of an execution flow of generating background color provided by an embodiment of the present application. Figure 8 As shown, the process may include the following steps.

[0107] S801: Determine whether the sum of the pixel proportions of two colors in the image is greater than 80%. If yes, execute S802; if no, execute Fig. 9 The S901 in the.

[0108] S802, determine the relationship between the lightness of each color and 10, 60, 90. If the lightness of the color is greater than 10 and less than 60, execute S803a; if the lightness of the color is greater than 60 and less than 90, execute S803b; if the lightness of the color is less than 10 or greater than 90, execute S703c.

[0109] S803a, using the color as the background color.

[0110] S803b, reducing the brightness of the color to 60 and using it as the background color.

[0111] S803c, remove the color.

[0112] It can be seen that Figure 8 The execution flow shown corresponds to the scenario in which n is 2 in the above embodiment, that is, the sum of the pixel proportions of the two colors in the picture is greater than the preset first threshold, and the sum of the pixel proportions of any one of the two colors is less than the first threshold. Through this execution flow, extreme colors can be eliminated to obtain a background color with moderate brightness, thereby ensuring that the transition between the background generated according to the background color and the picture is more natural and soft, and does not affect other displayed content around the picture.

[0113] If the electronic device determines in step S801 that the proportion of pixels of two colors in the image is greater than 80%, the following steps may be performed: Fig. 9 The S901 in the.

[0114] Please refer to Fig. 9 , is another schematic diagram of an execution flow of generating background color provided by an embodiment of the present application. Fig. 9 As shown, the process may include the following steps.

[0115] S901, determine whether the sum of the percentages of pixels of three colors in the image is greater than 80%. If so, execute S902; if not, execute Fig.10 S1001 in.

[0116] S902, determine the relationship between the lightness of each color and 10, 60, 90. If the lightness of the color is greater than 10 and less than 60, execute S903a; if the lightness of the color is greater than 60 and less than 90, execute S903b; if the lightness of the color is less than 10 or greater than 90, execute S903c.

[0117] S903a, using the color as the background color.

[0118] S903b, reducing the brightness of the color to 60 and using it as the background color.

[0119] S903c, remove the color.

[0120] It can be seen that Fig. 9 The execution process shown corresponds to the scenario in which n is 3 in the above-mentioned embodiment, that is, the sum of the pixel proportions of the three colors in the picture is greater than the preset first threshold, and the sum of the pixel proportions of any two of the three colors is less than the first threshold. Through this execution process, extreme colors can be eliminated to obtain a background color with moderate brightness, thereby ensuring that the transition between the background generated according to the background color and the picture is more natural and soft, and does not affect other displayed content around the picture.

[0121] If the electronic device determines in step S901 that the proportion of pixels of the three colors in the image is not greater than 80%, the following steps may be performed: Fig.10 S1001 in.

[0122] Please refer to Fig.10 , is another schematic diagram of an execution flow of generating background color provided by an embodiment of the present application. Fig.10 As shown, the process may include the following steps.

[0123] S1001. Select k colors from the image.

[0124] Wherein, k is an integer greater than 3. The sum of pixel proportions of the k colors is greater than 80%, and the sum of pixel proportions of any k-1 colors among the k colors is less than 80%.

[0125] S1002, determine the relationship between the lightness of each color and 10, 60, 90. If the lightness of the color is greater than 10 and less than 60, execute S1003a; if the lightness of the color is greater than 60 and less than 90, execute S1003b; if the lightness of the color is less than 10 or greater than 90, execute S1003c.

[0126] S1003a, using the color as the background color.

[0127] S1003b, reducing the brightness of the color to 60 and using it as the background color.

[0128] S1003c, remove the color.

[0129] It can be seen that Fig.10 The execution flow shown corresponds to the scenario in the above embodiment where n is k. Through this execution flow, extreme colors can be eliminated to obtain a background color with moderate brightness, thereby ensuring that the transition between the background generated based on the background color and the picture is more natural and soft, without affecting other displayed content around the picture.

[0130] In the above description, Figure 7 , Figure 8 , Fig. 9 , Fig.10 The corresponding execution process is executed in combination, that is, Figure 7 The execution flow shown may jump to Figure 8 The execution flow shown is Figure 8 The execution flow shown may jump to Fig. 9 It should be noted that the above Figure 7 , Figure 8 , Fig. 9 , Fig.10 The corresponding execution process can also be executed separately. That is, the electronic device can only execute Figure 7 The execution flow shown, or Figure 8 The execution flow shown, or Fig. 9 The execution flow shown, or Fig.10 The execution flow shown.

[0131] The above is a specific scheme for generating background colors provided by an embodiment of the present application and an execution process for executing the specific scheme. Based on the above description, it should be understood that the number of background colors may be one or more. In other words, the number of background colors is at least one. The steps after obtaining the background color are described below.

[0132] S604: Input at least one background color into a preset fractal model to generate a gradient color background.

[0133] In an embodiment of the present application, the gradient color background may refer to a picture with a blurred gradient effect, which includes the background color in the aforementioned embodiment.

[0134] In an embodiment of the present application, the preset fractal model may also be referred to as a fractal shader, a fractal shader, etc., and is executed in a GPU of an electronic device. The input variable of the fractal model is a color parameter, the output variable of the fractal model is a picture, the model parameter of the fractal model may be referred to as a fractal parameter, and the analysis model may generate a picture composed of each color in the color parameter according to the input color parameter and the preset fractal parameter. Among them, the area where each color in the generated picture is located, the brightness distribution of each color, etc. are determined by the fractal parameters. The color parameters are used to describe the characteristics of the color, such as brightness, pixels, number of pixels, etc.

[0135] Optionally, in the embodiment of the present application, the fractal parameters in the existing fractal model (such as fractal shader) can be adjusted as needed to obtain the above-mentioned preset fractal model, or the existing fractal model can be trained to obtain the above-mentioned preset fractal model, so that the preset fractal model can generate a gradient color background composed of gradient colors of at least one background color in different brightness according to the input color parameters, that is, at least one background color. An exemplary description is given below.

[0136] Please refer to Fig.11 , is a schematic diagram of a fractal method of a fractal model provided in an embodiment of the present application. Fig.11 As shown, when the number of background colors is one, the fractal model can perform fuzzy gradient change on the background color in the entire display area along a certain fixed direction to obtain a gradient color background. For example, the background color is fuzzy gradient changed in the entire display area along the direction from one side to another side of the display area, or the background color is fuzzy gradient changed in the entire display area along the direction from one vertex to another vertex of the display area.

[0137] In the embodiment of the present application, blur gradient refers to gradually increasing or decreasing the brightness of the color to achieve a gradient blur effect. Among them, blur gradient on one background color is also called single-color domain blur gradient, blur gradient on two background colors is also called dual-color domain blur gradient, blur gradient on three background colors is also called three-color domain blur gradient, and blur gradient on more background colors is also called multi-color domain blur gradient.

[0138] The range of increasing or decreasing brightness of the color in the fuzzy gradient is optional, such as 15, 20, 25, etc., which is not limited here. For example, if the background color is blue with a brightness of 60, then a monochrome domain fuzzy gradient can be performed on the blue with a brightness of 60 to obtain a blue with a brightness gradient from 40 to 60.

[0139] Please refer to Fig.12 , is a schematic diagram of a fractal method of another fractal model provided in an embodiment of the present application. Fig.12 As shown in , when the number of background colors is two, the fractal model can divide the display area into two areas. There are many ways to divide the area, such as Fig.12 The division scheme 1 and the division scheme 2 shown are not described in detail. The fractal model can fill the two regions with gradient colors of a background color at different brightnesses to obtain a gradient color background. In other words, the fractal model can perform dual-color domain fuzzy gradient on the two background colors in the two regions to obtain a gradient color background.

[0140] For example, if the background color is blue with a lightness of 60 and yellow with a lightness of 40, the result of performing dual-color gamut blur gradient on the blue with a lightness of 60 and the yellow with a lightness of 40 is an image that gradually changes from blue with a lightness of 60 to yellow with a lightness of 40. The boundary between the blue part and the yellow part is the boundary between the two areas divided above.

[0141] Please refer to Fig.13 , is a schematic diagram of a fractal method of another fractal model provided in an embodiment of the present application. Fig.13 As shown in Figure 1, when the number of background colors is three, the fractal model can divide the display area into three areas. There are many ways to divide the areas, such as Fig.13 The division scheme 3 and the division scheme 4 shown are not described in detail. The fractal model can fill the three regions with gradient colors of a background color at different brightness to obtain a gradient color background. In other words, the fractal model can perform three-color domain fuzzy gradient on the three background colors in the three regions to obtain a gradient color background.

[0142] For example, if the background color is blue with a lightness of 60, green with a lightness of 50, and yellow with a lightness of 40, then the result of performing three-color gamut fuzzy gradient on the blue with a lightness of 60, the green with a lightness of 50, and the yellow with a lightness of 40 is an image that gradually changes from blue with a lightness of 60 to green with a lightness of 50, and then to yellow with a lightness of 40. The boundaries between the blue part and the green part, and the boundaries between the green part and the yellow part are the boundaries between the three areas divided above.

[0143] Please refer to Fig.14 , is a schematic diagram of a fractal method of another fractal model provided in an embodiment of the present application. Fig.14 As shown, when the number of background colors is more than three, that is, multiple, the fractal model can divide the display area into multiple areas, and the number of the multiple areas corresponds to the number of background colors. There are many ways to divide the areas, such as Fig.14 The division scheme 35 and the division scheme 6 shown are not described in detail. The fractal model can fill the multiple regions with gradient colors of a background color at different brightnesses to obtain a gradient color background. In other words, the fractal model can perform multi-color domain fuzzy gradient on multiple background colors in the multiple regions to obtain a gradient color background.

[0144] For example, the background colors are red with a lightness of 60, orange with a lightness of 55, yellow with a lightness of 50, and green with a lightness of 45. The result of multi-color gamut fuzzy gradient transformation of the multiple background colors is an image that gradually changes from red with a lightness of 60 to orange with a lightness of 55, then to yellow with a lightness of 50, and then to green with a lightness of 45. The boundaries between the red part and the orange part, the boundaries between the orange part and the yellow part, and the boundaries between the yellow part and the green part are the boundaries between the multiple areas divided above.

[0145] In some possible implementations, after the divided areas are blurred and gradually changed, the colors of the adjacent areas are the adjacent colors in the color wheel, where the color wheel is red, orange, yellow, green, cyan, blue, and purple. In this way, the color transition of each area in the gradient color background can be softer and more natural, which is conducive to improving the display effect.

[0146] In the embodiment of the present application, after the electronic device generates a gradient color background through a preset fractal model, the gradient color background can be filled into the display area that is not fully filled with the picture.

[0147] S605. Synchronously display a gradient color background when displaying the image.

[0148] In a possible implementation, the electronic device may set the gradient background as a layer below the picture and display it synchronously with the picture.

[0149] Based on the above description, it should be understood that an image display method and electronic device provided in an embodiment of the present application can generate a display background around the image according to the colors in the image, making the transition between the image and the display background around the image softer and more natural, thereby improving the overall display effect.

[0150] An embodiment of the present application also provides a computer storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the method in the above-mentioned embodiment.

[0151] The embodiments of the present application also provide a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement the method in the above-mentioned embodiments.

[0152] In addition, the embodiments of the present application also provide a device, which may be a chip, a component or a module, and the device may include a connected processor and a memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor may execute the computer-executable instructions stored in the memory, so that the chip executes the methods in the above-mentioned method embodiments. It should be noted that all relevant contents of each step involved in the above-mentioned method embodiments can be referred to the functional description of the corresponding functional module, and will not be repeated here.

[0153] Among them, the electronic device, computer storage medium, computer program product or chip provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.

[0154] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of electronic equipment. In order to realize the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0155] The embodiment of the present application can divide the functional modules of the devices involved therein according to the above method examples. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0156] The functions or actions or operations or steps in the above embodiments can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or may include one or more servers, data centers and other data storage devices that can be integrated with the medium. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).

[0157] Although the present application has been described in conjunction with specific features and embodiments thereof, it is obvious that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, this specification and the drawings are merely exemplary illustrations of the present application as defined by the appended claims, and are deemed to have covered any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art may make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for displaying an image, characterized in that: Applied to an electronic device, the electronic device includes a picture to be displayed; the method includes: Get the display size of the picture; When the display size of the image is smaller than the size of the display area in the electronic device, obtaining the pixel ratio and brightness of each color in the image; Generate a background color according to the pixel proportion and brightness of each color in the picture; wherein, when the sum of the pixel proportions of three colors in the picture is greater than a preset first threshold, and the sum of the pixel proportions of any two of the three colors is less than the first threshold, process the three colors according to the brightness of the three colors to obtain the background color; Inputting the background color into a preset fractal model to generate a gradient color background; the gradient color background is composed of gradient colors of at least one background color in different brightness; The gradient color background is displayed synchronously when the picture is displayed.

2. The image display method according to claim 1, characterized in that: The step of processing the three colors according to the brightness of the three colors to obtain the background color includes: The brightness of the colors that meet the first condition is reduced to a preset second threshold, and the colors that meet the second condition are eliminated; Using a color whose brightness is reduced to a preset second threshold as the background color; The first condition is that the brightness of the color is within a preset first interval and is greater than the second threshold; the second condition is that the brightness of the color is outside the first interval.

3. The image display method according to claim 1, characterized in that: The step of generating a background color according to the pixel proportion and brightness of each color in the picture further includes: When the proportion of pixels of the first color in the picture is greater than the first threshold, and the brightness of the first color is greater than the minimum value of the first interval and less than the second threshold, the first color is used as the background color; When the proportion of pixels of the first color in the picture is greater than the first threshold, and the brightness of the first color is less than the minimum value of the first interval, the brightness of the first color is increased to the minimum value of the first interval to obtain the background color; When the proportion of pixels of the first color in the picture is greater than the first threshold and the brightness of the first color is greater than the second threshold, the brightness of the first color is reduced to the second threshold to obtain the background color.

4. The image display method according to claim 1, characterized in that: The step of generating a background color according to the pixel proportion and brightness of each color in the picture further includes: When the sum of pixel proportions of n colors in the image is greater than a preset first threshold, and the sum of pixel proportions of any n-1 colors among the n colors is less than the first threshold, the n colors are subjected to a first processing according to their brightness to obtain at least one background color; n is an integer that is 2 or greater than or equal to 4; the first processing includes: reducing the brightness of colors that meet the first condition to a preset second threshold, and eliminating colors that meet the second condition; the first condition is: the brightness of the color is within a preset first interval and is greater than the second threshold; the second condition is: the brightness of the color is outside the first interval.

5. The image display method according to any one of claims 1 to 4, characterized in that: The background color includes m types, where m is a positive integer; Inputting the background color into a preset fractal model to generate a gradient color background includes: Inputting the m background colors into a preset fractal model; The fractal model divides the display area of ​​the electronic device into m areas; Gradient colors of a background color at different brightnesses are filled in the m regions respectively to obtain a gradient color background.

6. The image display method according to claim 5, characterized in that: Among the m regions, the background colors of adjacent regions are adjacent colors in the color wheel.

7. The image display method according to any one of claims 1 to 6, characterized in that: The display size of the picture is smaller than the size of the display area in the electronic device, including: the picture is an album picture in the music playback interface, and the picture is a picture in the standby screen interface.

8. The image display method according to any one of claims 1 to 7, characterized in that: The step of synchronously displaying the gradient color background when displaying the picture includes: The gradient color background is set in a layer below the image and is displayed synchronously with the image.

9. The image display method according to any one of claims 2 to 4, characterized in that: The first threshold is 80%, the second threshold is 60, and the first interval is greater than 10 and less than 90.

10. An electronic device, characterized in that: The electronic device comprises one or more processors, one or more memories, and a display screen; the one or more processors are connected to the display screen, the one or more memories are coupled to the one or more processors, and the one or more memories store a computer program; When the one or more processors execute the computer program, the electronic device executes the picture display method according to any one of claims 1 to 9.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium comprises a computer program, and when the computer program is run, the picture display method according to any one of claims 1 to 9 is executed.

Citation Information

Patent Citations

  • Background picture processing and search result display method and device, equipment and medium

    CN112069339A

  • Image display method and device, electronic equipment and computer storage medium

    CN114692034A

  • Color picture processor

    JP1992090676A

  • Method and device for converting color

    JP2001346052A

  • Device and method for real time 3D virtual studio broadcasting

    KR101790208B1