A method, device, terminal equipment and storage medium for extracting background color

By obtaining and processing the color strategy type in the image data, selecting and adjusting the hue strategy, the problem of low background color update efficiency in the existing technology is solved, fast and accurate background color replacement is achieved, the cost is reduced and the version iteration is satisfied. need.

CN114066753BActive Publication Date: 2024-10-15SHENZHEN COOCAA NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111319840.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-09
Publication Date
2024-10-15
Estimated Expiration
2041-11-09

AI Technical Summary

Technical Problem

Existing apps and web sites are inefficient at updating background colors and cannot meet the business needs of version iterations, resulting in increased design and operating costs and reduced update and iteration efficiency and accuracy.

Method used

By obtaining the color strategy type in the image data, select the hue strategy and generate the background color, and use the hue corrector to adjust the pixel values ​​to meet the preset standards to quickly change the background color.

Benefits of technology

It improves the efficiency and accuracy of background color updates, reduces design and operation costs, and meets the business needs of version iterations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114066753B_ABST
    Figure CN114066753B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, terminal device and storage medium for extracting background color, the method comprising: obtaining picture data corresponding to a preset picture, wherein the picture data comprises picture resources and the color strategy type; selecting a hue strategy according to the color strategy type in the picture data, wherein the hue strategy is used to process and extract colors according to the hue pixels of the picture; and generating a corresponding background color according to the hue strategy. The present application can extract the background color from the preset picture, thereby achieving the effect of quickly updating the background.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of background color extraction, and in particular to a method, device, terminal equipment and storage medium for extracting background color. Background Art

[0002] With the popularity of smart devices, various apps and web sites are using more and more pictures and colors, especially some background colors are frequently used. These apps and web sites need to frequently update internal pictures, colors and related backgrounds. However, the efficiency of updating backgrounds in existing apps and web sites is low, which cannot meet the business needs of version iteration.

[0003] Therefore, the prior art still needs to be improved and developed. Summary of the invention

[0004] The technical problem to be solved by the present invention is that, in view of the above-mentioned defects of the prior art, a method, device, terminal device and storage medium for extracting background color are provided, aiming at providing a method for extracting background color that can automatically generate a background color that meets the requirements, thereby achieving the effect of quickly updating the background.

[0005] The technical solution adopted by the present invention to solve the technical problem is as follows:

[0006] In a first aspect, the present invention provides a method for extracting a background color, wherein the method comprises:

[0007] Acquire image data corresponding to a preset image, wherein the image data includes image resources and color strategy types;

[0008] Selecting a hue strategy according to the color strategy type in the image data, wherein the hue strategy is used to process and select colors according to hue pixels of the image;

[0009] A corresponding background color is generated according to the color tone strategy.

[0010] In one implementation, the acquiring of picture data corresponding to a preset picture includes:

[0011] Inputting the picture into a preset color processor;

[0012] The color processor is controlled to obtain picture data corresponding to the picture.

[0013] In one implementation, the selecting of a hue strategy according to the color strategy type in the image data, wherein the hue strategy is to process and select colors according to hue pixels of the image, includes:

[0014] Sending the color strategy type in the image data to a preset color tone strategy device;

[0015] The hue strategy device sends down a hue strategy corresponding to the color strategy type in the picture data.

[0016] In one implementation, generating a corresponding background color according to the color tone strategy includes:

[0017] Processing and coloring pixels in the image using the color tone strategy;

[0018] Generate the corresponding background color based on the processed color-picked pixels.

[0019] In one implementation, generating a corresponding background color according to the color tone strategy further includes:

[0020] Detecting the pixel value of the background color by a preset color tone corrector;

[0021] When the pixel value of the background color does not meet the preset pixel standard value, the color tone strategy is corrected by the color tone corrector;

[0022] Generate the corresponding background color according to the modified color tone strategy.

[0023] In one implementation, when the pixel value of the background color does not meet the preset pixel standard value, correcting the color tone strategy by the color tone corrector includes:

[0024] When the pixel value of the background color does not meet the preset pixel standard value, judging the hue range of the hue strategy;

[0025] When the hue range is not within a preset range, the hue range is corrected by the hue corrector.

[0026] In one implementation, when the pixel value of the background color does not meet the preset pixel standard value, correcting the color tone strategy by the color tone corrector further includes:

[0027] When the pixel value of the background color does not meet the preset pixel standard value, detecting the hue shift state of the hue strategy;

[0028] When the hue strategy has a hue shift, the hue is adjusted by the hue corrector.

[0029] In a second aspect, an embodiment of the present invention further provides a device for extracting background color, wherein the device comprises:

[0030] A picture data acquisition module, used to acquire picture data corresponding to a preset picture;

[0031] A color tone strategy selection module, used to select a color tone strategy according to the color strategy type in the image data, wherein the color tone strategy is to process and select colors according to the color tone pixels of the image;

[0032] The background color generating module is used to generate the corresponding background color according to the color tone strategy.

[0033] In the third aspect, an embodiment of the present invention also provides a terminal device, wherein the terminal device includes: a processor, a storage medium communicatively connected to the processor, the storage medium being suitable for storing multiple instructions; the processor being suitable for calling instructions in the storage medium to execute a method for extracting background color according to any one of the above-mentioned schemes.

[0034] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement a method for extracting background color as described in any one of the above schemes.

[0035] Beneficial effects of the present invention: Compared with the prior art, the present invention provides a method for extracting background color, the method comprising first obtaining picture data corresponding to a preset picture, and the picture data comprises picture resources and color strategy types. Since the present embodiment needs to extract the background color from the picture, it is necessary to first obtain the picture data corresponding to the preset picture, so as to facilitate the selection of the hue strategy according to the color strategy type in the picture data. Since the hue strategy is to process and extract colors according to the hue pixels of the picture, the corresponding background color can be generated according to the hue strategy, so as to facilitate the purpose of quickly changing the background. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 It is a flowchart of a specific implementation of a method for extracting background color provided by an embodiment of the present invention.

[0037] Figure 2 It is a schematic diagram of the data structure of picture data in a method for extracting background color provided by an embodiment of the present invention.

[0038] Figure 3 The present invention provides a flowchart of a method for extracting a background color for determining a hue strategy.

[0039] Figure 4 The present invention provides a flowchart of generating a background color in a method for extracting a background color.

[0040] Figure 5 It is a principle block diagram of a device for extracting background color provided by an embodiment of the present invention.

[0041] Figure 6 It is a block diagram of the internal structure principle of the terminal device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0043] With the popularity of smart devices, various apps and web sites are using more and more pictures and colors, especially some background colors are frequently used. On the one hand, these apps and web sites need to frequently update internal pictures, colors and related backgrounds to meet the business needs of version iteration; on the other hand, this will greatly increase the design and operation costs of app and web site development, and also reduce the efficiency and accuracy of updates and iterations.

[0044] In order to solve the problems of the prior art, the present embodiment provides a method for extracting background color, the method comprising first obtaining picture data corresponding to a preset picture, and the picture data includes picture resources and color strategy types. Since the present embodiment needs to extract the background color from the picture, it is necessary to first obtain the picture data corresponding to the preset picture, so as to facilitate the selection of the hue strategy according to the color strategy type in the picture data. Since the hue strategy is to process and extract colors according to the hue pixels of the picture, the corresponding background color can be generated according to the hue strategy, thereby achieving the purpose of quickly changing the background.

[0045] Exemplary Methods

[0046] A method for extracting background color in this embodiment can be applied to a terminal device, such as a smart phone, a tablet computer, or a laptop computer, wherein the terminal device has a display interface for displaying images and a color processor for processing images. Figure 1 As shown in , a method for extracting background color in this embodiment includes the following steps:

[0047] Step S100: Acquire picture data corresponding to a preset picture, wherein the picture data includes picture resources and the color strategy type.

[0048] In specific implementation, since this embodiment needs to extract the background color from a preset picture, it is necessary to first obtain the picture data corresponding to the preset picture, and the picture data includes picture resources and color strategy types, such as Figure 2 As shown, PhotoData is the picture data, Bitmap is the picture resource, and colorPolicyType is the color policy type, so that the color tone policy corresponding to the preset picture can be determined through the picture resource and the color policy type in the picture data, and then the corresponding background color can be generated according to the color tone policy. Specifically, the picture is first input into the preset color processor, and the picture data corresponding to the picture is obtained through the color processor. Since the picture data includes the picture resource and the color policy type, the color policy type corresponding to the picture can be determined. For example, when it is necessary to extract the background color of the computer, the background picture of the computer is first obtained, and the background picture of the computer is input into the preset color processor in the computer. Since the color processor is used to process the color of the picture, after the background picture of the computer is input into the color processor, the color processor can obtain the color policy type in the background picture. Since the color policy type specifically includes the color distribution of the background picture, the appropriate color tone policy can be selected according to the color policy type in the background picture.

[0049] Step S200: selecting a hue strategy according to the color strategy type in the image data, wherein the hue strategy is used to process and extract colors according to hue pixels of the image.

[0050] After obtaining the color strategy type corresponding to the image, this embodiment can select the hue strategy according to the color strategy type. Since the hue strategy is used to process and color the image according to the hue pixels of the image, it is convenient to generate the corresponding background color according to the hue strategy, which facilitates the rapid replacement of the background and improves the processing efficiency and accuracy of the background replacement.

[0051] In one implementation, Figure 3 As shown, step S200 includes the following steps:

[0052] S201: Send the color strategy type in the image data to a preset color tone strategy device.

[0053] S202: issuing, by the hue strategy device, a hue strategy corresponding to the color strategy type in the image data.

[0054] In specific implementation, after obtaining the color strategy type, this embodiment first sends the color strategy type to the preset color tone strategy device. After receiving the color strategy type, the color tone strategy device selects a suitable color tone strategy according to the color strategy type and sends the selected color tone strategy to the color processor. Preferably, the color tone strategy in this embodiment includes four types, namely, a mixed color tone strategy, a main color tone strategy, a dark color tone strategy and a bright color tone strategy. Specifically, the mixed color tone strategy is to mix and process the color through all pixels of the picture, the main color tone strategy is to process the color through the main color pixels of the picture, the dark color tone strategy is to mix and process the color according to the dark color pixels of the picture, and the bright color tone strategy is to mix and process the color according to the bright color pixels of the picture. Preferably, the color tone strategy device in this embodiment is set in the server. For example, when the color strategy type of the background picture of the computer is dark color, the color processor sends the color strategy type to the color tone strategy device in the server. After receiving the dark color strategy type sent by the color processor, the color tone strategy device selects the dark color tone strategy and sends the dark color tone strategy to the color processor, so that the color processor can generate the corresponding background color according to the dark color tone strategy.

[0055] S300: Generate a corresponding background color according to the color tone strategy.

[0056] After determining the corresponding color tone strategy according to the color strategy type in the image data, this embodiment sends the color tone strategy back to the color processor, and the color processor can generate the corresponding background color according to the color tone strategy, thereby facilitating rapid replacement of the background.

[0057] In one implementation, Figure 4 As shown, step S300 includes the following steps:

[0058] S301, processing and selecting colors of pixels in the image using the color tone strategy;

[0059] S302: Generate a corresponding background color according to the processed color-selected pixels.

[0060] In specific implementation, since the hue strategy is used to process and extract colors according to the hue pixels of the image, after determining the hue strategy, the pixels in the image can be processed and extracted according to the hue strategy, and then the corresponding background color is generated according to the pixels after the processing and extraction. Preferably, a hue corrector is also pre-set in this embodiment. After the corresponding background color is generated according to the pixels after the processing and extraction, the pixel value of the background color is detected by the preset hue corrector. When the pixel value of the background color does not meet the pixel standard value pre-set in the hue corrector, the hue strategy is corrected by the hue corrector. Preferably, the hue corrector in this embodiment includes two types, namely hue range correction and hue compensation offset. Specifically, when the pixel value of the background color does not meet the preset pixel standard value, the hue range of the hue strategy is judged. When the hue range is not within the preset range, the hue range is corrected by the hue corrector. Further, when the pixel value of the background color does not meet the preset pixel standard value, the hue offset state of the hue strategy is detected. When the hue strategy has a hue offset, the hue is adjusted by the hue corrector. Finally, according to the corrected hue strategy, it is sent back to the color processor, and the color processor generates the corresponding background color according to the corrected hue strategy, so as to facilitate the rapid replacement of the background. For example, after the color processor generates the first background color according to the acquired hue strategy, the pixel value of the first background color is compared with the pixel standard value pre-set in the hue corrector. When the pixel value of the first background color does not meet the pixel standard value, the hue strategy is corrected by the hue corrector. The rationality of the hue range can be judged. When the range of the hue strategy is not within the preset range, it means that the pixel value of the first background color does not meet the pixel standard value due to the unreasonable hue range. The hue range can be corrected to make the hue range within the preset range. The hue offset state can also be judged. When there is a hue offset, the hue adjustment part can be offset. After the hue strategy is corrected by any strategy in the hue corrector, the corrected hue strategy is obtained, and the corrected hue strategy is sent back to the color processor again. The color processor generates a second background color according to the corrected hue strategy so that the pixel value of the second background color meets the pixel standard value.

[0061] In summary, the present embodiment first obtains the picture data corresponding to the preset picture, and the picture data includes picture resources and color strategy types. Since the present embodiment needs to extract the background color from the picture, it is necessary to first obtain the picture data corresponding to the preset picture, and specifically process the picture through the preset color processor to obtain the color strategy type in the picture, so as to facilitate the selection of the hue strategy according to the color strategy type in the picture data. Then the obtained color strategy type is sent to the preset hue strategy device, and the hue strategy device sends the hue strategy corresponding to the color strategy type. Since the hue strategy is to process and extract colors according to the hue pixels of the picture, the corresponding background color can be generated according to the hue strategy, and then the background color is detected by the preset hue corrector. When the pixel value of the background color does not meet the preset pixel standard value, the hue strategy is corrected by the hue corrector, and finally the corresponding background color is generated according to the corrected hue strategy, so as to achieve the purpose of quickly changing the background.

[0062] Exemplary Devices

[0063] like Figure 5 As shown in , this embodiment also provides a device for extracting background color, which includes a picture data acquisition module 10, a color tone strategy selection module 20, and a background color generation module 30. Specifically, the picture data acquisition module 10 is used to obtain picture data corresponding to a preset picture. The color tone strategy selection module 20 is used to select a color tone strategy according to the color strategy type in the picture data, wherein the color tone strategy is to process and extract colors according to the color tone pixels of the picture. The background color generation module 30 is used to generate a corresponding background color according to the color tone strategy.

[0064] In one implementation, the color tone strategy selection module 20 includes:

[0065] A sending unit, used for sending the color strategy type in the image data to a preset color tone strategy device;

[0066] The color tone strategy issuing unit is used to issue a color tone strategy corresponding to the color strategy type in the picture data through the color tone strategy device.

[0067] In one implementation, the background color generating module 30 includes:

[0068] A color processing unit, used for processing and selecting colors of pixels in the image according to the color tone strategy;

[0069] The first background color generating unit is used to generate a corresponding background color according to the processed color-picked pixels.

[0070] In one implementation, the background color generating module 30 further includes:

[0071] A detection unit, used for detecting the pixel value of the background color through a preset color tone corrector;

[0072] A correction unit, configured to correct the color tone strategy by using the color tone corrector when the pixel value of the background color does not meet the preset pixel standard value;

[0073] The second background color generating unit is used to generate a corresponding background color according to the modified color tone strategy.

[0074] Based on the above embodiments, the present invention further provides a terminal device, whose principle block diagram can be shown as follows: Figure 6 As shown. The terminal device includes a processor, a memory, a network interface, a display screen, and a temperature sensor connected through a system bus. Among them, the processor of the terminal device is used to provide computing and control capabilities. The memory of the terminal device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the terminal device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for extracting a background color is implemented. The display screen of the terminal device can be a liquid crystal display screen or an electronic ink display screen, and the temperature sensor of the terminal device is pre-set inside the terminal device to detect the operating temperature of the internal device.

[0075] Those skilled in the art will understand that Figure 6 The principle block diagram shown in the figure is only a block diagram of a partial structure related to the scheme of the present invention, and does not constitute a limitation on the terminal device to which the scheme of the present invention is applied. The specific terminal device may include more or less components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0076] In one embodiment, a terminal device is provided. The terminal device includes a memory, a processor, and a background color extraction program stored in the memory and executable on the processor. When the processor executes the background color extraction program, the following operation instructions are implemented:

[0077] Acquire image data corresponding to a preset image, wherein the image data includes image resources and the color strategy type;

[0078] Selecting a hue strategy according to the color strategy type in the image data, wherein the hue strategy is used to process and select colors according to hue pixels of the image;

[0079] A corresponding background color is generated according to the color tone strategy.

[0080] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0081] In summary, the present invention provides a method for extracting background color, the method comprising first obtaining picture data corresponding to a preset picture, and the picture data includes picture resources and color strategy types. Since the present embodiment needs to extract the background color from the picture, it is necessary to first obtain the picture data corresponding to the preset picture, and specifically process the picture through a preset color processor, so as to obtain the color strategy type in the picture, so as to facilitate the selection of a hue strategy according to the color strategy type in the picture data. Then the obtained color strategy type is sent to a preset hue strategy device, and the hue strategy device sends the hue strategy corresponding to the color strategy type. Since the hue strategy is to process and extract colors according to the hue pixels of the picture, the corresponding background color can be generated according to the hue strategy, and then the background color is detected by a preset hue corrector. When the pixel value of the background color does not meet the preset pixel standard value, the hue strategy is corrected by the hue corrector, and finally the corresponding background color is generated according to the corrected hue strategy, so as to achieve the purpose of quickly changing the background.

[0082] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for extracting background color, characterized in that: The method comprises: Acquire image data corresponding to a preset image, wherein the image data includes image resources and color strategy types; Selecting a hue strategy according to the color strategy type in the image data, wherein the hue strategy is used to process and select colors according to the hue pixels of the image, and the hue strategy includes a mixed hue strategy, a main hue strategy, a dark hue strategy, and a bright hue strategy; Generate a corresponding background color according to the color tone strategy; Generating the corresponding background color according to the color tone strategy also includes: Detecting the pixel value of the background color by a preset color tone corrector; When the pixel value of the background color does not meet the preset pixel standard value, the color tone strategy is corrected by the color tone corrector; Generate the corresponding background color according to the modified color tone strategy; When the pixel value of the background color does not meet the preset pixel standard value, the color tone strategy is corrected by the color tone corrector, including: When the pixel value of the background color does not meet the preset pixel standard value, detecting the hue shift state of the hue strategy; When the hue strategy has a hue shift, the hue is adjusted by the hue corrector.

2. A method for extracting background color according to claim 1, characterized in that: The acquiring of picture data corresponding to a preset picture includes: Inputting the picture into a preset color processor; The color processor is controlled to obtain picture data corresponding to the picture.

3. The method for extracting background color according to claim 1, characterized in that: The step of selecting a hue strategy according to the color strategy type in the image data, wherein the hue strategy is to process and select colors according to the hue pixels of the image, comprises: Sending the color strategy type in the image data to a preset color tone strategy device; The hue strategy device sends down a hue strategy corresponding to the color strategy type in the picture data.

4. The method for extracting background color according to claim 1, characterized in that: Generating the corresponding background color according to the color tone strategy includes: Processing and coloring pixels in the image using the color tone strategy; Generate the corresponding background color based on the processed color-picked pixels.

5. The method for extracting background color according to claim 1, characterized in that: When the pixel value of the background color does not meet the preset pixel standard value, correcting the color tone strategy by the color tone corrector further includes: When the pixel value of the background color does not meet the preset pixel standard value, judging the hue range of the hue strategy; When the hue range is not within a preset range, the hue range is corrected by the hue corrector.

6. A device for extracting background color, characterized in that: The device comprises: A picture data acquisition module, used to acquire picture data corresponding to a preset picture; A color tone strategy selection module, used to select a color tone strategy according to the color strategy type in the image data, wherein the color tone strategy is to process and select colors according to the color pixels of the image, and the color tone strategy includes a mixed color tone strategy, a main color tone strategy, a dark color tone strategy, and a bright color tone strategy; A background color generation module, used to generate a corresponding background color according to the color tone strategy; The background color generation module further includes: A detection unit, used for detecting the pixel value of the background color through a preset color tone corrector; A correction unit, configured to correct the color tone strategy by using the color tone corrector when the pixel value of the background color does not meet the preset pixel standard value; A second background color generating unit, used to generate a corresponding background color according to the modified color tone strategy; The correction unit comprises: When the pixel value of the background color does not meet the preset pixel standard value, detecting the hue shift state of the hue strategy; When the hue strategy has a hue shift, the hue is adjusted by the hue corrector.

7. A terminal device, characterized in that: The terminal device includes: a processor and a storage medium communicatively connected to the processor, wherein the storage medium is suitable for storing multiple instructions; the processor is suitable for calling the instructions in the storage medium to execute a method for extracting background color as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement a method for extracting background color as described in any one of claims 1 to 5 above.