Method for determining representative colors from at least one digital color image
By distributing K initial cluster centers in a predetermined pattern in a color space, identifying, merging, or deleting cluster centers, the problem of insufficient representativeness and inaccurate color recognition in the prior art is solved, generating a reproducible color palette suitable for decorative and other image processing applications.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AKZO NOBEL COATINGS INT BV
- Filing Date
- 2021-04-13
- Publication Date
- 2026-07-10
AI Technical Summary
Existing digital color image clustering methods struggle to accurately identify and reproduce colors that are not representative enough, and the output color palette results depend on the random selection of the initial centroid, leading to inconsistencies and a bias towards neutral colors.
By distributing K initial cluster centers in a predetermined pattern in a color space, identifying, merging, or deleting cluster centers, a color palette representing representative colors is formed, ensuring the reproducibility of the results.
It achieves accurate identification and reproduction of underrepresented colors, generating a reproducible color palette suitable for decorative and other image processing applications.
Smart Images

Figure CN115335864B_ABST
Abstract
Description
Invention Field
[0001] This invention relates to a method for determining one or more representative colors from at least one digital color image. More specifically, this invention relates to determining one or more paint colors representing at least one digital color image. More particularly, this invention relates to generating personalized color palettes from mood boards. Background of the Invention
[0003] Consumers wishing to choose one or more paint colors, such as for decorating a room, have a large number of color options to choose from. Furthermore, selecting multiple paint colors that coordinate with each other, or that coordinate with, for example, the color of a piece of furniture, is highly subjective and can be a challenging task. Paint manufacturers typically provide pre-arranged color palettes that may not reflect consumer preferences. Therefore, this invention aims to facilitate the selection process by providing consumers with a personalized color palette based on one or more color images selected by the consumer.
[0004] In interior design, a mood board is a creative first step that helps explore ideas before a project begins. The colors on a mood board can represent important information about the envisioned interior design. While traditional mood boards are made of foam board and decorated with various physical objects such as stickers, tape, artwork, photos, magazine clippings, and fabrics, their digital equivalent (digital mood boards) can include one or more digital images.
[0005] The one or more images can form a "mood board" that reflects the consumer's personal preferences. For example, the consumer can provide several color images they like, such as color images of natural scenes or indoor settings. Based on the mood board, this invention aims to provide consumers with a color palette that represents the colors in the compiled mood board.
[0006] Colors that contrast strongly with their surroundings are well perceived by humans, even if the contrasting color occupies only a small area of the image. Therefore, it is particularly important to identify “underrepresented colors” in the one or more images, that is, visually salient colors with low pixel counts (or, in other words, colors that occupy only a small area of the image but are still well perceived) and include these in the color palette.
[0007] Extracting the dominant color from a digital color image is generally known and typically involves a clustering routine that groups pixels with similar color values together. Each group of pixel color values, i.e., each cluster, can be represented by a representative color of that group, such as the average or median color value of the pixels in that group. The representative colors of multiple clusters together can form the color palette of the input image.
[0008] The widely used clustering methods for generating this palette are centroid-based algorithms, such as k-means clustering or similar algorithms, which divide the pixel color values of an image into multiple clusters, where each pixel color value is assigned to the nearest cluster centroid such that the distance metric of each cluster is minimized. An example of this use of the k-means clustering algorithm is described by G. Ciocca, P. Napoletano, and R. Schettini in “Evaluation of Automatic Image Color Theme Extraction Methods,” Computational Color Imaging Workshop (2019). This method works by first selecting k random colors from the image, denoted as initial centroids. Then, for all other pixels in the image, the nearest initial centroid is determined, and the pixels are assigned to that centroid, resulting in a group (cluster) of pixels assigned to their nearest centroid. Next, the centroids are recalibrated by calculating the average of all pixels in each cluster. This process is repeated until convergence, i.e., until all new centroids are no longer significantly different from the old centroids. Although early results by Ciocca et al. (2019) showed that the k-means method is highly accurate in extracting appropriate palettes compared to other more complex methods, its dependence on the random selection of initial centroids makes the method non-reproducible, limiting its practical application as running the same method multiple times on the same input image will result in different palettes. To overcome this problem, Ciocca et al. (2019) proposed a method to fix the initialization by uniformly sampling the initial centroids across a set of colors ordered from brightest to darkest. Unfortunately, this did not yield better performance. Since the initial centroids in this case are all gray hues, the final palette will be biased towards neutral colors.
[0009] One drawback of known color clustering routines is that they are designed to identify the most dominant colors in a digital color image and cannot extract underrepresented colors as defined above.
[0010] For example, WO 2014 / 070168A1 describes generating a color palette from an image using a k-means clustering routine, where the routine involves pseudo-random seeding of multiple cluster centroids. A drawback of this random or pseudo-random initialization is that the output palette is highly dependent on the initial seed of the centroids. In particular, colors that are relatively unrepresentative in the input image, such as small, isolated clusters, may not be recognized by the clustering routine and may not end up in the generated palette. Furthermore, for a given input image, the reproducibility of the output palette is poor due to the algorithm's random initialization.
[0011] EP 2526683A1 also describes the use of a k-means clustering algorithm to determine the dominant colors present in a sample image, where the number of clusters increases adaptively. The clustering algorithm is initialized by assigning all pixels in the image to a single cluster with a single centroid, which is the average of all pixel values. In each iteration, if the number of pixels within a predetermined range of the centroid is below a predetermined threshold, another cluster is added. Although the algorithm is not randomly initialized, it is designed to identify the dominant colors in an image and is not suitable for identifying colors with relatively low representativeness, such as small, isolated clusters. Therefore, these less representative colors are unlikely to end up in the output palette.
[0012] EP 1274228A2 describes a method for generating reduced color groups from a digital color image for rendering the image on a color output device with reduced bit depth, such as an LCD screen. The method enhances important underrepresented colors in the image, particularly skin tones, so that they ultimately appear in the output palette. Although underrepresented colors are considered in this method, what constitutes an underrepresented color is a priori unknown for many applications. Invention Overview
[0014] The object of this invention is to provide a method for determining one or more representative colors from one or more digital color images, wherein less dominant colors in the one or more color images may be identified as representative colors. A further object is to provide a method for determining one or more representative colors from one or more digital color images that provides reproducible results.
[0015] Therefore, in a first aspect, a computer-executed method is provided for determining a predetermined number of k representative colors from at least one digital color image, comprising the following steps:
[0016] a) Obtain at least one digital color image having a number of pixels p, each pixel having a color value in an n-dimensional color space;
[0017] b) Define a predetermined number of K cluster centers, which are distributed in a color space according to a predetermined pattern, preferably representing different colors, where K>k;
[0018] c) Clusters are formed by associating the color value of each pixel with the nearest cluster center;
[0019] d) Reduce the number of clusters to k by deleting cluster centers and / or merging clusters;
[0020] e) Define the representative color for each of the resulting k clusters.
[0021] Deletion involves determining the number of pixels associated with each cluster and deleting cluster centers when the number of associated pixels is less than or equal to a predefined pruning threshold. Merging involves determining the distance between at least two cluster centers and merging clusters whose distance is less than a predefined merging threshold (e.g., they can then be represented with new cluster centers).
[0022] The generated representative colors can collectively form a palette of representative colors for the at least one digital color image. Since the method is initialized with a predefined number K of cluster centers, exceeding the number k of generated representative colors, cluster centers may be seeded near pixel color values of underrepresented colors in the color space. Therefore, such underrepresented colors can be identified by this method, thus ultimately forming a set of representative colors. For example, initial cluster centers may be seeded near groups of relatively small and isolated pixel values in the color space, which will be associated with the nearest cluster center to form a cluster. A small group of isolated pixel values is typically associated with underrepresented colors in the at least one digital color image, and due to their isolation, they can contrast with more dominant or primary colors in the image. The cluster centers may not be deleted or merged with other cluster centers because they are isolated and, for example, have more associated pixels than a pruning threshold. Therefore, even if the cluster represents a relatively underrepresented color in the at least one digital color image, it can still be identified and represented using representative colors.
[0023] Since the K initial cluster centers are predefined and distributed in the color space according to a predetermined pattern, the initialization in step b) is non-random, and the method provides reproducible results for a given digital color image. In other words, repeating the method on the same digital color image will produce the same generated representative color set. It should be understood that the distribution pattern of the initial cluster centers in the color space is determined independently of the specific digital color image, i.e., predetermined. Otherwise, the predetermined initial seeding pattern would be unrelated to the specific digital color image. It should be understood that different patterns can be used for different categories of images.
[0024] The resulting representative color set can form a color palette for selecting paint colors for decoration, such as for a room. However, it is clear that this method can be used for a variety of other image processing applications, such as computer vision, automatic feature detection, and file compression.
[0025] A predetermined number of K initial cluster centers are distributed in a color space according to a predetermined pattern. The predetermined pattern includes initial cluster centers representing different colors and optional achromatic colors. Preferably, the predetermined pattern includes initial cluster centers representing different colors and optional achromatic colors, as well as different brightness values. In the RGB color space, brightness can be considered as the arithmetic mean of the red, green, and blue coordinates (although some of these three components can make light appear brighter to human perception than others). The predetermined pattern may include initial cluster centers representing one or more of blue, cyan, green, yellow, red, and magenta, and preferably all of them.
[0026] In some implementations, it may be preferable that the K initial cluster centers are dispersed in the color space such that the initial cluster centers cover as much of the color space as possible. The cluster centers are preferably uniformly (in a regular manner) distributed in the color space, i.e., within equidistant distances from each other. In other words, the initial cluster centers are preferably uniformly distributed in the n-dimensional color space. In this way, the method is more likely to identify underrepresented colors, i.e., small-scale and / or isolated clusters, in the at least one digital color image.
[0027] In some implementations, the K initial cluster centers are preferably distributed in one or more planes in the color space.
[0028] Optionally, the K initial cluster centers are distributed along a straight line in the color space, for example, extending through the color space. The initial cluster centers can be distributed along an achromatic line extending from black to white in the RGB space. The achromatic line extends between two opposite diagonals in the cubic RGB space. The K initial cluster centers can be regularly distributed along this line (i.e., within the same distance between the nearest cluster centers). The K initial clusters can be located at predefined positions along this line.
[0029] In some implementations, it is preferable that the K initial cluster centers are distributed along multiple lines (e.g., straight lines) in the color space, for example, each line extending through the color space. The lines may form a grid in the color space, such that the K initial cluster centers are (regularly) distributed across the color space. The lines may extend between opposite diagonals, opposite ribs, and / or opposite planes in a cubic RGB space. Optionally, the K initial cluster centers are located at predetermined positions along multiple straight lines in the color space, for example, each straight line extending through the color space.
[0030] Preferably, the K initial cluster centers are distributed along multiple intersecting lines in the color space, wherein optionally, the intersection of the lines is located at the center of the color space. The multiple intersecting lines can extend in a cubic RGB color space, wherein optionally, the intersection of the lines is located at the center of the cubic RGB color space. With this star-shaped initialization, the K initial cluster centers are well (uniformly) dispersed in the color space and effectively span the color space observed by the human eye. Optionally, the K initial cluster centers are located at predefined (regular) positions along the multiple intersecting lines in the color space, wherein optionally, the intersection of the lines is located at the center of the color space.
[0031] Therefore, K initial cluster centers can be selected along multiple color directions (e.g., all major color directions) to cover a wide color range, rather than uniformly sampling K initial cluster centers along a line from light to dark (i.e., non-color). However, when the sampling of initial cluster centers is extended from one direction (from light to dark) to multiple directions (e.g., all major color directions), initial cluster centers can be introduced without any associated pixels (“empty clusters”). Given this, and to increase color selectivity, the number of initial cluster centers is chosen to be greater than a predetermined number of representative colors to be obtained.
[0032] Besides sampling points in multiple color directions, this method differs from the k-means algorithm in two other ways. Instead of an initialization algorithm using precise k points, this method can initialize with any number of K points, such as points sampled uniformly in all major color directions. Furthermore, the method includes a step of calculating the color difference between cluster centers, merging clusters if their color difference is less than a merging threshold. Additionally, (almost) empty clusters are removed if the number of pixels in a cluster is less than or equal to a trimming threshold. This means that applying this method will not produce a predefined number of clusters, but the exact number of colors in the final palette will depend on the input image. Iterative variants of this method can be provided, allowing the computation of a palette with a predefined number of colors, which operates by iteratively adjusting the merging and / or trimming thresholds until a palette with the desired number of colors is obtained.
[0033] The pruning threshold can be set to zero pixels, for example, to remove the cluster centers of empty clusters (i.e., clusters with no pixels).
[0034] The term "distance" as used here refers to the similarity or dissimilarity between elements in a color space. It should be understood that any distance metric can be used within the scope of this method to determine the similarity or distance between elements in a color space, such as the 1-norm, 2-norm, 3-norm, ∞-norm, etc. For example, the distance between two color values in a color space can be expressed as the Euclidean distance, i.e., the 2-norm distance. In this regard, the cluster center "nearest" to a particular color value of a pixel is the specific cluster center with the smallest distance metric between that color value and any other cluster center.
[0035] Similarly, the distance between clusters refers to the similarity or dissimilarity between clusters. For example, the distance between two clusters can be defined as the distance between their respective cluster centers or the distance between their respective cluster boundaries.
[0036] Clusters can be merged, for example, by removing one or more cluster centers from groups of similar clusters. For instance, two similar clusters can be merged into a single cluster by removing either of their cluster centers, such as the one with the smallest or largest number of pixels associated with it. Optionally, the smallest color cluster center is removed to avoid substantially non-colorous colors (i.e., black, white, and gray tones) in the color space. It has been found that relatively high color values in color images are particularly noticeable to human observers. Therefore, merging clusters by selecting cluster centers associated with relatively high color values (e.g., removing cluster centers associated with the lowest color values) would result in a method similar to human perception of these significantly high color values. Colorimetric criteria can be used to determine which cluster center is associated with the smallest color value, for example, by determining the Euclidean distance for each cluster center using non-color values (e.g., black, gray, or white). Therefore, merging could include (using a merging threshold) removing the smallest color cluster center from a group of similar cluster centers. The pixel values associated with the removed cluster center can be reassociated with any of the remaining cluster centers. Similar clusters can also be merged by deleting old cluster centers and defining new cluster centers based on the color values of similar clusters and / or the old cluster centers. The new cluster centers can, for example, be set as the average or weighted average of the centers of the similar clusters and / or their respective clusters. It should be understood that any cluster group, such as groups of 2, 3, 4, or more clusters, can be merged if the distance between the cluster centers in the group is less than a predefined merging threshold. Thus, the merging threshold can be used as a control variable to control the reduction or rate of reduction of clusters from K to k.
[0037] It should be understood that cluster centers can be defined by the cluster's mean, median, centroid, or any other color value.
[0038] Optionally, the method includes performing step c1) after step c): for each cluster, redetermining the cluster centers. After forming clusters by associating the color value of each pixel with the nearest (predefined) cluster center, the location of the cluster centers can be redetermined. The redetermined cluster centers can be, for example, the color value that minimizes the variance in the cluster, such as the average of the color values in the cluster. Other options for redetermining the cluster centers include setting the cluster center to the median, center point, or other value of the color values in the cluster. The redetermined cluster centers can be, but do not necessarily be, the constituent color values of the cluster, i.e., members of the cluster's color values. After redetermining the cluster centers, the steps of forming clusters can be repeated by associating the color value of each pixel with the nearest cluster center. Then, in step d), the cluster centers of, for example, empty clusters can be removed again, and similar clusters can be merged to obtain k clusters. The representative color can be based on the redetermined cluster centers.
[0039] Optionally, the method includes iterative steps c), c1), and d). These steps may iterate a predetermined number of times. Optionally, steps c), c1), and d) are iterated until a convergence criterion is met. Therefore, after initialization in step b), the following steps can be iterated:
[0040] c) Clusters are formed by associating the color value of each pixel with the nearest cluster center;
[0041] c1) For each cluster, redetermine the cluster centers;
[0042] d) Reduce the number of clusters to k by deleting cluster centers and / or merging clusters.
[0043] The deletions include:
[0044] - For each cluster, determine the number of pixels associated with that cluster, and
[0045] - Delete cluster centers if the number of associated pixels is less than or equal to a predefined pruning threshold.
[0046] And the merger includes:
[0047] - Determine the distance between at least two clusters and / or cluster centers.
[0048] - Merge clusters that are less than a predefined merging threshold.
[0049] In this way, the method converges to a local optimum, generating k clusters, each with a cluster center. Furthermore, the cluster centers converge to color values in the color space in a manner similar to centroid-based clustering methods (e.g., k-means clustering or similar methods). After iterations in steps c), c1), and d), a representative color can be determined in step e). The finally determined cluster centers can, for example, define the representative color in step e).
[0050] Optionally, the method includes performing the following steps after step d):
[0051] d1) Determine the number of clusters, and if the determined number of clusters is not equal to k:
[0052] d2) Adjust the merge threshold and / or pruning threshold based on the determined number of clusters.
[0053] For example, a merge threshold and a pruning threshold are defined a priori. After obtaining the at least one digital color image in step a) and initializing cluster centers in step b), K clusters can be formed in step c) (for the first time). The cluster centers of the formed clusters can optionally be redefined in step c1), but this step can be omitted. Subsequently, in step d), the number of K clusters is reduced by deleting cluster centers and / or merging clusters based on the merge and pruning thresholds. If the number of clusters obtained after reducing the number of clusters is not equal to k, the merge threshold and the pruning threshold are adjusted to obtain k clusters. Preferably, the pruning threshold can be set to zero, i.e., only the cluster centers of empty clusters are deleted in step d), and only the merge threshold is adjusted.
[0054] The number of clusters can be determined, for example, by counting the number of cluster centers.
[0055] Alternatively, after step b), steps c), c1), and d) can be iterated, and after several iterations, such as until convergence, steps d1), d2), and e) can be performed.
[0056] Optionally, step d2) includes:
[0057] - When the number of clusters is greater than k: increase the merge threshold and / or pruning threshold; and
[0058] - When the number of clusters is less than k: reduce the merge threshold and / or pruning threshold.
[0059] Optionally, the method includes iterative steps d1), d2), c), and optionally c1), d), until the number of clusters obtained is equal to k. For example, a merge threshold and a pruning threshold are defined a priori. After obtaining the at least one digital color image in step a) and initializing cluster centers in step b), K clusters can be formed in step c). The cluster centers of the formed clusters can optionally be re-determined in step c1), but this step can be omitted. Subsequently, the number of K clusters is reduced in step d) by deleting cluster centers and / or merging clusters based on the merge and pruning thresholds. If the number of clusters obtained after reducing the number of clusters is not equal to k, the merge threshold and the pruning threshold are adjusted. For example, if the number of clusters is higher than k, the merge threshold and / or the pruning threshold can be increased. If the number of clusters is lower than k, the merge threshold and / or the pruning threshold can be decreased. The merge threshold and / or the pruning threshold can be adjusted linearly (i.e., by a fixed increment) or non-linearly (i.e., by an increasing or decreasing increment). Preferably, the pruning threshold is set to zero, without adjusting it in step d2). In this way, only the cluster centers of empty clusters are deleted in step d). After adjusting the merge and / or pruning thresholds, the method can be re-executed based on the adjusted merge and / or pruning thresholds. Therefore, steps d1), d2), c), and optionally c1 and d) can be iterated several times until, for example, the number of clusters in step d) is reduced from K to k. In step e), k representative colors can be determined from the resulting k clusters. The k representative colors are, for example, the final cluster centers or the average value of the corresponding clusters.
[0060] Alternatively, steps c), c1), and d) can be iterated after step b), and after several iterations, e.g., until convergence, steps d1) and d2) can be performed. If, after several iterations, the number of clusters is not equal to k, the merging threshold and / or pruning threshold can be adjusted in steps d1) and d2). This procedure can be repeated several times; that is, after the adjustment in step d2), the method can again include iterating steps c), c1), and d) until the number of clusters is reduced from K to k. Then, the resulting k clusters can be used in step e) to determine k representative colors. For example, the corresponding cluster centers of the k clusters can define representative colors.
[0061] Optionally, the representative color is a representative component color of the at least one digital color image. For some applications, it is preferable to determine a representative color in the digital color image that is a member of the p pixel values of the color image. In this case, the representative color can be determined, for example, in step e) by selecting the cluster median or centroid. Alternatively, the component color value closest to its cluster mean can be selected as the representative color of that cluster.
[0062] Optionally, the n-dimensional color space is the RGB space. A typical digital color image is represented by red, green, and blue channels. For example, each channel of a 24-bit digital image has 8 bits. Therefore, the RGB space can be defined as a three-dimensional vector space, where the three axes of the RGB space define the red, green, and blue values. The RGB space is, for example, a 256×256×256 color space. It should be understood that the color space can also be other color spaces, such as CMYK, CIELAB, or CIEXYZ.
[0063] Optionally, the representative color can be compared to a set of standard paint colors. The paint color most similar to the representative color can be selected from this set of standard paint colors.
[0064] Optionally, paint can be prepared using any representative color. This can be done, for example, using a paint mixing device. The paint mixing device can take one or more representative colors, i.e., a palette, as input and mix the toner to obtain the desired color. The paint mixer can also take one or more digital color images as input, such as mood boards, where, for example, a dedicated processing unit of the paint mixer performs the methods described herein. The user can select a representative color, and the paint mixing device mixes the toner together to obtain a paint with the selected color.
[0065] According to a second aspect, a computer-executed method for determining paint colors is provided, comprising determining a predetermined number of k representative colors from at least one digital color image by performing the method of the first aspect, and further comprising comparing each of the k representative colors with a standard paint color in a standard paint color library, and assigning a corresponding matching standard paint color in the standard paint color library to each representative color.
[0066] According to a third aspect, a system is provided for determining a predetermined number of k representative colors from at least one digital color image, the system comprising:
[0067] - A receiver for receiving at least one digital color image having p pixels, the pixels having color values in an n-dimensional color space;
[0068] - An initializer, which is used to initialize cluster centers distributed in a color space, for example, in a predetermined pattern, for example, in a predetermined number K, for example, predefined cluster centers, where K>k;
[0069] - An allocator, which is used to form clusters by associating the color value of each pixel with its nearest seed center;
[0070] - A reduction unit, used to reduce the number of clusters to k, wherein the reduction unit includes a pruning unit for deleting cluster centers and / or a merging unit for merging clusters.
[0071] The trimming unit is arranged to delete cluster centers with a number of associated pixels less than or equal to a predefined trimming threshold, and the merging unit is arranged to merge those clusters whose distance is less than a predefined merging threshold.
[0072] - Definer, which is used to define the representative color for each of the resulting k clusters.
[0073] The system can be configured to perform the method of the first aspect.
[0074] Optionally, the system includes a database containing one or more standard paint colors, and a comparator for comparing each of k representative colors with the one or more standard paint colors.
[0075] Optionally, the system includes a user interface configured to receive one or more digital color images from the user and output a palette of k representative colors.
[0076] Optionally, the system includes a compiler for compiling one or more digital color images into a single mood board image.
[0077] It should be understood that all the features and options mentioned in this method also apply to the system and computer program product, and vice versa. It will also be clear that any one or more of the above aspects, features, and options can be combined.
[0078] The methods described herein can be executed on computing devices, such as point-of-sale computer systems or mobile computing systems, such as smartphones, tablets, and laptops. The methods can also be provided by computer program products, such as applications or web-based software loaded and executed on general-purpose computers or mobile computing systems. Brief description of the attached diagram
[0080] Embodiments of the present invention will now be described in detail with reference to the accompanying drawings, wherein:
[0081] Figure 1-7 Each method is shown in a schematic flowchart.
[0082] Figure 8A and 8B It shows a schematic instance of a predetermined number of K predefined cluster centers, which are distributed in a color space in a predetermined pattern. Invention Details
[0084] Determining a representative set of colors from digital color images can be used in many applications. For example, to facilitate paint color selection, the method described herein can provide a palette of representative colors based on one or more digital color images provided by a user. A user can, for example, collect and input one or more sets of digital color images they like, and a palette can be provided based on the colors in the input images. Several color images can be input individually or constitute a single mood board image or collage. Each image in the image set can be weighted differently to express certain preferences within the image set. For example, some images constituting the mood board can be enlarged to increase the weight of colors in that particular image.
[0085] Because colors with strong contrast relative to their surroundings are very prominent to human observers, it is necessary to consider these underrepresented colors, even if they occupy only a small area of a mood board, and ensure that these colors are identified as representative colors. For example, a mood board may consist of several interior design images, where blue and gray tones are most prevalent. However, some of the images that make up the mood board may depict small bright yellow features that stand out against an environment dominated by dark blue and gray. In short, this bright yellow only covers a small portion of the mood board—that is, only a few pixels are yellow—but the user can clearly perceive its presence and may therefore appear in the mood board. To be able to identify such secondary colors, a computer-executed method is provided for determining a predetermined number of k representative colors from at least one digital color image, such as... Figure 1 As shown.
[0086] The number of representative colors, k, can be defined a priori as any desired number.
[0087] Figure 1 A schematic flowchart of a method is shown, wherein step a) includes:
[0088] a) Obtain at least one digital color image with p pixels, each pixel having a color value in an n-dimensional color space.
[0089] The at least one digital color image can be a single image or a collection of images. A single image can be, for example, a composite of multiple color images, such as forming a mood board reflecting a user's personal preferences. Typically, a digital color image is represented by red, green, and blue channels, where each pixel has red, green, and blue color values assigned to it. In a 24-bit digital image, each channel has 8 bits, allowing each pixel to have 256 different red, 256 different green, and 256 different blue values, for example, on a scale from 0 to 255. Therefore, an n-dimensional color space can be a three-dimensional RGB space, where the three axes of the RGB space define the red, green, and blue values. The color value of each pixel can be represented by a vector in a 256×256×256 RGB vector space. It should be understood that the color space can also be other color spaces, such as CMYK, CIELAB, or CIEXYZ.
[0090] The subsequent steps of this method are as follows:
[0091] b) Define a predetermined number of K cluster centers distributed in the color space according to a predetermined pattern, where K>k.
[0092] The number K of the initial cluster centers can be distributed in the color space. Figure 8A and 8B Two alternative modes are shown for how the K initial clusters can be seeded in the color space. Figure 8A The specific distribution of K predefined cluster centers is shown; here there are 21 cluster centers, which are distributed along the achromatic lines in the RGB color space, diagonally spanning the RGB space between two opposite corners. Figure 8B The diagram shows a specific distribution of K predefined cluster centers, distributed along multiple straight lines (e.g., 13) in the RGB color space, extending, for example, between opposite corners, midpoints of ribs, and the center of the plane in the RGB space. These lines intersect at their center points in the RGB space, creating a star-shaped configuration of the predefined cluster centers. In this configuration, the color space is densely seeded with predefined cluster centers that span the entire color space. Therefore, the number of K predefined clusters exceeds the number of k representative colors.
[0093] After initialization in step b), the method includes performing:
[0094] c) Clusters are formed by associating the color value of each pixel with its nearest cluster center. The nearest cluster center can be based on Euclidean distance or any other distance metric. A cluster is defined by the color values of the set of pixels associated with a single cluster center. Some clusters may be empty when a cluster center has no associated pixel color values.
[0095] The next method steps include:
[0096] d) Reduce the number of clusters to k by deleting cluster centers and / or merging clusters.
[0097] The deletions include:
[0098] - For each cluster, determine the number of pixels associated with that cluster, and
[0099] - If the number of associated pixels is less than or equal to a predefined pruning threshold, delete cluster centers, where merging includes:
[0100] - Determine the distance between at least two clusters, and
[0101] - Merge clusters that are less than a predefined merging threshold.
[0102] To obtain a predetermined number k of representative colors, it is desirable to reduce the number of clusters and cluster centers from K to k. This is achieved by merging clusters and / or deleting cluster centers. Preferably, the pruning threshold can be set to zero, thus deleting only the cluster centers of empty clusters that have no pixels in the cluster. In some implementations, when removing the cluster centers of non-empty clusters, pixels previously assigned to that cluster can be marked as unassigned or assigned to the cluster with the nearest cluster center. If they are marked as unassigned, they can be assigned to different new clusters in the next iteration. Clusters with centers close to each other can be merged because these clusters may represent similar colors. The similarity between clusters can be defined by the distance between their respective cluster centers. The merge threshold can be defined as a distance where two clusters are merged if the distance between them is less than this threshold distance. The merge and / or pruning thresholds can be adjusted such that the number of clusters is reduced from K to k.
[0103] After reducing the number of clusters in step d), the final step of the method includes:
[0104] e) Define the representative color for each of the resulting k clusters.
[0105] A representative color could be, for example, the average color value of the corresponding cluster. Alternatively, it could be a constituent color, i.e., the color value of one of the p pixels that is a member of the original digital color image. In this case, the pixel color value closest to the average color value of the cluster can be selected, or the median or centroid value of the cluster can be used to define the representative color of that cluster.
[0106] Figure 2 A schematic flowchart of a method is shown, wherein step c1) is performed after step c), and step c1 includes:
[0107] c1) For each cluster, redetermine the cluster centers. The redetermined cluster centers can be, for example, color values that minimize the variance in the cluster, such as the average of the color values in that cluster. Other options for redetermining cluster centers include setting the cluster centers to the median, center point, or other values of the color values in that cluster. The redetermined cluster centers can be, but are not necessarily, constituent color values of the cluster, i.e., members of the cluster's color values.
[0108] Figure 3 A schematic flowchart of a method is shown, in which steps c), c1), and d) are iterated. Therefore, after step d), the method continues to step c) instead of step e). After a certain convergence criterion is met, the method continues to step e) after step d). The convergence criterion can be a predefined number of iterations and / or a convergence metric. Iterating steps c) and c1) is similar to the steps taken in commonly known clustering techniques, such as k-means clustering and similar techniques, where cluster centers converge to local optima. Including step d) in the iteration provides convergence from the number of cluster centers in K predefined clusters to k clusters. The clusters are iteratively reduced from K to k by repositioning the cluster centers in step c1). Cluster centers can be repositioned from their predefined locations (step b) such that the distance between some cluster centers becomes smaller in each iteration. For example, some cluster centers converge to the same local optimum, and at some point, the distance between them is defined to be less than a predefined merging threshold. These clusters are merged in step d) until k clusters are obtained. This method may not converge to k clusters. In such cases, the pruning threshold and / or merging threshold may need to be set to different values (e.g., manually).
[0109] Figure 4 A schematic flowchart of a method is shown, in which steps d) and d2) are performed after reducing the number of clusters in step d), wherein:
[0110] d1) Determine the number of clusters, and if the determined number of clusters is not equal to k:
[0111] d2) Adjust the merging threshold and / or pruning threshold based on the determined number of clusters. Step c1) In Figure 4 The method is optional, as shown by the dashed line.
[0112] The number of clusters can be determined based on the number of cluster centers. For example, the number of clusters can be determined by determining the number of cluster centers, where if the determined number of cluster centers is not equal to k, then step d2 is executed.
[0113] Specifically, when the number of clusters and / or cluster centers is greater than k, the merge threshold and / or pruning threshold can be increased. Similarly, when the number of clusters is less than k, the merge threshold and / or pruning threshold can be decreased. Preferably, the pruning threshold can be set to zero, such that only the cluster centers of empty clusters are deleted without adjusting the pruning threshold. This ensures that even very small clusters, i.e., highly underrepresented colors, can be identified using this method.
[0114] Figure 5 A schematic flowchart of one method is shown, in which steps c), c1), and d) are iterated. Figure 3 As described in the method, the iterations of steps c), c1), and d) allow the cluster centers to converge to a local optimum, similar to the steps taken in centroid-based clustering algorithms, where step d) allows the number of clusters (iterations) to be reduced to k.
[0115] Figure 6 A schematic flowchart of a method is shown, in which steps c), d), d1), and d2) are iterated, or steps c), c1), d), d1), and d2) are iterated. In other words, as shown by the dashed lines, step c1), i.e., redetermining the cluster centers for each cluster, is optional. The merge threshold and / or pruning threshold can be adjusted in steps d1) and d2) based on reducing the number of clusters after step d). For example, after initializing the initial cluster centers in step b), clusters are formed in step c), and the number of clusters is reduced in step d) based on the settings of the merge and pruning thresholds. If the reduced number of clusters is not equal to k, steps d1) and d2) can adjust the merge and / or pruning thresholds so that the method can be re-executed from step c) based on the adjusted threshold portion. For example, if the number of clusters is greater than k, the merge and / or pruning thresholds can be increased in each iteration. Similarly, if the number of clusters is less than k, the merge and / or pruning thresholds can be decreased. The thresholds can be adjusted incrementally in each iteration to converge the number of clusters from K to k. In this method, the relocation of cluster centers in step c1) is not necessary and can be omitted to reduce computational cost. If the reduced number of clusters in step d) equals k, the method will interrupt the loop and continue with step e).
[0116] Figure 7 A schematic flowchart of a method is shown, which involves two iterations. First, the inner loop consists of iterative steps c), c1), and d), as follows: Figure 3 and 5 As shown in the explanation of this method, the second is the outer loop, such as... Figure 6The method is illustrated as described above. The method includes obtaining a digital color image in step a) and initializing predefined cluster centers in step b), followed by iterating an inner loop through steps c), c1), and d), e.g., until convergence. After this iteration of the inner loop, the method continues with steps d1) and d2), where, if the number of clusters and / or cluster centers is not equal to k, a merge threshold and / or a pruning threshold are adjusted. After adjusting the thresholds, the method loops back to step c), restarting the inner loop iteration, e.g., until convergence. If, after step d), the number of clusters equals k, the thresholds are not adjusted, and the method breaks the outer loop and continues with step e).
[0117] After executing such Figure 1-7 Following any of the explained method steps, the user can see a representative set of colors. The representative color can be a standard paint color, or it can be compared to a standard paint color in a standard paint color library and, for example, converted to the closest standard paint color using a known algorithm. A paint having the representative color or a standard paint color close to the representative color can then be prepared, for example, in a paint mixer. The paint mixing device may, for example, have a user interface where the user can input the representative color or the closest standard color generated by the methods described herein, wherein the paint mixing device outputs a paint of that particular color, for example, by mixing paint toners. The paint mixing device can also take one or more digital color images as input, such as mood boards, where the device's processing unit executes methods for determining the representative set of colors. For example, the user can select one of their favorite colors via the user interface, and based on that color, the paint mixer prepares a paint of the desired color.
[0118] However, other modifications, variations, and substitutions are also possible. Therefore, the specifications, drawings, and examples should be considered illustrative rather than restrictive.
[0119] For the purposes of clarity and concise description, the features described herein are part of the same or separate embodiments; however, it should be understood that the scope of the invention may include embodiments having a combination of all or some of the features described.
[0120] In the claims, any reference numerals placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of features or steps other than those listed in the claims. Furthermore, the terms "an" and "a kind" should not be construed as limited to "one (kind)," but are used to mean "at least one," and do not exclude multiples. The fact that certain measures are listed in mutually different claims does not imply that a combination of these measures cannot be used for a beneficial purpose.
Claims
1. A computer-executed method for determining a predetermined number of k representative colors from at least one digital color image, comprising the following steps: a) Obtain at least one digital color image having a number of pixels p, each pixel having a color value in an n-dimensional color space; b) Define a predetermined number of K initial cluster centers independent of the obtained image, the cluster centers being distributed along multiple lines in a cubic RGB color space, the multiple lines intersecting at an intersection point located at the center of the cubic RGB color space, where K>k; c) Clusters are formed by associating the color value of each pixel with the nearest cluster center; and after clustering is formed... c1) For each cluster, redetermine the cluster centers; d) Reduce the number of clusters to k by deleting cluster centers and / or merging clusters; The deletion mentioned above includes: - For each cluster, determine the number of pixels associated with that cluster, and - Delete cluster centers if the number of relevant pixels is less than or equal to a predefined pruning threshold. And the merger mentioned therein includes: - Determine the distance between at least two clusters, and - Merge clusters that have a distance less than a predefined merging threshold; This involves iterating through steps c), c1), and d), and... e) Define the representative color for each of the resulting k clusters.
2. The method of claim 1, wherein a predetermined number of K initial cluster centers are distributed along multiple straight lines extending between opposite diagonals, rib midpoints, and plane centers in a cubic RGB space.
3. The method according to claim 1 or 2, further comprising performing the following steps after step d): d1) Determine the number of clusters, and if the determined number of clusters is not equal to k: d2) Adjust the merge threshold and / or pruning threshold based on the determined number of clusters.
4. The method of claim 3, wherein step d2) comprises: - When the number of clusters is greater than k: increase the merging threshold and / or pruning threshold; and - When the number of clusters is less than k: reduce the merge threshold and / or pruning threshold.
5. The method according to claim 3, comprising iterative steps d1), d2), c), and d), until the number of clusters obtained is equal to k.
6. The method according to claim 3, comprising iterative steps d1), d2), c), c1), and d), until the number of clusters obtained is equal to k.
7. The method according to claim 1 or 2, wherein the representative color is a representative component color of the at least one digital color image.
8. The method according to claim 1 or 2, wherein the K initial cluster centers are uniformly distributed along the line.
9. The method according to claim 1 or 2, wherein the K initial cluster centers are distributed in one or more planes in the color space.
10. The method according to claim 1 or 2, wherein the K initial cluster centers are distributed along one or more straight lines in the color space.
11. The method of claim 10, wherein the plurality of straight lines are orthogonal lines.
12. The method according to claim 1 or 2, wherein the resulting k defined representative colors constitute a color palette.
13. A computer-executed method for determining paint colors, comprising determining a predetermined number of k representative colors from at least one digital color image according to any one of claims 1 to 12, and further comprising comparing each of the k representative colors with a standard paint color in a standard paint color library, and assigning a corresponding matching standard paint color in the standard paint color library to each representative color.
14. A system for determining a predetermined number of k representative colors from at least one digital color image, the system comprising: - A receiver for receiving at least one digital color image having p pixels, each pixel having a color value in an n-dimensional color space; - An initializer for initializing a predetermined number of K initial cluster centers independent of the received image, the cluster centers being distributed along multiple lines in a cubic RGB color space, the multiple lines intersecting at an intersection located at the center of the cubic RGB color space, where K>k; - An allocator that forms clusters by associating the color value of each pixel with its nearest cluster center; and after clustering, redetermining the cluster centers; - A reduction unit, used to reduce the number of clusters to k, wherein the reduction unit includes a pruning unit for deleting cluster centers and / or a merging unit for merging clusters. The trimming unit is arranged to delete cluster centers that have a number of associated pixels less than or equal to a predefined trimming threshold, and the merging unit is arranged to merge those clusters whose distance is less than a predefined merging threshold. - Definer, which is used to define the representative color for each of the resulting k clusters.