Methods and apparatuses for generating color palette, electronic devices, and related products
By determining semantic objects and using pre-trained models to generate color palettes based on image and text input, the method addresses the inaccuracy of existing methods, resulting in more accurate and efficient color palette generation.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2025-06-09
- Publication Date
- 2026-06-18
AI Technical Summary
Existing color palette generation methods fail to accurately generate color palettes based on semantic information of objects in images, leading to unrealistic and inefficient color selection processes for users.
A method for generating color palettes by determining semantic objects from an image and using pre-trained models to output color palettes based on semantic information, optionally enhanced by user input text to refine the palettes.
The method produces more accurate and realistic color palettes that align with the actual colors of image objects, improving user efficiency and satisfaction in color selection.
Smart Images

Figure CN2025099931_18062026_PF_FP_ABST
Abstract
Description
METHODS AND APPARATUSES FOR GENERATING A COLOR PALETTE, ELECTRONIC DEVICES, AND RELATED PRODUCTS
[0001] This application claims the benefit of and priority to PCT patent application No. PCT / CN2024 / 138289 filed on December 10, 2024 and PCT patent application No. PCT / CN2025 / 087841 filed on April 8, 2025, the contents of which are hereby incorporated by reference in its entirety herein.TECHNICAL FIELD
[0002] This disclosure relates generally to the field of color palette generation, and in particular to methods and apparatuses for generating a color palette, electronic devices, and related products.BACKGROUND
[0003] Colors are an essential component of drawing. In some cases, colors are defined in a continuous three-dimensional (3D) space with an unlimited range of options. Although some drawing applications map the 3D space into a two-dimensional (2D) interface, the users may be still choosing from a large unlimited space of colors. Therefore, the users may experience delays in decision-making and uncertainty in the color choosing process.
[0004] To simplify the color choosing process and improve the efficiency of users’ drawing process, color palette generation approaches may be used to generate multiple colors for users based on images or words input by the users. When users draw on an electronic device, the users may use the colors in the generated color palette to fill colors into drawings. However, color palettes generated by some color palette generation approaches may not be accurate or realistic. For example, for a task of generating a color palette for an image including a fire truck, the fire truck usually has a red appearance, but some color palette generation approaches may generate a color palette not including red, so the generated color palette may not be accurate and realistic.SUMMARY
[0005] The present disclosure provides methods and apparatuses for generating a color palette, electronic devices, and related products, to improve the capability and accuracy of electronic devices in generating a color palette.
[0006] According to a first aspect, a method for color palette generation is described. The method may be performed by an electronic device (e.g., a computer, computing device) , or the method may be performed by a module, a circuit, a unit, or a chip in the electronic device where the module, the circuit, the unit, or the chip is responsible for the method for color palette generation in the electronic device. The method includes: determining, from a portion or all of a first image, one or more semantic objects, where each semantic object in the one or more semantic objects corresponds to first semantic information; and outputting one or more first color palettes for the one or more semantic objects according to the first semantic information of the each semantic object. The one or more first color palettes are associated with one or more identifiers of the one or more semantic objects, and each first color palette in the one or more first color palettes displays a plurality of first colors associated with the corresponding semantic object.
[0007] According to this method, one or more color palettes may be generated and output, based on a portion or all of a first image the users input. In addition, one or more semantic objects are determined from the portion or all of a first image, and the one or more palettes are correlated to the one or more semantic objects. Each first color palette in the one or more color palettes displays a plurality of colors associated with the corresponding semantic object. By doing so, users may be provided with one or more color palettes corresponding to the input image, instead of choosing from an unlimited color space. In addition, the color palette generated by this method may be more accurate and more conform to the real color of objects in the image because the semantic information may indicate real colors of the semantic objects. Therefore, the efficiency of the color choosing process may be improved.
[0008] In a possible design, the method further includes generating the one or more first color palettes for the one or more semantic objects according to the first semantic information of the each semantic object.
[0009] In a possible design, the generating the one or more first color palettes for the one or more semantic objects, includes: inputting the first semantic information of the each semantic object into a pre-trained model; and obtaining the one or more first color palettes for the one or more semantic objects from the pre-trained model, where the pre-trained model is obtained by training according to sample color palettes and sample semantic information.
[0010] When receiving the first semantic information of each semantic object, the pre-trained model processes the first semantic information using its strong logic and reasoning ability, and therefore the one or more first color palettes obtained from the pre-trained model may be more accurate and realistic.
[0011] In a possible design, the method further includes: obtaining an input text for the first image; obtaining second semantic information according to the input text; and outputting one or more second color palettes for the one or more semantic objects according to the second semantic information and the first semantic information of the each semantic object, where the one or more second color palettes are associated with the one or more identifiers of the one or more semantic objects, and each second color palette in the one or more second color palettes displays a plurality of second colors associated with the corresponding semantic object.
[0012] Because the input text may clarify users’ needs and requirements, by obtaining second semantic information according to the input text, and by generating one or more second color palettes based on the second semantic information and the first semantic information, the one or more second color palettes may be more accurate and in line with users’ needs and requirements.
[0013] In a possible design, after the obtaining an input text for the first image, the method further includes: obtaining an instruction for generating the one or more second color palettes for the one or more semantic objects, where the obtaining second semantic information according to the input text includes: in response to the instruction for generating the one or more second color palettes for the one or more semantic objects, obtaining the second semantic information according to the input text.
[0014] In a possible design, generating the one or more second color palettes for the one or more semantic objects according to the second semantic information and the first semantic information of the each semantic object, includes: inputting the second semantic information and the first semantic information of the each semantic object into a pre-trained model; and obtaining the one or more second color palettes for the one or more semantic objects from the pre-trained model, where the pre-trained model is obtained by training according to sample color palettes and sample semantic information.
[0015] By using a pre-trained model to generate the one or more second color palettes based on the second semantic information and the first semantic information, the one or more second color palettes may be more accurate and realistic because of the strong logic and reasoning ability of the pre-trained model.
[0016] In a possible design, the method further includes: obtaining an instruction for indicating the portion of the first image; determining a closed-region of the first image according to the instruction for indicating the portion of the first image; and determining the portion of the first image according to the closed-region of the first image.
[0017] The portion of the first image indicated by the first image may be a non-closed region, and by determining a closed-region of the first image according to the instruction for indicating the portion of the first image, the determination of the region that the user needs may be more accurate.
[0018] In a possible design, the first image is a color, grayscale, or monochrome image.
[0019] In a possible design, the method further includes: obtaining an instruction for recommending one or more sets of third colors for a selected first color in the plurality of first colors; and outputting the one or more sets of third colors according to the instruction for recommending one or more sets of third colors for the selected first color.
[0020] By outputting the one or more sets of third colors, the user may be provided with more choices of color palettes, so the efficiency of the color selection process may be improved.
[0021] In a possible design, the one or more sets of third colors include at least one of: one or more complementary colors of the selected first color; one or more analogous colors of the selected first color; one or more triadic colors of the selected first color; or one or more monochromatic colors of the selected first color.
[0022] The above mentioned types sets of colors are based on color harmony theory and real-world insights, and therefore by including at least one of the types sets of colors, the one or more sets of third colors may meet the needs of the users, which may help users find the color that meets their needs more easily.
[0023] In a possible design, the method further includes: obtaining an instruction for replacing a selected first color in the plurality of first colors; and replacing the selected first color with a color different from the selected first color according to the instruction for replacing a selected first color in the plurality of first colors, where the color different from the selected first color is determined by using a preset rule.
[0024] By replacing the selected first color with a color different from the selected first color, users may be enabled to adjust the colors in the color palette based on their needs, so the flexibility of the color selection process may be improved.
[0025] In a possible design, the preset rule includes having a preset matching degree with the first image in one or more of: hue, saturation, or brightness.
[0026] In this way, the replacing color may also be harmony with the color being replaced.
[0027] In a possible design, the method further includes: obtaining an instruction for extending the one or more first color palettes; and outputting a third color palette according to the instruction for extending the one or more first color palettes.
[0028] In a possible design, the outputting a third color palette includes: obtaining second images from an image database according to the first image, where a similarity of the first image and each second image in the second images meets a condition; and outputting the third color palette according to the second images.
[0029] In a possible design, the outputting a third color palette includes: outputting the third color palette from a color palette database according to the one or more first color palettes.
[0030] According to the three foregoing possible designs of outputting the third color palette, the third color palette may be output based on the first image and an image database, or based on one or more first color palettes and a color palette database. These two manners may ensure that the third color palette has a certain similarity with the first image or the one or more first color palettes, and thereby the third color palette may be more accurate and meet the users’ needs.
[0031] According to a second aspect, a method for displaying a color palette is described. The method may be performed by an electronic device (e.g., a computer, computing device) , or the method may be performed by a module, a circuit, a unit, or a chip in the electronic device where the module, the circuit, the unit, or the chip is responsible for the method for generating a color palette in the electronic device. The method includes: obtaining a plurality of colors; and displaying a color palette including an M*N matrix, where M and N are positive integers, Z is equal to or less than a product of M and N, Z cells in the M*N matrix are determined to be occupied in a row-first order, the Z colors are sorted into a linear array, each element in the array represents a color in the Z colors, the array is filled into the Z cells in a column-major order if M<N, or in a row-major order if M>N, in a case of M<N the M colors in each column in N columns are sorted locally, or in a case of M>N the N colors in each row in M rows are sorted locally.
[0032] According to this method, the color palette is presented as an M*N matrix. The Z colors may be first sorted into a linear array, and the array of colors may be grouped into multiple columns or multiple rows to be filled into the M*N matrix. Later each group may be sorted locally. After the process, it may be easier for users to find the desired colors.
[0033] In a possible design according to the second aspect, the method further includes: obtaining a distance between each two colors in the Z colors; and obtaining the linear array according to distances, where the linear array includes a minimum sum of distances that traverse to the Z colors between two endpoints of the linear array.
[0034] The minimum sum of distances among the Z colors may ensure that the two most similar colors are adjacent, making it easier for users to identify analogous colors.
[0035] In a possible design according to the second aspect, the distance is obtained based on a color difference between each two colors in the Z colors.
[0036] In a possible design according to the second aspect, the color difference includes a CIEDE2000 color difference and a hue difference.
[0037] According to the two foregoing possible designs, there are many ways to calculate the distance between two colors, and the color difference may be an effective way among them. The color difference may further include CIEDE2000 color difference and the hue difference, which are effective ways to calculate the variation between two colors.
[0038] In a possible design according to the second aspect, the method further includes: for the M colors in each column in the N columns, sorting the M colors based on one or more of: lightness or saturation.
[0039] Each column in the N columns may be sorted locally based on lightness or saturation to align with users’ habits.
[0040] In a possible design according to the second aspect, the method further includes: for the N colors in each row in the M rows, sorting the N colors based on one or more of: lightness or saturation.
[0041] Each row in the M rows may be sorted locally based on lightness or saturation to align with users’ habits.
[0042] According to a third aspect, a method for generating a series of color palettes in a pyramid hierarchy is described. The method may be performed by an electronic device (e.g., a computer, computing device) , or the method may be performed by a module, a circuit, a unit, or a chip in the electronic device where the module, the circuit, the unit, or the chip is responsible for the method for generating a color palette in the electronic device. The method includes: outputting a fourth color palette for a portion or all of a third image, where the fourth color palette includes colors and reflects position information of each of the colors in the third image, the fourth color palette is a coarsest resolution of palette and located at top of the pyramid hierarchy; obtaining an instruction for selecting a color in the fourth color palette; and outputting a fifth color palette for a region in the third image, where the region includes position information of the selected color, the fifth color palette is a higher resolution of palette and located under the top of the pyramid hierarchy, and there are a plurality of fifth color palettes that are providable based on instructions.
[0043] According to this method, the computing device may first output a coarsest resolution of palette based on an image, and the coarsest resolution of palette includes colors and reflects position information of each of the colors in the image. Then, the computing device may receive an instruction by a user selecting a color in the color palette, where the color corresponds to a region in the portion or all of the image. Then, the region in the portion or all of the image corresponding to the selected color is determined, and a new color palette corresponding to the region may be output. The new color palette is a higher resolution of palette. By doing so, one or more color palettes corresponding to different size of regions of the image may be generated according to user instruction. Compared to generating a fixed color palette for the entire image, this method may better meet the painting needs of users, and thereby the efficiency of the color choosing process may be improved.
[0044] In a possible design according to the third aspect, the instruction is one or more of: a finger gesture or a stylus gesture.
[0045] The computing device may receive the instructions from a finger gesture or a stylus gesture, which are intuitive for users to perform.
[0046] According to a fourth aspect, an apparatus is described. The apparatus may be configured in an electronic device (e.g., a computer, computing device) , or the apparatus may be configured as a module, a circuit, a unit, or a chip in the electronic device where the module, the circuit, the unit, or the chip is responsible for generating a color palette. The apparatus includes various units for performing the method according to the first, second or third aspect or any example in the first, second or third aspect.
[0047] According to a fifth aspect, an electronic device is described. The electronic device includes processing circuitry for performing the method according to the first, second or third aspect or any example in the first, second or third aspect.
[0048] According to a sixth aspect, a chip is provided. The chip includes an input / output (I / O) interface and a processor, where the processor is configured to call and run a computer program stored in a memory, to enable a device installed with the chip to execute the method according to the first, second or third aspect or any example in the first, second or third aspect.
[0049] According to a seventh aspect, an electronic device is described. The electronic device includes one or more processors; and a memory coupled to the one or more processors and storing instructions for execution by the processors, where the instructions, when executed by the one or more processors, cause the device to perform the method according to the first, second or third aspect or any example in the first, second or third aspect.
[0050] In some examples, the electronic device may further include an interface circuit, and the processor is configured to communicate with another apparatus / device or component through the interface circuit.
[0051] According to an eighth aspect, a computer-readable storage medium is described. The computer-readable storage medium stores computer-readable instructions, and when a computer reads and executes the computer-readable instructions, the computer is enabled to perform the method according to the first, second or third aspect or any example in the first, second or third aspect.
[0052] According to a ninth aspect, a computer program product is described. When a computer reads and executes the computer program product, the computer is enabled to perform the method according to the first, second or third aspect or any example in the first, second or third aspect.
[0053] The present disclosure encompasses various embodiments, including not only method embodiments but also other embodiments such as apparatus / device embodiments and embodiments related to non-transitory computer readable storage media. Embodiments may incorporate, individually or in combinations, the features disclosed herein.BRIEF DESCRIPTION OF THE DRAWINGS
[0054] For a better understanding of the present disclosure, as well as other aspects and further features thereof, reference is made to the following description which is to be used in conjunction with the accompanying drawings, where:
[0055] FIG. 1 is a schematic diagram of a system to which some embodiments of the present disclosure are applicable;
[0056] FIG. 2 is a schematic flowchart illustrating a process of color palette generation in accordance with some embodiments of the present disclosure;
[0057] FIG. 3 is a schematic diagram illustrating an exemplary process of generating color palette in accordance with some embodiments of the present disclosure;
[0058] FIGS. 4A and 4B are schematic diagrams illustrating an interaction flow of generating a color palette for a selected region in accordance with some embodiments of the present disclosure;
[0059] FIGS. 5A to 5C are schematic diagrams illustrating an interaction flow of generating a color palette for a selected region in accordance with some embodiments of the present disclosure;
[0060] FIG. 6 is a schematic flowchart illustrating an example process of generating a color palette for semantic objects in accordance with some embodiments of the present disclosure;
[0061] FIGS. 7A and 7B are schematic diagrams illustrating an interaction flow of generating a color palette for semantic objects in accordance with some embodiments of the present disclosure;
[0062] FIGS. 8A and 8B are schematic diagrams illustrating an interaction flow of recommending one or more colors in accordance with some embodiments of the present disclosure;
[0063] FIGS. 9A to 9D illustrate an example interaction flow of replacing a color, removing a color and extending a color palette in accordance with some embodiments of the present disclosure;
[0064] FIG. 10A is a schematic flowchart illustrating a process of displaying a color palette in accordance with some embodiments of the present disclosure;
[0065] FIG. 10B is a flowchart of a color palette display method according to some embodiments of the present disclosure;
[0066] FIG. 11 is a schematic diagram illustrating an example of unsorted colors in accordance with some embodiments of the present disclosure;
[0067] FIG. 12A is a schematic diagram illustrating an example of splitting the colors into rows and columns in accordance with some embodiments of the present disclosure;
[0068] FIG. 12B is a schematic diagram illustrating an example of sorting each column of colors locally in accordance with some embodiments of the present disclosure;
[0069] FIG. 13A is a schematic diagram illustrating an example of filling Z colors into an M*N matrix in accordance with some embodiments of the present disclosure;
[0070] FIG. 13B is a schematic flowchart illustrating an example process of multi-row color palette sorting in accordance with some embodiments of the present disclosure;
[0071] FIG. 14A is a schematic flowchart illustrating a process of another color palette generation method in accordance with some embodiments of the present disclosure;
[0072] FIG. 14B illustrates a process of a method for generating a series of color palettes in a pyramid hierarchy in accordance with some embodiments of the present disclosure;
[0073] FIGS. 15A to 16D are schematic diagrams illustrating an interaction flow of extending and finding colors in the region in accordance with some embodiments of the present disclosure;
[0074] FIG. 17 is a schematic flowchart illustrating processes of a color palette displaying and a color palette recommendation in accordance with some embodiments of the present disclosure;
[0075] FIG. 18 is a schematic flowchart illustrating processes of generating color palette for semantic objects and color recommendation in accordance with some embodiments of the present disclosure;
[0076] FIG. 19 is a schematic diagram of an apparatus for generating a color palette in accordance with some embodiments of the present disclosure;
[0077] FIG. 20 is a block diagram of another apparatus for generating a color palette in accordance with some embodiments of the present disclosure; and
[0078] FIG. 21 is a block diagram of a computing device in accordance with some embodiments of the present disclosure.DETAILED DESCRIPTION
[0079] Numerous details are described herein to provide a thorough understanding of the example embodiments illustrated in the accompanying drawings. However, some embodiments may be practiced without many of the specific details, and the scope of the claims is only limited by those features and aspects specifically recited in the claims. Furthermore, well-known processes, components, and materials have not necessarily been described in exhaustive detail so as to avoid obscuring pertinent aspects of the embodiments described herein.
[0080] Colors are an essential component of drawing. Theoretically, colors are defined in a continuous three-dimensional (3D) space with an unlimited range of options. While some drawing applications map the 3D color space into a 2D interface, the user is still choosing from a large unlimited space of colors. The infinite view of choices to select colors leads to greater delays in decision-making and uncertainty for novice users and artists. When users want to fill colors to images through computing devices, the users often need to choose an appropriate color from a large number of colors, and the process may take a lot of time. Therefore, it is necessary to recommend colors for the images users are coloring. A color palette generation approach may generate multiple colors for a user based on an image or text input by the user, so this approach may simplify the user's color selection process and improve the efficiency of the user's drawing process.
[0081] For ease of understanding, an example application scenario of the color palette generation approach is introduced, which is as shown in FIG. 1. The example application scenario involves a user interacting with his / her computing device. For example, as shown in FIG. 1, the computing device 110 may interact with the user via, for example, keyboard input, touch screen input, and / or voice commands. The computing device 110 may display one or more color palettes on its display screen according to the user’s input, and the user may colorize an image on the computing device 110 using the displayed color palettes. The computing device 110 may be any computing device with data processing function, including but not limited to a tablet, touch screen, personal computer, smart phone, smart watch, smart glasses, or a hybrid device. The computing device 110 may also equip necessary sensors, computing units, and input / output units, such as CPU, storage disk, memory, Bluetooth, Wi-Fi, inertial measurement unit (IMU) sensors, pressure sensors on the screen or on the edge, microphone (s) , camera (s) , compacity-enable area (for touch-related interaction) , display (s) , vibration actuator (s) , speaker (s) , light (s) , and button (s) . In addition, the computing device 110 may support digital stylus (pen) interaction. The digital stylus may support both continuous ink printing and pen-tip interaction with the computing device 110. The digital stylus may equip with IMU sensors, pressure sensors on both pen body and pen tip, microphone (s) , compacity-enable area (for touch-related interaction) , display (s) , vibration actuator (s) , speaker (s) , light (s) , button (s) , or other sensors or motors for control and / or display.
[0082] The application scenario 100 may further include a network 120 and a cloud server 130. The network 120 may be any network such as the Internet, a local area network or a private network. In a possible implementation, as shown in FIG. 1, one or more large language models (LLMs) are configured in the cloud server 130, and the computing device 110 may communicate with the cloud server 130 through the network 120. The LLM may be any type of LLM such as Deepseek, Transformer, or ChatGPT. In another possible implementation, the LMM may also be located locally, e.g., on a local server or on the computing device 110, so the computing device 110 may run the LLM locally.
[0083] Some approaches generate color palettes from image and text. On Procreate, users are able to produce schemes that represent an image. These color palettes may be generated based on the center region of the photo, leading to a subtle range of hues, or generated by referencing the entire photo, resulting in a broader range of colors. The Adobe InDesign application and the Adobe Color website provide various modes (colorful, bright, muted, deep, dark, none) to extract color palettes from images.
[0084] There are three papers that focus on color palette generation. “Generating Compositional Color Representations from Text” by P Maheshwari, et al uses text and image while “De-Stijl: Facilitating Graphics Design with interactive 2D color palette recommendation” by X Shi, et al draws upon the text, image, and content on the graphic to generate a color palette. “Exploring interactive color palettes for abstraction-driven exploratory image colorization” by X Shi, et al utilizes the color positions of the image to generate a color palette.
[0085] Other artificial intelligence (AI) features focus on indexing, recoloring, and sharing. Many online websites including Adobe Color allow users to browse and share color palettes. Palettes on Adobe Color are searchable within the Adobe Express platform, and may be applied onto text and vectors. For Adobe Stock, colors are extracted from photos to use as tags, which provide additional information about the images. Websites such as Coolors enable users to rapidly generate random colors.
[0086] In the above scenario, some color palette generation approaches may generate a color palette based on colors of an input color image, and some other color palette generation approaches may generate a color palette based on lines and contours of an input non-color image. However, these color palette generation approaches may not consider semantic information of objects in the input image when generating color palettes, so the generated color palettes may not be accurate or realistic. Semantic information of an object may be understood as various attributes of the object, including but not limited to a color, name, shape, and material of the object. For example, semantic information of a fire truck usually includes the fire truck’s color that is red, but if the semantic information of the fire truck is not considered when a color palette is generated, the generated color palette may not include the red color, which is not in line with the actual color of the fire truck. Therefore, the above approaches may have a disadvantage that there is a lack of interactions to generate colors for semantic objects. These color generation features do not fully support a user’s personal needs in choosing colors for drawing purposes.
[0087] In view of this, a method for color palette generation is provided according to some embodiments of the present disclosure. In this method, the computing device determines one or more semantic objects from a portion or all of an input image, and one or more first color palettes are output based on semantic information corresponding to the one or more semantic objects. The semantic objects may be understood as objects included in the input image, including but not limited to: natural landscapes (such as sky, mountains) , man-made objects (buildings, vehicles, clothing) , creatures (human, animals, plants) , etc. In addition, the one or more first color palettes are associated with one or more identifiers of the one or more semantic objects, and each first color palette displays a plurality of first colors associated with a corresponding semantic object.
[0088] In this method, because the semantic information may reflect real colors of the corresponding semantic objects, and the one or more first color palettes are output based on the semantic information, the one or more first color palettes may be more accurate, and may more conform with the real colors of the corresponding semantic objects.
[0089] FIG. 2 illustrates a flowchart of a method for color palette generation in accordance with some embodiments of this disclosure. The method 200 may be performed by any computing device with data processing function, such as the computing device 110. For the convenience of description, the method 200 is described by taking the computing device executing the method 200 as an example. The method 200 includes steps 210 and 220.
[0090] In step 210, the computing device determines, from a portion or all of a first image, one or more semantic objects. Each semantic object in the one or more semantic objects corresponds to first semantic information.
[0091] The first image may be, but is not limited to, a line art, sketch, painting, photography, photograph, digital artwork, scanned document, or any other form of visual data. In addition, the first image may be a color, grayscale, or monochrome image. The first image may be obtained by the computing device through any manners, including but not limited to, uploading by the user, or receiving from a server, cloud platform or other devices.
[0092] A portion of the first image refers to one or more regions on the first image. The one or more regions may be determined in a number of ways. For example, the computing device receives the user's instructions from input devices such as a keyboard, touch screen, and / or microphone, and may determine one or more regions (aportion) of the first image by a user outlining graphics, placing markers, and / or drawing rectangular boxes on the touch screen of the computing device. The all of the first image refers to the entire region of the first image.
[0093] The concepts of semantic objects and semantic information are described above and therefore not reiterated. The determination of semantic objects and semantic information is now explained. In some embodiments, the semantic objects and the semantic information are both determined by using a deep learning algorithm, including but not limited to, Flamingo, BLIP-2, MiniGPT-4, many convolutional neural networks (CNNs) , such as R-CNN, Fast R-CNN, Faster R-CNN, etc. For example, BLIP-2 takes the first image as an input, and outputs a semantic object and corresponding semantic information, such as [semantic object: panda, semantic information: the appearance of the panda is black and white] .
[0094] In step 220, the computing device outputs one or more first color palettes for the one or more semantic objects according to the first semantic information of each semantic object. The one or more first color palettes are associated with one or more identifiers of the one or more semantic objects, and each first color palette in the one or more first color palettes displays a plurality of first colors associated with the corresponding semantic object.
[0095] In this method 200, because the first semantic information may indicate real colors of the semantic objects, the one or more first color palettes may match with the context meaning of semantic objects of the first image. Therefore, the one or more first color palettes may be more accurate and realistic.
[0096] The one or more first color palettes may correspond to the one or more semantic objects. In some embodiments, a semantic object corresponds to a first color palette. In some other embodiments, a semantic object corresponds to multiple first color palettes. In yet some other embodiments, multiple semantic objects correspond to a first color palette. The corresponding relationship between the semantic objects and the first color palettes may be determined based on scenarios, user requirements, etc.
[0097] In some embodiments, a first color palette is associated with an identifier. For example, a first color palette is associated with a sematic object tree. In some other embodiments, the first color palette is associated with multiple identifiers. The corresponding relationship between the identifiers and the first color palettes may be determined based on scenarios, user requirements, etc.
[0098] In some embodiments, the semantic object may have a unique identifier. The one or more identifiers may include, but are not limited to, text, labels or icons. In a possible implementation, the computing device also outputs the one or more identifiers.
[0099] It is understood that, before outputting the one or more first color palettes, the one or more first color palettes may be generated. Therefore, the method 200 may further includes: generating, by the electronic device, the one or more first color palettes for the one or more semantic objects according to the first semantic information of each semantic object.
[0100] For example, the computing device inputs the first semantic information of each semantic object into a pre-trained model, and obtains the one or more first color palettes for the one or more semantic objects from the pre-trained model. The pre-trained model is obtained by training a model according to sample color palettes and sample semantic information.
[0101] The pre-trained model may be any pre-trained model with language understanding capabilities, such as Deepseek, Transformer, ChatGPT, multimodal large language models (e.g., Flamingo and BLIP-2) , etc. For example, the computing device inputs semantic information: “the appearance of the panda is black and white” into the pre-trained model, and then the pre-trained model outputs a color palette including two colors: black and white. In some embodiments, the colors in the color palette are represented by numerical values, which can be processed by the computing device for display.
[0102] In addition, if a pre-trained model is also used in the step 210, the pre-trained model used in the step 210 may be the same as or different from the pre-trained model used in the step 220.
[0103] When receiving the first semantic information of each semantic object, the pre-trained model processes the first semantic information using its strong logic and reasoning ability, and therefore the one or more first color palettes obtained from the pre-trained model may be more accurate and realistic.
[0104] In some examples, as described in the step 210, the computing device may determine one or more semantic objects from a portion or all of the first image so as to obtain the one or more color palettes, but the portion of the first image that the computing device receives from a user’s instruction may be a non-closed region. In this case, in a possible implementation, the computing device may first determine a closed region from the non-closed region of the first image, and then output the one or more semantic objects according to the closed region. The determination of the closed region includes: the computing device obtaining an instruction for indicating the portion of the first image, and determining a closed-region of the first image (corresponding to the portion of the first image) according to the instruction for indicating the portion of the first image.
[0105] In a case where the computing device receives an instruction indicating a non-closed region, without determining a closed-region, it may be difficult for the computing device to locate a specific region of an image from which a user wants to obtain a color palette. Therefore, determining a closed region based on a user’s instruction may help to improve the accuracy of the color palette generation, and thus may improve the efficiency of the color selection process and enhance the user experience.
[0106] The manners of the computing device obtaining the instruction for indicating the portion of the first image may be, for example, but not limited to, obtaining the user's instructions from input devices such as a keyboard, a touch screen, and / or a microphone. The manners of the computing device determining the closed region of the first image may include, but are not limited to, using an edge detection algorithm (e.g., Canny edge detection) , a Delaunay triangulation algorithm, and / or a convex hull algorithm.
[0107] A possible implementation of generating a color palette based on a portion of an image is now introduced in combination with FIGS. 3 to 5C.
[0108] FIG. 3 is a schematic diagram illustrating an exemplary process of generating a color palette based on a portion of an image. As shown in FIG. 3, the computing device receives an instruction indicating a region (aportion) of an image selected by a user, and then detects semantic objects based on the region. Further, the computing device runs fine-tuned text-to-palette LLM to generate a color palette, and then outputs the color palette to the user.
[0109] FIGS. 4A and 4B illustrate an interaction flow of generating a color palette for a selected region. In FIG. 4A, the computing device receives an instruction indicating a region selected by a user (i.e., the region outlined with a bold line) . Then, the computing device receives an instruction to generate a color palette from the selected region, and the instruction may be sent by the user pressing a button named Generate a Color palette. In FIG. 4B, the computing device displays a color palette including multiple colors, which is shown in the region outlined with a bold line.
[0110] FIGS. 5A to 5C illustrate an interaction flow of generating a color palette for a selected region in a sketch. In FIG. 5A, the computing device receives an instruction indicating a region selected by a user (i.e., the region defined by the rectangular box) . In FIG. 5B, the computing device receives an instruction to generate a color palette based on the semantic objects, and the instruction may be sent by the user pressing a button named Recommend Color. In FIG. 5C, the computing device displays a color palette including three colors, which is shown in the top-right corner of FIG. 5C.
[0111] In the step 220, one or more first color palettes are generated. However, in some cases, the one or more first color palettes may not be accurate enough, and the computing device may need to regenerate one or more color palettes for the users. Therefore, in some embodiments, the method 200 may further include generating one or more second color palettes. The generation of the one or more second color palettes may include following steps. The computing device obtains an input text for the first image. Then the computing device obtains second semantic information according to the input text, and outputs one or more second color palettes for the one or more semantic objects according to the second semantic information and the first semantic information of each semantic object. The one or more second color palettes are associated with the one or more identifiers of the one or more semantic objects, and each second color palette in the one or more second color palettes displays a plurality of second colors associated with the corresponding semantic object.
[0112] For simplicity, the input text of the first image is referred to as an input text. The input text may be referred to by other names such as a prompt, and the name of the input text is not limited thereto. The input text may be any text that indicates the needs of the user, such as but not limited to: a description of the first image and / or the user’s color preference. The computing device may obtain the input text in many ways, including but not limited to: obtaining the input text from an input device such as a keyboard, a touch screen, and / or a microphone.
[0113] The computing device may obtain the input text after outputting one or more first color palettes, or before outputting the one or more first color palettes, and the time of the computing device obtaining the input text is not limited thereto.
[0114] In some embodiments, the second semantic information is the input text. In some other embodiments, the second semantic information may be a text generated based on the input text. For example, the second semantic information may be a text generated by an LLM, where the input text is the input of the LLM.
[0115] The one or more second color palettes, and the one or more identifiers associated with the one or more second color palettes, may refer to the relevant descriptions of the first color palettes in the step 220, which are not reiterated herein. In addition, the corresponding relationship among the second color palettes, semantic objects, and identifiers may also refer to relevant descriptions in the step 220, which are also not reiterated herein.
[0116] Because the input text may clarify users’ needs and requirements, by obtaining second semantic information according to the input text, and by generating one or more second color palettes based on the second semantic information and the first semantic information, the one or more second color palettes may be more accurate and in line with users’ needs and requirements.
[0117] In some embodiments, after obtaining the input text and before outputting the one or more second color palettes, the method may further include obtaining, by the computing device, an instruction for generating the one or more second color palettes for the one or more semantic objects. In this case, obtaining the second semantic information according to the input text includes: in response to the instruction for generating the one or more second color palettes for the one or more semantic objects, obtaining the second semantic information according to the input text.
[0118] The computing device may obtain the instruction for generating the one or more second color palettes for the one or more semantic objects in many ways, including but not limited to: obtaining the instruction from an input device such as a keyboard, a touch screen and / or a microphone. For example, the computing device may obtain the instruction by the user clicking a button on the touch screen.
[0119] It is understood that, before outputting the one or more second color palettes, the computing device may first generate the one or more second color palettes. In a possible implementation, the computing device generates the one or more second color palettes for the one or more semantic objects according to the second semantic information and the first semantic information of each semantic object. This process may include: inputting the second semantic information and the first semantic information of each semantic object into a pre-trained model; and obtaining the one or more second color palettes for the one or more semantic objects from the pre-trained model. The pre-trained model is obtained by training a model according to sample color palettes and sample semantic information.
[0120] The above process of generating the one or more second color palettes using the pre-trained model may be referred to the description related to generating the first color palettes, which is not reiterated herein. The pre-trained model used to generate the one or more second color palettes may be the same as or different from the pre-trained model used to generate the first color palettes, which is not limited thereto. In addition, the computing device may perform the process of generating the one or more second color palettes one or more times, according to users’ instructions.
[0121] By using a pre-trained model to generate the one or more second color palettes based on the second semantic information and the first semantic information, the one or more second color palettes may be more accurate and realistic because of the strong logic and reasoning ability of the pre-trained model.
[0122] An example process of generating first color palettes and second color palettes is now described in combination with FIG. 6. As shown in FIG. 6, the computing device first receives an image, and then detects semantic objects from the image. Furthermore, the computing device runs a fine-tuned text-to-palette LLM to generate a color palette, which refers to the first color palette. Then, the computing device runs a fine-tuned text-to-palette LLM to regenerate a color palette, which refers to the second color palette.
[0123] FIGS. 7A and 7B illustrate an example interaction flow of generating color palettes for semantic objects in sketches. It is understood that the left part and right part in FIG. 7A illustrate the same sketch, although the patterns of the two parts may be different. In the example interaction flow, first, the computing device receives an instruction to generate color palettes of the semantic objects by a user clicking a button. As shown in the right part of FIG. 7A, the computing device generates four first color palettes corresponding to four semantic objects: mountains, clouds, grass, and trees, and each first color palette is associated with a tag (identifier) : Mountains, Clouds, Grass, Trees. As shown in FIG. 7B, the computing device obtains an input text by user entering a prompt: Autumn. Then, the computing device also obtains an instruction by user pressing a button on the right-bottom corner of FIG. 7B. Then, the computing device displays second color palettes, which is shown on the left part of FIG. 7B. In this interaction flow, the computing device provides context-based color palettes for all semantic objects in the sketch.
[0124] The embodiments of the computing device outputting one or more first color palettes and one or more second color palettes are described above. In some cases, the user may want to adjust the first color palettes and / or second color palettes, such as recommending, replacing, removing, and extending the first color palettes and / or second color palettes. Therefore, in some embodiments, the method 200 may further include embodiments that center around providing users with further adjustments to refine and generate colors for their color palette. In the following text, the four operations: recommending, replacing, removing, and extending will be introduced. The computing device may perform the four operations on any first color palette or any second color palette. For simplicity, the four operations are described by taking the computing device performing the four operations on the first color palette as an example.
[0125] The recommending operation may include: the computing device obtaining an instruction for recommending one or more sets of third colors for a selected first color in the plurality of first colors; and outputting the one or more sets of third colors according to the instruction for recommending one or more sets of third colors for the selected first color.
[0126] The plurality of first colors refer to colors of the first color palette. The computing device may obtain the instruction for recommending one or more sets of third colors in many ways. For example, the computing device may obtain the instruction by a user selecting a first color and pressing a button corresponding to the recommending operation.
[0127] By outputting the one or more sets of third colors, the computing device provides the user with more choices of color palettes, so the efficiency of the color selection process may be improved.
[0128] In some embodiments, the one or more sets of third colors include at least one of: one or more complementary colors of the selected first color; one or more analogous colors of the selected first color; one or more triadic colors of the selected first color; or one or more monochromatic colors of the selected first color. The above four types of colors are now described in combination with FIGS. 8A and 8B.
[0129] One or more complementary colors of the selected first color may be defined in many ways, including but not limited to, one or more colors that are located on a line extending along the diameter of the selected first color on a color ring or a color disk, one or more colors that produce white light in optics when blending with the selected first color, one or more colors that produce gray or black in printing when blending with the selected first color.
[0130] For example, four color rings are shown in FIG. 8A. In part (a) of FIG. 8A, part A represents the selected first color and part G represents a complementary color of the part A. As shown in part (a) of FIG. 8A, the part G is located on a line extending along the diameter of the part A, and the direction of the part G pointing to the center of the color ring is opposite to the direction of the part A pointing to the center of the color ring. In other words, the two directions differ by 180 degrees. For another example, four color disks are shown in FIG. 8B. In part (a) of FIG. 8B, circle 1 represents the selected first color, and the other circles represent complementary colors of the selected first color. As shown in part (a) of FIG. 8B, the circles representing complementary colors are also located on a line extending along the diameter of the circle 1.
[0131] One or more analogous colors of the selected first color may be defined in many ways. For example, analogous colors may be colors that are adjacent to, or near, the selected first color on a color ring or a color disk. As shown in part (b) of FIG. 8A, part A represents the selected first color, parts B and L represent analogous colors of the selected first color, and the parts B and L are adjacent to the part A. In part (b) of FIG. 8B, circle 1 represents the selected first color, and the other circles near the circle 1 represent analogous colors of the selected first color.
[0132] One or more triadic colors of the selected first color may be defined in many ways, including but not limited to: one or more colors that form an equilateral triangle with the selected first color, or colors that have a ternary relationship with the selected first color, on a color ring or a color disk. For example, if the selected first color is orange, the triadic colors of orange may be purple and green. As shown in part (c) of FIG. 8A, part C represents the selected first color, parts K and G represent triadic colors of the selected first color, and the parts K and G form an equilateral triangle with the part C. In part (c) of FIG. 8B, circle 1 on the color disk represents the selected first color, and the other circles that have a ternary relationship with the circle 1 represent triadic colors of the selected first color.
[0133] One or more monochromatic colors of the selected first color may be defined in many ways, including but not limited to, colors that have the same hue as the selected first color but differ in brightness or saturation, on a color ring or a color disk. For example, if the selected first color is red, the monochromatic colors of red may be light pink and dark red. As shown in part (d) of FIG. 8A, part A represents the selected first color, and parts M and N represent monochromatic colors of the selected first color. In part (d) of FIG. 8B, circle 1 represents the selected first color, and the other circles represent monochromatic colors of the selected first color.
[0134] The one or more sets of third colors may also be determined in other ways. For example, a set of third colors may be colors harmony with the selected first color based on color theory, and the ways are not limited thereto.
[0135] An example interaction flow of recommending sets of third colors for a color palette is now described in combination with FIGS. 8A and 8B. As shown in FIG. 8A, the computing device obtains an instruction for recommending one or more sets of third colors for a color, by the user long pressing a color (e.g., color 21) on a palette. Then the computing device uses color theory to calculate the color harmonies for the selected color. As shown in FIG. 8B, the four generated sets of third colors: Complement, Monochromatic, Analogous and Triadic, are shown on the computing device.
[0136] The above embodiments describe the process of a computing device recommending one or more sets of third colors for a selected first color. Some existing approaches may generate a limited number of colors, or it may be difficult to recommend auxiliary and harmonious colors for the selected first color. Therefore, by recommending one or more sets of third colors, the computing device provides users with more choices of colors, which may help users find more accurate colors. In addition, in some embodiments, the one or more sets of third colors may include at least one of: one or more complementary colors of the selected color, one or more analogous colors of the selected color, one or more triadic colors of the selected color, or one or more monochromatic colors of the selected color. The four types of colors are based on color harmony theory and real-world insights, and therefore the one or more sets of third colors may meet the needs of the users.
[0137] The replacing operation may include: the computing device obtaining an instruction for replacing a selected first color in the plurality of first colors; and replacing the selected first color with a color different from the selected first color according to the instruction for replacing the selected first color in the plurality of first colors. The color different from the selected first color is determined by using a preset rule. For simplicity, the color that is to replace the selected first color is referred to as a replacing color.
[0138] The computing device may obtain the instruction for replacing a selected first color in the plurality of first colors via a manner similar to the manner of obtaining an instruction for recommending one or more sets of third colors, which is not reiterated herein.
[0139] In some embodiments, the preset rule includes having a preset matching degree with the first image in one or more of: hue, saturation, or brightness. The hue, saturation, or brightness of the first image may be understood as an overall value of hue, saturation or brightness of the first image, and the computing device may use approaches such as color distribution analysis, visual perception and color extraction to determine the overall value of hue, saturation or brightness of the first image. The replacing color having a preset matching degree with the first image in one or more of hue, saturation, or brightness may be understood as that, a matching degree between the replacing color and the first image in terms of at least one of hue, saturation or brightness is greater than or equal to a preset value, and the preset value may be any value.
[0140] The preset rule may also be defined in other ways. For example, the preset rule may be that a matching degree between the replacing color and the selected first color in terms of color harmony is greater than or equal to a preset value. The ways for defining the preset rule are not limited thereto.
[0141] In some examples, the computing device may combine multiple preset rules (such as the preset rules described above) to determine the replacing color.
[0142] By replacing the selected first color with a color different from the selected first color, the computing device enables users to adjust the colors in the color palette based on their needs, so the flexibility of the color selection process may be improved. The replacing color meets a preset rule, and the preset rule includes a preset matching degree with the first image in terms of at least one of: hue, saturation, or brightness. By considering the characteristics (e.g., hue, saturation, or brightness) of the first image, the replacing color may also be in harmony with the color being replaced.
[0143] The removing operation refers to the computing device removing one or more colors from the first color palette according to the user’s instruction. An example interaction flow of replacing a color and removing a color is now described in combination with FIGS. 9A to 9C.
[0144] After a palette is generated, which may be a first color palette or a second color palette, the user may choose to replace or remove a color. This interaction flow is as follows. In some embodiments, to replace colors, the user selects colors they want to replace from the generated palette. The colors are then regenerated by the computing device. As shown in FIG. 9A, the computing device may obtain an instruction of replacing a color by a user selecting a color (e.g., a block with a bold border in FIG. 9A) and pressing a button named Replace. The computing device may consider color harmony rules and determine a replacing color based on at least one of: hue, saturation, and brightness. Then, the computing device outputs a color palette where the selected color is replaced by the replacing color, as shown in FIG. 9B. For example, as shown in FIG. 9C, the nine blocks on the left part represent nine colors of a color palette, and the different numbers on the blocks represent that the nine colors are different. As shown in FIG. 9C, the color represented by 35 on the left part is replaced by the color represented by 44, and the obtained colors are shown on the right part.
[0145] For removing operation, as shown in FIG. 9A, the computing device may obtain an instruction for removing a color by the user selecting a color (e.g., a block with a bold border in FIG. 9A, and pressing a button named Remove. In some embodiments, to remove colors, the user may select colors they want to remove from the generated palette. The colors are then deleted and the palette is updated. For example, the block with bold line is removed from the color palette shown in the bottom of FIG. 9B, and the number of colors of the obtained color palette shown in FIG. 9B is less than the number of colors of the color palette shown in FIG. 9A. By doing so, the removing operation may improve user’s ability to fine-tune the palette’s colors in each region and may provide users with further options to modify their generated colors.
[0146] The extending operation includes: the computing device obtaining an instruction for extending the one or more first color palettes; and outputting a third color palette according to the instruction for extending the one or more first color palettes.
[0147] The computing device may obtain the instruction for extending the one or more first color palettes in many ways, such as any way described above.
[0148] It is understood that before outputting the third color palette, the computing device may first generate the third color palette. In some embodiments, the third color palette is generated based on the first image. The first image corresponds to the one or more first color palettes. The process of generating a third color palette based on the first image includes: the computing device obtaining second images from an image database according to the first image. A similarity of the first image and each second image in the second images meets a condition. Then the computing device outputs the third color palette according to the second images.
[0149] The image database may be any image database, such as but not limited to: an image database downloaded from the network, or a self-constructed image database. The similarity of the first image and each second image in the second images may be determined in many ways. For example, the computing device uses algorithms such as convolutional neural networks, feature point matching (such as scale-invariant feature transform (SIFT) ) , and structural similarity index (SSIM) to determine the similarity of the first image and each second image. For example, the condition that the similarity of the first image and each second image meets may be that a similarity score between the first image and the second image exceeds a preset value, and the preset value may be any value. The condition is not limited thereto.
[0150] In addition, after obtaining the second images, the computing device may determine the third color palette based on the second images in many ways. For example, the computing device extracts one or more colors from each of the second images, and combines the one or more colors to form a third color palette. For example, the computing device may use color extraction algorithms (e.g., dominant color extraction, color quantization) or a color extraction tool, to extract the one or more colors from the second images.
[0151] In a possible implementation, the computing device searches a large database of related images, based on the input text (e.g., using contrastive language-image pre-training (CLIP) ) or second images that are similar to the input image (e.g., based on similarity score) . The most similar images are used to extract a color palette, using color extraction algorithms. The selected palette (third color palette) is added as an auxiliary color palette of the initial color palette.
[0152] In some other embodiments, the third color palette is generated based on the one or more first color palettes, and this process includes: the computing device outputting the third color palette from a color palette database according to the one or more first color palettes.
[0153] The color palette database may be any palette database, such as but not limited to, a palette database downloaded from a network or a self-constructed palette database. The third color palette may be selected from the color palette database based on one or more rules, including but not limited to: the third color palette has the highest similarity with the one or more first color palettes, the third color palette has the most similar theme with one or more first color palettes, etc. In addition, in some embodiments, if the color palette in the color palette database is associated with one or more tags (such as sunset, retro, autumn, etc. ) , the third color palette may also be a color palette whose tag has the highest similarity with the semantic information of the one or more first color palettes.
[0154] In a possible implementation, the computing device searches a large database of related color palettes. Each color palette is tagged with metadata such as theme tags (e.g., sunset, vintage, autumn) and / or color harmony type (e.g., analogous, etc. ) . The selected color palette (third color palette) is added as an auxiliary color palette to the initial color palette.
[0155] An example interaction flow of extending a color palette is now explained in combination with FIG. 9D. As shown in FIG. 9D, in some embodiments, the computing device may obtain an instruction to extend the color palette by a user pressing a button named Expand Palette. The computing device then generates and displays a third color palette.
[0156] According to the foregoing embodiments of outputting the third color palette, the third color palette may be output based on the first image and an image database, or based on one or more first color palettes and a color palette database. These two manners may ensure that the third color palette has a certain similarity with the first image or the one or more first color palettes, and thereby the third color palette may be more accurate and meet the users’ needs.
[0157] FIG. 10A is a flowchart of a color palette display method 1000 according to some embodiments of the present disclosure. The method 1000 may be executed by any computing device with data processing function, and the computing device includes, but is not limited to, a computer, a smartphone, a tablet, a digital camera, or a cloud computing platform, etc. In addition, the method 1000 may also be executed by a component, circuit, chip, or system on a chip in a computing device. For the convenience of description, the method 1000 is described by taking the computing device executing the method 1000 as an example. As shown in FIG. 10A, the method 1000 includes steps 1010 to 1040.
[0158] In step 1010, the computing device obtains a plurality of colors.
[0159] The plurality of colors may refer to a plurality of colors that the computing device generates.
[0160] In step 1020, the computing device sorts the plurality of colors into a first row of colors. The first row of colors may be understood as multiple colors located in the same row. As shown in FIG. 11, each block represents a color, and thirty colors are arranged in a straight line. In some other embodiments, the first row of colors may also be arranged as a curved row, and the shape of the first row of colors is not limited thereto.
[0161] The computing device may sort the plurality of colors into a first row of colors in many ways. For example, the computing device may sort the plurality of colors by minimizing the travel distance among the plurality of colors. The travel distance may be understood as a sum of distances between each two adjacent colors in a row of colors. For example, the distance between two adjacent colors may be the distance between coordinates of two adjacent colors in a color space, such as RGB color space. It is understood that different orders of the row of colors may result in different travel distances. Therefore, the goal of minimizing the travel distance is to find an optimal order of the row of colors, so that the travel distance is the shortest. A minimum travel distance may be calculated in many ways, including but not limited to, greedy algorithms, dynamic programming, and genetic.
[0162] In addition, the computing device may sort the plurality of colors in other ways, such as based on the similarities between different colors, or based on the order of colors in a color wheel. For example, the sorted plurality of colors may start from red, followed by orange, yellow, green, blue, indigo, purple, etc. The ways of sorting the plurality of colors are not limited thereto.
[0163] In step 1030, the computing device splits the first row of colors into M second rows of colors, where M is a positive integer.
[0164] In a possible implementation, the step 1030 may be performed according to the following process. The computing device first splits the first row of colors into multiple groups of colors, and each group of colors includes N colors (or (N-1) groups of colors include N colors, and one group of colors includes less than N colors) . Then, the computing device reshapes each group of colors into a column. In this way, the first row of colors is split into N second rows of colors.
[0165] FIG. 12A illustrates an example of splitting a first row of colors into M second rows of colors. As shown in FIG. 12A, each block represents a color, and the 16 colors are already sorted by the computing device performing the step 1020. In this case, in the step 1030, N equals 3, so the 16 colors are split into six groups of colors, in which each of five groups of colors includes 3 colors, and one group of colors includes one color. So the first group of colors includes colors 31, 32, and 33, and the last group of colors includes color 46. Then, each group of colors is reshaped into a column. By doing so, the 16 colors are split into three rows, or 6 columns.
[0166] In some embodiments, the colors located in the same position (i.e., the same sequence number) across the N second rows of colors form a column of colors in the color palette, and the column of colors in the color palette is sorted based on at least one of: lightness, hue, or chroma. The colors in each column may be sorted in an increasing or decreasing order based on at least one of: lightness, hue, or chroma, and the order of colors in each column is not limited thereto. In some other embodiments, the colors in each group may also be arranged based on other characteristics, which are not limited thereto.
[0167] In step 1040, the computing device displays a color palette including the N second rows of colors.
[0168] Each of the N second rows of colors may be displayed as a straight row, a curved row, or a row of any shape, which is not limited herein.
[0169] FIG. 10B is a flowchart of a color palette display method 1100 according to some embodiments of the present disclosure. The method 1100 may be also executed by any computing device as described above. As shown in FIG. 10B, the method 1100 includes steps 1110 and 1120.
[0170] In step 1110, the computing device obtains Z colors, where Z is a positive integer.
[0171] The Z colors may refer to a plurality of colors that the computing device generates.
[0172] In step 1120, the computing device displays a color palette including an M*N matrix, where M and N are positive integers and Z is equal to or less than a product of M and N. Z cells in the M*N matrix are determined to be occupied in a row-major order if M<N, or in a column-major order if M>N. The Z colors are sorted into a linear array, and each element in the array represents a color in the Z colors. The array may be filled into the Z cells in a column-major order when M<N and the M colors in each column in N columns are sorted locally. Or the array may be filled into the Z cells in a row-major order when M>N and the N colors in each row in M rows are sorted locally.
[0173] The computing device may determine Z cells in the M*N matrix to be occupied. When Z is equal to M*N, the occupied Z cells refer to all cells in the M*N matrix. When Z is less than M*N, the occupied Z cells refer to part of cells in the M*N matrix. The occupied Z cells are determined in a row-first order. For example, a row has to be fully occupied before the next row is to be used.
[0174] The linear array of colors may be understood as multiple colors located in the same row. As shown in FIG. 11, each block represents a color, and thirty colors are arranged in a straight line. In some other embodiments, the array of colors may also be arranged as a curved array, and the shape of the array of colors is not limited thereto.
[0175] The Z colors are filled into the M*N matrix in a three-stage rule, including a global sorting, matrix filling, and local sorting. In the global sorting, the computing device may sort the Z colors by minimizing the travel distance among the Z colors to form the linear array of colors. The travel distance may be understood as a sum of distances between each two colors in the Z colors, and the travel distance may exactly traverse to the Z colors. In some embodiments, a distance between each pair colors in the Z colors is defined by color difference, where the color difference may include a CIEDE2000 color difference or a hue difference. For example, the computing device may covert each color in the Z colors into the CIELAB color space, and calculate the distance between each pair color in the Z colors using the CIEDE2000 color difference formula. It is understood that different orders of the array of colors may result in different travel distances. Therefore, the goal of minimizing the travel distance is to find an optimal order of the array of colors, so that the travel distance is the shortest. A minimum travel distance may be calculated in many ways, including but not limited to, greedy algorithms, dynamic programming, and genetic. The array of the Z colors with a minimum travel distance may have two endpoints. In a possible implementation, a compliant arrangement may be obtained by comparing the two endpoints of the array and placing the darker-color endpoint to the left.
[0176] In addition, the computing device may sort the Z colors in other ways, such as based on the similarities between different colors, or based on the order of colors in a color wheel. For example, the sorted Z colors may start from red, followed by orange, yellow, green, blue, indigo, purple, etc. The ways of sorting the Z colors are not limited thereto.
[0177] In the matrix filling stage, the computing device first splits the array of colors into multiple groups of colors. When M<N, each group of colors includes M colors. Then, the computing device reshapes each group of colors into a column, thereby minimizing distance between vertically adjacent rows. In this way, the array of colors is split into M rows of colors. When M>N, each group of colors includes N colors. Then, the computing device reshapes each group of colors into a row, thereby minimizing distance between horizontally adjacent columns. In this way, the array of colors is split into N columns of colors.
[0178] In some embodiments, each group of colors may be sorted locally to align with users’ habits, and they may be sorted according to the lightness or the saturation.
[0179] FIG. 12B illustrates an example of sorting each column of colors locally. After splitting the array of colors into a 3*5 matrix, each group of colors may be sorted locally according to the lightness. The colors 31 and 32 may swap their positions in the first column, the colors 37, 38, and 39 may swap their positions in the third column, and the colors 44 and 45 may swap their positions in the fifth column.
[0180] FIG. 13A illustrates an example of filling Z colors into an M*N matrix, where Z is less than a product of M and N. As shown in FIG. 13A, each block represents a color and 10 colors are obtained based on an image. In this case, M equals to 3 and N equals to 6, so 10 is less than the product of 3 and 6. First, the computing device decides which cells in the matrix are to be occupied by the 10 colors. The first row needs to be fully occupied before the next row is to be used. Later the 10 colors are sorted into a linear array and are split into 6 groups of colors, where 4 groups have 2 colors and 2 groups have 1 color. Second, the 10 colors are filled into the occupied cells by reshaping into the 6 columns. Third, the 10 colors may be sorted locally according to the lightness or the saturation.
[0181] FIG. 13B illustrates an example process of the method 1000 or 1100. As shown in FIG. 13B, the first block corresponds to the step 1010, the second block corresponds to the step 1020, and the third and fourth blocks correspond to the step 1030. As shown in FIG. 13B, the first block corresponds to the step 1110, the second, third and fourth blocks correspond to the step 1120. Specifically, the second block corresponds to the global sorting, the third block corresponds to the matrix filling, and the fourth block corresponds to the local sorting.
[0182] As shown in FIG. 13B, the computing device obtains a number Z of unsorted colors. The computing device then sorts the colors into a first row of colors by the minimum travel distance, where the distance may be calculated by the CIEDE2000 color difference or the hue difference. In some embodiments, colors are extracted and sorted into a uniform linear one-dimensional (1D) color palette. A 1-D color palette may be understood as the colors of the palette being displayed in one row.
[0183] According to the foregoing embodiments corresponding to the method 1100, a linear array of colors is split into M rows of colors. By doing so, the array of colors may be rearranged into a layout that may improve the ease of finding colors for users. In addition, colors located in the same position across the M rows of colors form a column of colors in the color palette, and the column of colors in the color palette is sorted based on at least one of: lightness, or saturation. Sorting the colors of each column may also enhance the visual appeal of the color palette.
[0184] FIG. 14A illustrates a process of a color palette generation method 1400 in accordance with some embodiments of the present disclosure. The method 1400 may be executed by any computing device with data processing function, or a component, circuit, chip, or system on a chip in a computing device. The computing device includes, but is not limited to, a computer, a smartphone, a tablet, a digital camera, or a cloud computing platform, etc. For the convenience of description, the method 1400 is described by taking the computing device executing the method 1400 as an example. As shown in FIG. 14A, the method 1400 includes steps 1410 to 1440.
[0185] In step 1410, the computing device outputs a fourth color palette for a portion or all of a third image. The fourth color palette includes colors and reflects position information of each of colors in the third image.
[0186] The third image may be any visual data in color, including but not limited to, a painting, a photograph, a photo, a digital artwork or a scanned document, etc. The portion of the third image may be understood as a region in the third image. For simplicity, a portion or all of a third image is referred to as an input.
[0187] The fourth color palette reflecting position information of each of the colors in the third image may be understood as that: each color in the fourth color palette corresponds to a region in the input. For example, if the input has N regions, then the fourth color palette may have N colors, and each color corresponds to a region of the input. The regions of the input may be determined in many ways. For example, the computing device may divide the input into multiple regions evenly. The manner of determining the regions of the input is not limited thereto. The size of each region may be the same or different, which is also not limited thereto.
[0188] In some implementations, the computing device may store the position information of the third image, meaning that the computing device may store the corresponding relationship between regions in the third image and colors in the fourth color palette.
[0189] It is understood that before outputting the fourth color palette, the computing device may first generate the fourth color palette. The computing device may generate the fourth color palette in many ways, including but not limited to, the computing device extracting a color from each region of the input through a color extraction algorithm (such as dominant color extraction, or color quantization) or by using a color extraction tool. Then, the colors extracted by the computing device form the fourth color palette.
[0190] In step 1420, the computing device obtains an instruction for selecting a color in the fourth color palette.
[0191] The computing device may obtain the instruction for selecting a color in the fourth color palette in many ways, including but not limited to: the computing device receiving the user's instruction from any input device such as a keyboard, a touch screen, and / or a microphone.
[0192] In step 1430, the computing device determines a region in the portion or all of the third image according to the selected color and the position information of the selected color in the third image.
[0193] As described above, the computing device may store the corresponding relationship between regions in the third image and colors in the fourth color palette. Therefore, in the step 1430, the computing device may determine a region in the input based on the corresponding relationship.
[0194] In step 1440, the computing device outputs a fifth color palette for the region in the third image.
[0195] The generation of the fifth color palette may refer to the generation of the fourth color palette, which is not reiterated herein.
[0196] In a possible implementation, after the steps 1410 to 1440, the computing device may repeat the steps 1420 to 1440. For example, the user may select a color in the fifth color palette. Then the computing device determines a region that corresponds to the color the user selected in the fifth color palette, and outputs a sixth color palette corresponding to the region. By repeating the steps 1420 to 1440, one or more color palettes may be output sequentially, and the one or more color palettes sequentially correspond to smaller regions in the third image.
[0197] FIG. 14B illustrates a process of a method 1500 for generating a series of color palettes in a pyramid hierarchy in accordance with some embodiments of the present disclosure. The method 1500 may be executed by any computing device described above. As shown in FIG. 14B, the method 1500 includes steps 1510 to 1530.
[0198] In step 1510, the computing device outputs a fourth color palette for a portion or all of a third image. The fourth color palette includes colors and reflects position information of each of colors in the third image. The fourth color palette is a coarsest resolution of palette and located at top of the pyramid hierarchy.
[0199] A series of color palettes in a pyramid hierarchy may be referred to as a pyramid palette. The series of color palettes includes the fourth color palette and are generated based on the third image. In the series of color palettes, there may be a coarsest resolution of palette which is located at top of the pyramid hierarchy. Compared with the coarsest resolution of palette, a higher resolution of palette may be located under the top of the pyramid hierarchy. Therefore, the pyramid palette exhibits a hierarchical structure where the resolution of palette progressively increases toward lower levels.
[0200] The step 1510 may refer to the aforementioned step 1410. The fourth color palette in step 1510 may be a coarsest resolution of palette in the pyramid palette that the computing device may generate based on the third image, and located at top of the pyramid hierarchy.
[0201] In step 1520, the computing device obtains an instruction for selecting a color in the fourth color palette.
[0202] The step 1520 may refer to the aforementioned step 1420. The instruction in step 1520 may be a finger gesture or a stylus gesture, or a combination of the two gestures.
[0203] In step 1530, the computing device outputs a fifth color palette for a region in the third image, where the region includes position information of the selected color. The fifth color palette is a higher resolution of palette and located under the top of the pyramid hierarchy. There are a plurality of fifth color palettes that are providable based on instructions.
[0204] As described above, the computing device may store the corresponding relationship between regions in the third image and colors in the fourth color palette. Therefore, the computing device may determine a region in the portion or all of the third image according to the selected color and the position information of the selected color in the third image.
[0205] The generation of the fifth color palette may refer to the generation of the fourth color palette, which is not reiterated herein. The fifth color palette may be a higher resolution of palette in the pyramid palette and located under the top of the pyramid hierarchy.
[0206] In a possible implementation, after the steps 1510 to 1530, the computing device may repeat the steps 1520 to 1530. The process may refer to the process of repeating the steps 1420 to 1440 aforementioned.
[0207] An example interaction flow of the method 1400 and 1500 is now described in combination with FIGS. 15A to 16D. FIG. 15A corresponds to the step 1410 or 1510, where the electronic device obtains a reference image from a user, which refers to the third image in the step 1410 or 1510, as shown in the left side of FIG. 15A, and the computing device first outputs a coarsest resolution of color palette (fourth color palette) that reflects the positions of the reference image, as shown in the right side of FIG. 15A. Each polygon in the color palette represents a color, and each color corresponds to a region of the third image. FIG. 15B corresponds to the steps 1520 and 1530. The palette 1 in the FIG. 15B corresponds to the fourth color palette in the FIG. 15A. After an instruction for selecting a color in the fourth color palette, the computing device outputs a higher resolution of palette (fifth color palette) compared with the fourth color palette for the region in the reference image, as the palette 2 shown at the bottom of FIG. 15B. Furthermore, after an instruction for selecting a color in the fifth color palette, the computing device outputs a higher resolution of palette (sixth color palette) compared with the fifth color palette for the region in the reference image, as the palette 3 shown at the bottom of FIG. 15B. The palettes 1, 2, and 3 corresponds to the top, middle and bottom layers of the pyramid.
[0208] FIG. 16A corresponds to the steps 1420 and 1430, or the steps 1520 and 1530. As shown in FIG. 16A, the computing device obtains an instruction indicating a selected color in the fourth color palette, which is indicated by a square with a bold line shown on the right part of FIG. 16A, and then the computing device determines a region corresponding to the selected color, which is indicated by a square with a bold line shown on the left part of FIG. 16A.
[0209] FIG. 16B corresponds to the step 1440 or 1530. The fifth color palette output by the computing device is shown on the right part of FIG. 16B, and the fifth color palette corresponds to the region shown in FIG. 16A.
[0210] For example, as shown in FIG. 16C, the computing device may also obtain an instruction for choosing more specific palette colors in this region, by the user swiping on the fifth color palette.
[0211] For example, the computing device may also obtain an instruction for applying a color to the drawing pen by user long pressing the selected color, and when the long press is stopped, as shown in FIG. 16D, the computing device applies the color to the pen.
[0212] According to the foregoing embodiments of the method 1400 or 1500, the computing device outputs a fourth color palette for a portion or all of a third image, and by obtaining an instruction for selecting a color in the fourth color palette, the computing device also outputs a fifth color palette for a region in the third image. The user may obtain multiple color palettes corresponding to different sizes of regions of the third image. Therefore, this method may better meet the painting needs of users, and the efficiency of the color choosing process may be improved. In comparison, most of the approaches focus on outputting color palettes for the whole image. Procreate and the paper “Exploring interactive color palettes for abstraction-driven exploratory image colorization. ” generate color palettes that are sorted to reflect the color positions in the image. However, the user is not able to fine-grain a palette color corresponding to each region. Therefore, according to the method 1400 or 1500, the user may obtain color palettes from a region of the image. For example, the user long presses a color on the palette. A 2D color palette is generated from the corresponding region of the image. The color palette reflects the color positions within the image section. The method 1400 or 1500 provides a range of color palettes for different sizes of regions, allowing users to select fine-grained color palettes in the image. Moreover, displaying color position and color proportions provides context for users to reference colors in relation to their image composition. In addition, generating a color palette that demonstrates the color position may enable users to reference colors in relation to the image.
[0213] Some embodiments of the method 200 for color palette generation, the color palette display method 1000 or 1100, and the color palette generation method 1400 or 1500 are described. The goal of some embodiments of this disclosure is to enable users to refine and input further information to enable personalized, contextual colors. Therefore, the present disclosure may provide advantageous effects.
[0214] Some embodiments, such as outputting color palette for a region of an image, color recommendations, and outputting color palettes for semantic objects, may be essential aspects for the color selection process of users. The embodiments of the method 200, the method 1000 or 1100 and the method 1400 or 1500 may be combined to provide more precise color palettes for users.
[0215] Some implementations combining some steps and embodiments of the method 200, method 1000 or 1100, and method 1400 or 1500 are described in combination with FIGS. 17 and 18. There are several example workflows provided in the present disclosure. FIG. 17 illustrates a first workflow which includes: 1. an image to color palette generation and 2. a color recommendation flow. First, the user may trigger color extraction based on the selected region or the full image. The generated palette is sorted into a harmonized multi-row 1-dimension color palette (some steps in the method 1000 or 1100) or a multi-resolution 2D color palette (some steps in the method 1400 or 1500) . Once complete, the user may reduce, replace, or add colors, and / or generate color harmony variants for the selected first color (some steps in method 1000 or 1100) .
[0216] FIG. 18 illustrates a second workflow centering around a semantic object to color palette generation (the method 1000 or 1100) , then a color recommendation flow. First, semantic objects on the user’s selected region or full image are detected. Next, a color palette is generated using a text-to-palette LLM. Similar to the first flow, the computing device may reduce, replace, or recommend colors for users, and / or generate color theory colors for the selected hues. In addition, in some implementations, refining the regions (steps in the method 200) and sorting the color palettes (the method 1000 or 1100) may combined.
[0217] FIG. 19 is a block diagram of a structure of another apparatus that may be used for generating color palettes in accordance with some embodiments of the present disclosure. The apparatus for generating color palettes may be configured to perform the foregoing method embodiments, and therefore can also achieve beneficial effects of the foregoing method embodiments. In the embodiments of the present disclosure, the apparatus for generating color palettes may be a computing device or a module of the computing device (for example, a chip or a circuit) .
[0218] As shown in FIG. 19, the apparatus 1900 includes an obtaining unit 1910, an output unit 1920, and a processing unit 1930. The apparatus 1900 is used to implement the foregoing method embodiments as shown in FIGS. 2 to 16D. The processing unit 1930 may include, but is not limited to, a processor, a processor system, an application processor, a baseband processor, a processor circuit, or a processor core that may be collectively referred to as a processor. The processor may include one or a combination of a central processing unit (CPU) , a digital signal processor (DSP) , a microprocessor (microprocessor unit, MPU) , a microcontroller (microcontroller unit, MCU) , a graphics processing unit (GPU) , a field programmable gate array (FPGA) , an artificial intelligence processor (AI processor) , or a neural network processing unit (NPU) .
[0219] When the apparatus 1900 is used for executing the method 200, the processing unit 1930 may be configured to determine, from a portion or all of a first image, one or more semantic objects. Each semantic object in the one or more semantic objects corresponds to first semantic information. The output unit 1920 may be configured to output one or more first color palettes for the one or more semantic objects according to the first semantic information of each semantic object. The one or more first color palettes are associated with one or more identifiers of the one or more semantic objects, and each first color palette in the one or more first color palettes displays a plurality of first colors associated with the corresponding semantic object.
[0220] In some embodiments, the processing unit 1930 is configured to generate the one or more first color palettes for the one or more semantic objects according to the first semantic information of each semantic object.
[0221] In some embodiments, the processing unit 1930 is configured to input the first semantic information of each semantic object into a pre-trained model. The processing unit 1930 is configured to obtain the one or more first color palettes for the one or more semantic objects from the pre-trained model. The pre-trained model is obtained by training a model according to sample color palettes and sample semantic information.
[0222] In some embodiments, the obtaining unit 1910 is configured to obtain an input text for the first image, and the processing unit 1930 is configured to obtain second semantic information according to the input text, and output one or more second color palettes for the one or more semantic objects according to the second semantic information and the first semantic information of the each semantic object. The one or more second color palettes are associated with the one or more identifiers of the one or more semantic objects, and each second color palette in the one or more second color palettes displays a plurality of second colors associated with the corresponding semantic object.
[0223] In some embodiments, the obtaining unit 1910 is configured to obtain an instruction for generating the one or more second color palettes for the one or more semantic objects. The obtaining second semantic information according to the input text includes: in response to the instruction for generating the one or more second color palettes for the one or more semantic objects, obtaining the second semantic information according to the input text.
[0224] In some embodiments, the processing unit 1930 is configured to input the second semantic information and the first semantic information of the each semantic object into a pre-trained model, and obtain the one or more second color palettes for the one or more semantic objects from the pre-trained model. The pre-trained model is obtained by training according to sample color palettes and sample semantic information.
[0225] In some embodiments, the obtaining unit 1910 is configured to obtain an instruction for indicating the portion of the first image. The processing unit 1930 is configured to determine a closed-region of the first image according to the instruction for indicating the portion of the first image, and determine the portion of the first image according to the closed-region of the first image.
[0226] In some embodiments, the obtaining unit 1910 is configured to obtain an instruction for recommending one or more sets of third colors for a selected first color in the plurality of first colors. The processing unit 1930 is configured to output the one or more sets of third colors according to the instruction for recommending one or more sets of third colors for the selected first color.
[0227] In some embodiments, the obtaining unit 1910 is configured to obtain an instruction for replacing a selected first color in the plurality of first colors. The processing unit 1930 is configured to replace the selected first color with a color different from the selected first color according to the instruction for replacing a selected first color in the plurality of first colors. The color different from the selected first color is determined by using a preset rule.
[0228] In some embodiments, the obtaining unit 1910 is configured to obtain an instruction for extending the one or more first color palettes. The processing unit 1930 is configured to output a third color palette according to the instruction for extending the one or more first color palettes.
[0229] In some embodiments, the obtaining unit 1910 is configured to obtain second images from an image database according to the first image. A similarity of the first image and each second image in the second images meets a condition. The processing unit 1930 is configured to output the third color palette according to the second images.
[0230] In some embodiments, the processing unit 1930 is configured to output the third color palette from a color palette database according to the one or more first color palettes.
[0231] When the apparatus 2000 is used for executing the method 1000 or 1100, the obtaining unit 1910 is configured to obtain a plurality of colors. The processing unit 1930 is configured to sort the plurality of colors into a first row of colors, and split the first row of colors into N second rows of colors, where N is a positive integer. The output unit 1920 is configured to display a color palette including the N second rows of colors.
[0232] When the apparatus 2000 is used for executing the method 1400 or 1500, the output unit 1920 is configured to output a fourth color palette for a portion or all of a third image. The fourth color palette includes colors and reflects position information of each of the colors in the third image. The obtaining unit 1910 is configured to obtain an instruction for selecting a color in the fourth color palette. The processing unit 1930 is configured to determine a region in the portion or all of the third image according to the select color and the position information of the select color in the third image, and output a fifth color palette for the region in the third image.
[0233] It may be understood that the units in the apparatus 2000 may be logical or functional. Each function may correspond to one functional unit, or two or more functions may be integrated into one functional unit. In actual implementation, all or some of the units may be integrated into one physical entity, or may be distributed in different physical entities. In addition, the foregoing functional units may be implemented in a form of hardware, may be implemented in a form of software, or may be implemented in a form of a combination of hardware and software. Whether a function is performed in a form of hardware or software depends on particular applications and design constraint conditions of the technical solutions. A person skilled in the art may use different methods to implement the described functions for each particular application, but it should not be considered that the implementation goes beyond the scope of this disclosure.
[0234] In an example, a functional unit in any one of the foregoing apparatuses may be configured as one or more integrated circuits for implementing the methods disclosed herein, for example, one or more application-specific integrated circuits (application-specific integrated circuits, ASICs) , one or more central processing units (central processing units, CPUs) , one or more microprocessors (microcontroller units, MCUs) , one or more digital signal processors (digital signal processors, DSP) , one or more field programmable gate arrays (field programmable gate arrays, FPGAs) , or a combination of at least two of these integrated circuit forms.
[0235] FIG. 20 illustrates example of apparatus 2010. Apparatus 2010 may include corresponding modules or units configured to implement methods and / or embodiments described herein. In some implementations, the apparatus 2010 includes a storage unit 2011, a processing unit 2012 and a communication unit 2013. The apparatus 2010 may be an electronic device or a module in an electronic device, or a circuit or a chip responsible for functions in an electronic device. Function of the apparatus 2010 may be implemented by one or more processors. In some embodiments, the processor may include a modem chip, or a system on chip SoC chip or an SIP chip that includes a modem core. The storage unit 2011 may be configured to store apparatus program code (or instructions) and / or data.
[0236] As shown in FIG. 21, a computing device 2100 includes a processor 2110 and an interface circuit 2120. The processor 2110 and the interface circuit 2120 are coupled to each other. It is understood that the interface circuit 2120 can be a transceiver or an input / output interface. In some embodiments, the computing device 2100 may further include a memory 2130, and the memory 2130 is configured to store instructions that, when executed by the processor 2110, cause the computing device 2100 to perform any of the methods described above.
[0237] In some embodiments, the memory 2130 is further configured to store input data required by the processor 2110 when it runs the instructions or the data produced after the processor 2110 has run the instructions. The memory 2130 may include one or more of the following storage media: a random access memory (RAM) , , a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, a static random access memory (static RAM, SRAM) , a dynamic random access memory (dynamic RAM, DRAM) , a phase-change memory (PCM) , a resistive random access memory (resistive RAM, ReRAM) , a magnetoresistive random access memory (magnetoresistive RAM, MRAM) , a ferroelectric random access memory (ferroelectric RAM, FRAM) , a cache, a register, a read-only memory (ROM) , a flash memory (flash memory) , an erasable programmable read-only memory (erasable programmable ROM, EPROM) , a hard disk, and the like. In an example, computer program instructions used to execute embodiments may be stored in a non-volatile memory, for example, at least a part of a memory or storage unit (for example, one or more of a ROM, a flash memory, an EPROM, or a hard disk) . When a terminal runs, a part or all of corresponding computer program instructions may be loaded to a memory that has a higher transmission speed with the processor, for example, at least a part of a memory or a storage unit (for example, one or more of a RAM, an SRAM, a DRAM, a PCM, a RERAM, an MRAM, a FRAM, a cache, or a register) , so that the processor executes the computer program instructions to perform the steps in the method embodiments disclosed herein.
[0238] In some other examples, the computing device 2100 includes a processor 2110, and the interface circuit 2120 may also be understood as part of the processor 2110.
[0239] When the computing device 2100 is used to implement the embodiments shown in FIGS. 2 to 18, it may be interpreted as a computing device itself, a module in the computing device, a circuit or chip, a system on chip SoC chip or an SIP chip that includes a modem core, or a combination thereof. The processor 2110 is used to implement the functions of the processing unit 1930, and the interface circuit 2120 is used to implement the functions of the obtaining unit 1910 and output unit 1920. For example, the computing device 2100 may further include a memory 2130, the processor 2110 and the interface circuit 2120 are connected to the memory 2130 over a circuit or a wire, and the processor 2110 is configured to read and execute instructions stored in the memory 2130.
[0240] A computer-readable storage medium is provided. The computer-readable storage medium may be any available medium that an electronic device is capable of storing or a data storage device such as a data center that contains one or more available media. The available media may be magnetic media (e.g., floppy disk, hard disk, magnetic tape) , optical media (e.g., DVD) , or semiconductor media (e.g., solid-state drive) . The computer-readable storage medium includes instructions that instruct the computing device to perform the image color processing method.
[0241] A computer program product storing instructions is provided. The computer program product may be a software or program product that contains instructions and is capable of running on a computing device or being stored in any available medium. When the computer program product is run on at least one electronic device, it causes at least one electronic device to perform the image color processing method described above.
[0242] In the present disclosure, the terms “a” , “an” and “one” are defined to mean “at least one” , that is, these terms do not exclude a plural number of items, unless stated otherwise.
[0243] In the present disclosure, terms such as “substantially” , “generally” and “about” , which modify a value, condition, or characteristic of a feature of an example embodiment, should be understood to mean that the value, condition or characteristic is defined within tolerances that are acceptable for the proper operation of this example embodiment for its intended application.
[0244] In the present disclosure, unless stated otherwise, the terms “connected” and “coupled” , and derivatives and variants thereof, refer herein to any structural or functional connection or coupling, either direct or indirect, between two or more elements. For example, the connection or coupling between the elements can be acoustical, mechanical, optical, electrical, thermal, logical, or any combinations thereof.
[0245] In the present disclosure, expressions such as “match” , “matching” and “matched” , including variants and derivatives thereof, are intended to refer herein to a condition in which two or more elements are either the same or within some predetermined tolerance of each other. That is, these terms are meant to encompass not only “exactly” or “identically” matching the two elements but also “substantially” , “approximately” or “subjectively” matching the two or more elements, as well as providing a higher or best match among a plurality of matching possibilities.
[0246] In the present disclosure, the expression “based on” is intended to mean “based at least partly on” , that is, this expression can mean “based solely on” or “based partially on” , and so should not be interpreted in a limited manner. More particularly, the expression “based on” could also be understood as meaning “depending on” , “representative of” , “indicative of” , “associated with” or similar expressions.
[0247] In the present disclosure, the terms "system" and "network" may be used interchangeably in embodiments of this disclosure. "At least one" means one or more, and "aplurality of" means two or more. The term "and / or" describes an association relationship of associated objects, and indicates that three relationships may exist. For example, A and / or B may indicate the following three cases: Only A exists, both A and B exist, and only B exists, where A and B may be singular or plural. The character " / " indicates an "or" relationship between associated objects. "At least one of the following items (pieces) " or a similar expression thereof indicates any combination of these items, including a single item (piece) or any combination of a plurality of items (pieces) . For example, "at least one of A, B, or C" includes: only A; only B; only C; A and B; A and C; B and C; or A, B, and C, and "at least one of A, B, and C" may also be understood as including: only A; only B; only C; A and B; A and C; B and C; or A, B, and C. In addition, unless otherwise specified, ordinal numbers such as "first" and "second" in embodiments of this disclosure are used to distinguish between a plurality of objects, and are not used to limit a sequence, a time sequence, priorities, or importance of the plurality of objects.
[0248] A person skilled in the art should understand that embodiments of this disclosure may be provided as a method, an apparatus (or system) , computer-readable storage medium, or a computer program product. Therefore, this disclosure may use a form of a hardware-only embodiment, a software-only embodiment, or an embodiment with a combination of software and hardware. Moreover, this disclosure may use a form of a computer program product that is implemented on one or more computer-usable storage media (including but not limited to a disk memory, an optical memory, and the like) that include computer-usable program code.
[0249] This disclosure is described with reference to the flowcharts and / or block diagrams of the method, the device (system) , and the computer program product according to this disclosure. It should be understood that computer program instructions may be used to implement each process and / or each block in the flowcharts and / or the block diagrams and a combination of a process and / or a block in the flowcharts and / or the block diagrams. The computer program instructions may be provided for a general-purpose computer, a dedicated computer, an embedded processor, or a processor of another programmable data processing device to generate a machine, so that the instructions executed by the computer or the processor of the another programmable data processing device generate an apparatus for implementing a specific function in one or more procedures in the flowcharts and / or in one or more blocks in the block diagrams.
[0250] The computer program instructions may alternatively be stored in a computer-readable memory that can indicate a computer or another programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate an artifact that includes an instruction apparatus. The instruction apparatus implements a specific function in one or more procedures in the flowcharts and / or in one or more blocks in the block diagrams.
[0251] The computer program instructions may alternatively be loaded onto a computer or another programmable data processing device, so that a series of operations and steps are performed on the computer or the another programmable device, so that computer-implemented processing is generated. Therefore, the instructions executed on the computer or the another programmable device provide steps for implementing a specific function in one or more procedures in the flowcharts and / or in one or more blocks in the block diagrams.
[0252] It is clear that a person skilled in the art can make various modifications and variations to this disclosure without departing from the scope of this disclosure. This disclosure is intended to cover these modifications and variations of this disclosure provided that they fall within the scope of protection defined by the following claims and their equivalent technologies.
Claims
1.A method for color palette generation, comprising:determining, from a portion or all of a first image, one or more semantic objects, wherein each semantic object in the one or more semantic objects corresponds to first semantic information; andoutputting one or more first color palettes for the one or more semantic objects according to the first semantic information of the each semantic object, wherein the one or more first color palettes are associated with one or more identifiers of the one or more semantic objects, and each first color palette in the one or more first color palettes displays a plurality of first colors associated with the corresponding semantic object.2.The method of claim 1, further comprising:generating the one or more first color palettes for the one or more semantic objects according to the first semantic information of the each semantic object.3.The method of claim 2, wherein the generating the one or more first color palettes for the one or more semantic objects, comprises:inputting the first semantic information of the each semantic object into a pre-trained model; andobtaining the one or more first color palettes for the one or more semantic objects from the pre-trained model, wherein the pre-trained model is obtained by training according to sample color palettes and sample semantic information.4.The method of any one of claims 1 to 3, further comprising:obtaining an input text for the first image;obtaining second semantic information according to the input text; andoutputting one or more second color palettes for the one or more semantic objects according to the second semantic information and the first semantic information of the each semantic object, wherein the one or more second color palettes are associated with the one or more identifiers of the one or more semantic objects, and each second color palette in the one or more second color palettes displays a plurality of second colors associated with the corresponding semantic object.5.The method of claim 4, after the obtaining an input text for the first image, further comprising:obtaining an instruction for generating the one or more second color palettes for the one or more semantic objects, wherein the obtaining second semantic information according to the input text comprises:in response to the instruction for generating the one or more second color palettes for the one or more semantic objects, obtaining the second semantic information according to the input text.6.The method of claim 4 or 5, further comprising:generating the one or more second color palettes for the one or more semantic objects according to the second semantic information and the first semantic information of the each semantic object, comprising:inputting the second semantic information and the first semantic information of the each semantic object into a pre-trained model; andobtaining the one or more second color palettes for the one or more semantic objects from the pre-trained model, wherein the pre-trained model is obtained by training according to sample color palettes and sample semantic information.7.The method of any one of claims 1 to 6, further comprising:obtaining an instruction for indicating the portion of the first image;determining a closed-region of the first image according to the instruction for indicating the portion of the first image; anddetermining the portion of the first image according to the closed-region of the first image.8.The method of any one of claims 1 to 7, wherein the first image is a color, grayscale, or monochrome image.9.The method of any one of claims 1 to 8, further comprising:obtaining an instruction for recommending one or more sets of third colors for a selected first color in the plurality of first colors; andoutputting the one or more sets of third colors according to the instruction for recommending one or more sets of third colors for the selected first color.10.The method of claim 9, wherein the one or more sets of third colors comprise at least one of:one or more complementary colors of the selected first color;one or more analogous colors of the selected first color;one or more triadic colors of the selected first color; orone or more monochromatic colors of the selected first color.11.The method of any one of claims 1 to 10, further comprising:obtaining an instruction for replacing a selected first color in the plurality of first colors; andreplacing the selected first color with a color different from the selected first color according to the instruction for replacing a selected first color in the plurality of first colors, wherein the color different from the selected first color is determined by using a preset rule.12.The method of claim 11, wherein the preset rule comprises having a preset matching degree with the first image in one or more of: hue, saturation, or brightness.13.The method of any one of claims 1 to 12, further comprising:obtaining an instruction for extending the one or more first color palettes; andoutputting a third color palette according to the instruction for extending the one or more first color palettes.14.The method of claim 13, wherein the outputting a third color palette comprises:obtaining second images from an image database according to the first image, wherein a similarity of the first image and each second image in the second images meets a condition; andoutputting the third color palette according to the second images.15.The method of claim 13, wherein the outputting a third color palette comprises:outputting the third color palette from a color palette database according to the one or more first color palettes.16.A method for displaying a color palette, comprising:obtaining Z colors, wherein Z is a positive integer; anddisplaying a color palette comprising an M*N matrix, wherein:M and N are positive integers, Z is equal to or less than a product of M and N, Z cells in the M*N matrix are determined to be occupied in a row-first order,the Z colors are sorted into a linear array, each element in the array represents a color in the Z colors,the array is filled into the Z cells in a column-major order if M<N, or in a row-major order if M>N,in a case of M<N the M colors in each column in N columns are sorted locally , or in a case of M>N the N colors in each row in M rows are sorted locally.17.The method of claim 16, further comprising:obtaining a distance between each two colors in the Z colors; andobtaining the linear array according to distances, wherein the linear array comprises a minimum sum of distances that traverse to the Z colors between two endpoints of the linear array.18.The method of claim 17, wherein the distance is obtained based on a color difference between each two colors in the Z colors.19.The method of claim 18, wherein the color difference comprises a CIEDE2000 color difference and a hue difference.20.The method of any one of claims 16 to 19, further comprising:for the M colors in each column in the N columns, sorting the M colors based on one or more of: lightness or saturation.21.The method of any one of claims 16 to 19, further comprising:for the N colors in each row in the M rows, sorting the N colors based on one or more of: lightness or saturation.22.A method for generating a series of color palettes in a pyramid hierarchy, comprising:outputting a fourth color palette for a portion or all of a third image, wherein the fourth color palette comprises colors and reflects position information of each of the colors in the third image, the fourth color palette is a coarsest resolution of palette and located at top of the pyramid hierarchy;obtaining an instruction for selecting a color in the fourth color palette; andoutputting a fifth color palette for a region in the third image, wherein the region comprises position information of the selected color, the fifth color palette is a higher resolution of palette and located under the top of the pyramid hierarchy, and there are a plurality of fifth color palettes that are providable based on instructions.23.The method of claim 22, wherein the instruction is one or more of: a finger gesture or a stylus gesture.24.An apparatus for generating a color palette, comprising units for performing the method according to any one of claims 1 to 15, any one of claims 16 to 21, or any one of claims 22 to 23.25.An electronic device comprising processing circuitry for performing the method according to any one of claims 1 to 15, any one of claims 16 to 21, or any one of claims 22 to 23.26.A chip, comprising an input / output (I / O) interface and a processor, wherein the processor is configured to call and run a computer program stored in a memory, to enable a device installed with the chip to perform the method according to any one of claims 1 to 15, any one of claims 16 to 21, or any one of claims 22 to 23.27.An electronic device, comprising:one or more processors; anda memory storing instructions which, when executed by the one or more processors, cause the device to perform the method of any one of claims 1 to 15, any one of claims 16 to 21, or any one of claims 22 to 23.28.A computer-readable storage medium having instructions stored thereon which, when executed by a device, cause the device to perform the method of any one of claims 1 to 15, any one of claims 16 to 21, or any one of claims 22 to 23.29.A computer program product storing instructions which, when executed, cause an apparatus to perform the method of any one of claims 1 to 15, any one of claims 16 to 21, or any one of claims 22 to 23.