Method for evaluating color harmony
By incorporating the evaluation of color dispersion into the Moon-Spencer color harmony formula, the problem of existing technologies failing to fully reflect the color harmony of an image is solved, achieving a more scientific and accurate color evaluation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-04
- Publication Date
- 2026-04-07
AI Technical Summary
The existing Moon-Spencer color harmony formula is too simplistic when evaluating non-uniformly distributed and complex colors in images. It fails to fully consider the impact of color dispersion on harmony, resulting in unscientific and inaccurate evaluation results.
Based on the Moon-Spencer color harmony model, an evaluation dimension of color dispersion is added. By obtaining the color dispersion measure of the target image and adding it to the first color harmony, the final color harmony is obtained.
It improves the scientific rigor, accuracy, and applicability of color evaluation, enabling a more comprehensive reflection of the harmonious feel and aesthetic effect of colors in a picture.
Smart Images

Figure CN116597023B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and more specifically to a method for evaluating color harmony. Background Technology
[0002] Humans have been discussing color since ancient Greece. Newton's discovery of a color ring based on wavelength marked the beginning of modern color theory. Color harmony is an important factor in color aesthetics. The Matsuda color harmony model and the Moon-Spencer color harmony model are two of the most classic color harmony models to date. However, the Matsuda color harmony model does not consider saturation and brightness, only hue (hue is the appearance of a color, its primary characteristic, and the unit that distinguishes different colors; saturation refers to the vividness of a color, also known as purity; brightness is the eye's perception of the lightness or darkness of a light source and object's surface, mainly a visual experience determined by the intensity of light). The Moon-Spencer color harmony model overcomes this shortcoming. The Moon-Spencer color harmony model was proposed by Moon and Spencer in 1944.
[0003] In evaluating color harmony in visual images, the Moon-Spencer color harmony model formula is a usable method for quantitatively assessing color harmony. The Moon-Spencer color harmony formula is: M = O / C. Here, C represents the complexity of the color, O represents the orderliness of the color combination, and M represents aesthetics. This scheme can quantitatively evaluate the aesthetic value of any given finite color combination. However, for the mostly non-uniformly distributed and complex colors in modern visual images, the Moon-Spencer color harmony formula is clearly not perfect; it oversimplifies the calculation of harmony and has a certain degree of bias. Summary of the Invention
[0004] In view of this, the present invention provides a method for evaluating color harmony, which adds the evaluation dimension of color dispersion and improves the scientificity, accuracy and applicability of color evaluation.
[0005] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is: a method for evaluating color harmony, comprising:
[0006] S10: Obtain the first color harmony of the target image based on the Moon-Spencer color harmony model;
[0007] S20: Obtain the color dispersion measure of the target image;
[0008] S30: Add the first color harmony and color dispersion measurements to obtain the final color harmony of the target image.
[0009] Preferably, step S10 includes:
[0010] S110: Set the base color;
[0011] S120: At preset intervals, blur the target image based on its similarity and identity to obtain a color block image;
[0012] S130: Record the hue, brightness, and saturation of each color block in the color block diagram;
[0013] S140: Obtain the first color harmony of the target image according to the Moon-Spencer color harmony formula.
[0014] Preferably, step S20 includes:
[0015] S210: Obtain the sampling points of the target image and determine the color information of each sampling point;
[0016] S220: Divide the target image into different color blocks based on the color information of each sampling point;
[0017] S230: Connect color blocks of the same color scheme into closed shapes and obtain the perimeter of each closed shape;
[0018] S240: Obtain the total perimeter of the target image;
[0019] S250: Obtain the ratio between the average perimeter of different color blocks and the total perimeter of the target image to obtain the dispersion measure.
[0020] Preferably, in step S210, when the color of each sampling point is the same color, the color dispersion measure value is directly obtained as zero.
[0021] Preferably, the method for connecting color blocks of the same color family to form a closed shape includes:
[0022] S231: Divide color blocks of the same color family into multiple adjacent areas;
[0023] S232: Connect the collection points of the two nearest color block centers in adjacent areas;
[0024] S233: Connect the endpoints of line segments located within a region.
[0025] S234: If there are any remaining endpoints, connect the remaining endpoints to form a closed figure.
[0026] Preferably, in step S231, when each color system is divided into only one region, the color dispersion measure value is directly obtained as zero.
[0027] Preferably, in step S231, when each color system is divided into only two regions, the sampling points of the closest color blocks in the two regions are directly connected to form the shortest line, and then twice the length of the shortest line segment is taken as the perimeter of the closed shape of the color system.
[0028] Preferably, in step S220, a first distance is extended in four directions from the sampling point to form a rectangular area, thereby expanding the sampling point into a color block area.
[0029] Preferably, the first distance is half the distance between adjacent sampling points.
[0030] The embodiments of the present invention add an evaluation dimension of color dispersion, thereby improving the scientificity, accuracy, and applicability of color evaluation. Attached Figure Description
[0031] Figure 1 A schematic diagram of an image with concentrated color distribution is shown;
[0032] Figure 2 A schematic diagram of an image with dispersed color distribution is shown;
[0033] Figure 3 A schematic diagram of a specific target screen is shown;
[0034] Figure 4 The obtained Figure 3 The histogram of pixel distribution in the target image shown;
[0035] Figure 5 The obtained Figure 3 The color block diagram of the target image shown;
[0036] Figure 6 The obtained Figure 3 A schematic diagram showing the numbered color blocks of the target image;
[0037] Figure 7 A schematic diagram of hue classification is shown;
[0038] Figure 8 A schematic diagram of the saturation and name interval classification pairs is shown;
[0039] Figure 9 The correspondence between different regions and the coefficients of the order factor is shown;
[0040] Figure 10 A schematic diagram is shown showing the average division of the target image using grid lines;
[0041] Figure 11 This diagram illustrates how the target image is divided into different color blocks;
[0042] Figure 12 A schematic diagram showing the partitioning of blue color blocks is provided.
[0043] Figure 13 A schematic diagram of a closed shape formed by connecting blue color blocks is shown;
[0044] Figure 14 A schematic diagram of a closed shape formed by connecting red color blocks is shown;
[0045] Figure 15 A schematic diagram of a closed shape formed by connecting yellow-green color blocks is shown;
[0046] Figure 16 A schematic diagram of a closed shape formed by connecting orange-toned color blocks is shown;
[0047] Figure 17 A schematic diagram of a closed shape formed by connecting white blocks is shown;
[0048] Figure 18 This diagram illustrates that each sampling point is the same color.
[0049] Figure 19 This diagram illustrates the process of dividing color blocks of the same color family into multiple adjacent regions, with each color family being divided into only one region.
[0050] Figure 20 This diagram illustrates the process of dividing color blocks of the same color family into multiple adjacent regions, with each color family being divided into only two regions. Detailed Implementation
[0051] To better understand the present invention, the present invention will be further described below with reference to specific embodiments and accompanying drawings.
[0052] In the various images we use daily today, we can observe that the distribution of colors is random and diverse. This color distribution includes both the area of color and the degree of dispersion.
[0053] Figure 1 A schematic diagram of an image with concentrated color distribution is shown; such as Figure 1As shown, the color distribution is mainly divided into two concentrated colors: green on the ground and blue in the sky. Due to the concentrated distribution of colors, both colors occupy large areas and have a low degree of dispersion. In this case, the color harmony of the image is mainly reflected in the visually impactful aesthetic effect brought by the large areas of color. We can consider the two colors as two adjacent color blocks and directly use the Moon-Spencer color harmony formula to evaluate the harmony and obtain a relatively accurate harmony value.
[0054] Figure 2 A schematic diagram of an image with dispersed color distribution is shown; such as Figure 2 As shown, the red and lemon yellow colors are highly dispersed and cover relatively small areas. However, their presence plays a crucial role in the visual effect of the image. Several scattered patches of red make the image more vibrant and lively, while the lemon yellow serves as an accent color. The two colors, due to their dispersion, create a unique visual balance and harmony. Although the areas of red and lemon yellow are small, their dispersion significantly impacts the overall harmony of the image.
[0055] As we can see, different degrees of color dispersion in an image reflect varying levels of color richness, and also evoke different feelings of harmony and aesthetic appreciation. Therefore, the degree of color dispersion is an indispensable factor in evaluating color harmony. However, the Moon-Spencer color harmony formula does not consider the impact of color dispersion on color harmony. This invention addresses the limitations of existing Moon-Spencer color harmony model formulas by incorporating the evaluation dimension of color dispersion into the original evaluation method, thereby improving the objectivity and multidimensionality of the evaluation method.
[0056] A method for evaluating color harmony; including:
[0057] S10: Obtain the first color harmony of the target image based on the Moon-Spencer color harmony model;
[0058] S20: Obtain the color dispersion measure of the target image;
[0059] S30: Add the first color harmony and color dispersion measurements to obtain the final color harmony of the target image.
[0060] Figure 3 A schematic diagram of a specific target screen is shown below, which will be combined with... Figure 3 The target image shown illustrates the specific method for evaluating color harmony in this embodiment.
[0061] The color harmony evaluation method in this embodiment first obtains the first color harmony of the target image based on the Moon-Spencer color harmony model. The method for obtaining the first color harmony of the target image based on the Moon-Spencer color harmony model includes:
[0062] S110: Set the base color.
[0063] In this step, the color with the largest color proportion in the target image is defined as the base color. The standard for setting the base color is the color with the approximate largest color proportion in the target image. Since it is not possible to directly obtain the color with the largest proportion, we use an approximate method to set it.
[0064] In this embodiment, a histogram of pixel distribution in the target image is obtained. The histogram graphically represents the number of pixels at each brightness level in the target image, showing the distribution of pixels in the target image. The brightness level with the largest (or approximately largest) pixel proportion is selected and defined as the base color.
[0065] Figure 4 The obtained Figure 3 The histogram of pixel distribution of the target image shown is as follows: Figure 4 As shown, the histogram displays details in shadows (shown on the left side of the histogram), midtones (shown in the center), and highlights (shown on the right side). Histograms help users determine if an image has enough detail for proper correction. By obtaining... Figure 4 By analyzing the peak values of fat bodies in the image, we can determine the color level with the highest pixel proportion. We find that the color level of 10, a low-brightness color level, has the highest pixel proportion, reaching 185408. Color level is an index standard representing the intensity of image brightness; therefore, a color level of 10 represents the highest pixel proportion when R=10, G=10, B=10. When setting a reference color, we should select colors near R=10, G=10, B=10 to improve measurement accuracy. In a specific embodiment, the reference color is set to R=28, G=12, B=9, that is, the reference color has a hue (H) of 9, a saturation (S) of 68, and a brightness (B) of 11.
[0066] S120: At preset intervals, blur the target image based on its similarity and identity to obtain a color block image.
[0067] The preset intervals are, for example, preset hue, brightness, and saturation intervals. In a specific embodiment, the preset intervals are: hue interval: a hue difference of 36° or more on a 360° hue circle; saturation interval: a saturation difference of 10 or more; brightness interval: a brightness difference of 10 or more.
[0068] Figure 5 The obtained Figure 3 The color block diagram of the target image shown is as follows: Figure 5 As shown, Figure 3 The target image shown is blurred to form multiple color blocks.
[0069] S130: Records the hue, brightness, and saturation of each color block in the color block diagram.
[0070] In this step, each color block in the color block diagram is numbered, and the hue, brightness, and saturation of each color block are recorded in a table.
[0071] Figure 6 The obtained Figure 3 The diagram shown is a numbered representation of the color blocks of the target image; as shown below. Figure 6 As shown, Figure 3 The color block diagram of the target image shown includes 16 color blocks. Table 1 shows the hue, saturation, and color of each color block.
[0072] Table 1 Figure 3 The color block diagram of the target image shows the hue, brightness, and saturation of each color block.
[0073] serial number Hue Hue Saturation No.1 9 68 11 No.2 44 11 96 No. 3 348 70 99 No. 4 350 94 54 No. 5 0 66 76 No. 6 78 48 49 No. 7 226 72 11 No. 8 160 2 99 No. 9 1 77 55 No. 10 1 82 41 No. 11 30 8 93 No. 12 310 7 65 No. 13 19 90 84 No. 14 30 67 91 No. 15 7 46 58 No. 16 9 60 89
[0074] S140: Obtain the first color harmony of the target image according to the Moon-Spencer color harmony formula.
[0075] The Moon-Spencer color harmony formula is:
[0076] M = O / C
[0077] Where C represents color complexity, O represents the orderliness of color combinations, and M represents beauty.
[0078] Furthermore,
[0079] C = N + C1 + C2 + C3;
[0080] Where N is the number of colors, C1 is the number of combinations with hue differences, C2 is the number of combinations with brightness differences, and C3 is the number of combinations with saturation differences.
[0081] O = Oh + Ov + Oc
[0082] Among them, Oh is the hue order factor, Ov is the brightness order factor, and Oc is the saturation order factor.
[0083] like Figure 6As shown, the color block diagram contains 16 colors. There are 28 pairs of combinations with hue differences (two colors with hue differences are considered a pair), 67 pairs of combinations with brightness differences (two colors with brightness differences are considered a pair), and 52 pairs of combinations with saturation differences (two colors with saturation differences are considered a pair).
[0084] C=N+C1+C2+C3=16+28+67+52=147.
[0085] Figure 7 A schematic diagram of hue classification is shown. Figure 8 A schematic diagram of the saturation and name interval classification pairs is shown. Figure 9 The diagram illustrates the correspondence between different regions and the coefficients of the order factor. The color values in the Moon-Spencer color harmony formula are obtained by consulting the Moonsell color system. Currently, all image colors can be obtained using computer software through the CIE color system. The CIE 1976 standard color system, also known as the CIELAB color space, is a visually uniform color space introduced by the International Commission on Illumination (CIE) in 1976. It is derived from the CIE 1931 standard colorimetric system through a non-linear transformation. The CIELAB color space is represented by an H-dimensional coordinate system. (See attached diagram.) Figures 7 to 9 As shown. The CIELAB color space is independent of various color rendering devices and can be linked through corresponding conversion models (such as RGB, CMYK, etc.). Therefore, it is recommended by CIE as an intermediate connecting color space for color conversion and is currently the most important and commonly used color system in the field of computer image processing.
[0086] In this embodiment, the difference between the hue of the base color in the color block diagram and the hue of the colors in the color block diagram are calculated, and then the absolute value is taken. Figure 7 Find the corresponding section in the "Hue Interval Classification Chart" and... Figure 9 The values for the corresponding partitions in the table are taken, resulting in a total of 15 results. These 15 results are then summed. In this embodiment, the hue order factor Oh is 7.3. Similarly, the lightness order factor Ov is 50.5, and the saturation order factor Oc is 4.3.
[0087] Furthermore,
[0088] O=Oh+Ov+Oc=7.3+50.5+4.3=62.3;
[0089] M = O / C = 62.3 / 147 = 0.424.
[0090] Right now, Figure 3The target image shown has a color harmony score of only 0.424. According to Moon-Spencer's conclusions, a color harmony score greater than 0.5 is considered harmonious, and the higher the score, the more harmonious the colors. However, this image, resembling a classical oil painting, is aesthetically pleasing, and the actual color harmony perceived visually should be much higher than this value. Clearly, in images with high color dispersion, the Moon-Spencer color harmony model's formula has certain limitations.
[0091] This embodiment adds the evaluation dimension of color dispersion to the above, thereby improving the scientificity, accuracy, and applicability of color evaluation.
[0092] The following will continue to combine Figure 3 The method for obtaining the color dispersion measure value of the target image shown in this embodiment will be explained. The method for obtaining the color dispersion measure value of the target image includes:
[0093] S210: Obtain the sampling points of the target image and determine the color information of each sampling point.
[0094] Figure 10 This illustrates a diagram of dividing the target image into equal parts using grid lines; for example... Figure 1 As shown, in this embodiment, the target image is divided into equal parts using grid lines. The intersections of the grid lines are the sampling points of the target image, and the spacing between adjacent sampling points is, for example, L. Without affecting the integrity of the target image, the spacing L between adjacent sampling points can be set to an integer (e.g., centimeters) to facilitate the acquisition of color information. The color information of each sampling point includes, for example, the hue value (H), saturation value (S), and lightness value (B), but is not limited to these. In this embodiment, areas with a lightness value (B) less than 10 are set as black areas; areas with a saturation value (S) less than 20 and a lightness value (B) greater than 70 are set as white areas.
[0095] In one specific embodiment, the target image is divided into 15*10 sampling points using grid lines. The color information of each sampling point is shown in Table 2.
[0096] Table 2 Color information for each sampling point
[0097] B B B B B B B B B B B B B B B B B B B B B W 346 B B B B B B B B B B B W W 62 55 335 B B B B B B 1 0 1 B W 352 353 6 345 W W B B B B 3 3 4 2 W W 352 354 66 63 3 B B B B 3 3 3 3 46 3 249 248 4 47 3 28 B B B 357 4 74 2 10 352 244 248 30 31 243 243 240 B B 1 2 3 3 241 22 243 W 240 238 5 4 5 4 5 1 1 2 W W W W W W W W 4 4 5 5 1 1 1 W W W 3 W W W W 5 3 3 3
[0098] In the table above, B represents black, W represents white, and the numbers are hue values (H).
[0099] S220: Divide the target image into different color blocks based on the color information of each sampling point.
[0100] Furthermore, the hue value is between 0° and 360°. In this embodiment, each 30° is divided into one hue, that is, 12 hues are used in this embodiment. This is because the human eye has three types of photoreceptor cells—red, blue, and green—that sense the wavelengths of the three primary colors of light in optics. Then, the brain obtains the final color based on the intensity of light. When observing an object, we can identify it because the human eye can obtain the main hue of the object while ignoring the color variations between the same hue, thus obtaining the outline of the object. We also use this as a basis to divide similar color sampling points. Since the wavelengths of light emitted by such points are similar, the color judgments given to people are also similar.
[0101] Specifically, for example, sampling points with hue values (H) between 345° and 15° are considered to be red, and sampling points with hue values (H) between 345° and 15° are considered to be the same color; sampling points with hue values (H) between 15° and 45° are considered to be orange, and sampling points with hue values (H) between 15° and 45° belong to different color families than sampling points with hue values (H) between 345° and 15°.
[0102] Furthermore, the sampling points are expanded into color block regions. The principle for expanding these regions is that each color block contains only a single color scheme; otherwise, they are divided into different color block regions. In this embodiment, a first distance A is extended in four directions from the sampling point as the center, forming a rectangular region. This rectangular region is expanded to include the color scheme of the sampling point at its center, forming color blocks of the same color scheme centered on that sampling point. The extension distance A is half the distance L between adjacent sampling points to avoid color scheme stacking between adjacent sampling points, which would result in a non-single color scheme within each color block.
[0103] Following the above method, each collection point is expanded into a color block of the same color scheme centered on that collection point. Figure 11 The diagram illustrates how the target image is divided into different color blocks, such as... Figure 11 As shown, in this embodiment, for example, 15*10 color blocks are obtained.
[0104] S230: Connect color blocks of the same color scheme to form a closed shape and obtain the perimeter of each closed shape; obtain the perimeter of different color blocks respectively, and obtain the average value of the perimeter of different color blocks.
[0105] Methods for connecting color blocks of the same color family to form a closed shape include:
[0106] S231: Divide color blocks of the same color family into multiple adjacent areas;
[0107] S232: Connect the collection points of the two nearest color block centers in adjacent areas;
[0108] S233: Connect the endpoints of line segments located within a region.
[0109] S234: If there are any remaining endpoints, connect the remaining endpoints to form a closed figure.
[0110] The principle for dividing color blocks of the same color family into multiple adjacent areas is that there should be no non-color family color blocks within a color block; otherwise, they should be divided into different areas. Connecting these areas is to avoid situations where other colors appear in a certain area, making it difficult to connect them. Furthermore, black color blocks are removed.
[0111] The following explanation uses blue color blocks as an example. Figure 12 A schematic diagram showing the partitioning of blue color blocks is provided, as follows: Figure 12 As shown, blue color blocks are isolated to form sequentially adjacent first region S1, second region S2, third region S3, and fourth region S4. The first region S1 includes one blue color block, which is color block BLUE1; the second region S2 includes five blue color blocks, namely color blocks BLUE2, BLUE3, BLUE4, BLUE5, and BLUE6; the third region S3 includes two blue color blocks, namely color blocks BLUE7 and BLUE8; and the fourth region S4 includes three blue color blocks, namely color blocks BLUE9, BLUE10, and BLUE11.
[0112] Figure 13 The diagram illustrates a closed shape formed by connecting blue color blocks, as shown below. Figure 13As shown, in the adjacent first region S1 and second region S2, the closest color blocks are color block BLUE1 in the first region S1 and color block BLUE2 in the second region S2. Connecting the sampling points at the center of color block BLUE1 and the center of color block BLUE2 forms the first line segment A1. In the adjacent second region S2 and third region S3, the closest color blocks are color block BLUE6 in the second region S2 and color block BLUE7 in the third region S3. Connecting color blocks BLUE6 and BLUE7 forms the second line segment A2. In the adjacent third region S3 and fourth region S4, the closest color blocks are color block BLUE8 in the third region S3 and color block BLUE9 in the fourth region S4. Connecting the sampling points at the center of color block BLUE8 and color block BLUE9 forms the second line segment A2. Connect the collection points at the center of E9 to form the third line segment A3; then connect the two endpoints in the second region S2, that is, connect the collection points at the center of color block BLUE2 and the center of color block BLUE6 in the second region S2 to form the fourth line segment A4; connect the two endpoints in the third region S3, that is, connect the collection points at the center of color block BLUE7 and the center of color block BLUE8 in the third region S3 to form the fifth line segment A5; finally, connect the remaining endpoints of the first region S1 and the remaining endpoints of the fourth region S4, that is, connect the collection point at the center of color block BLUE1 in the first region S1 and the collection point at the center of color block BLUE11 in the fourth region S4 to form the sixth line segment A6, thus forming a closed figure.
[0113] Next, the lengths of the first line segment A1, the second line segment A2, the third line segment A3, the fourth line segment A4, the fifth line segment A5, and the sixth line segment A6 are added together in sequence to obtain the perimeter of the closed figure.
[0114] Similarly, we obtain a closed shape formed by connecting red, yellow-green, orange, and white color blocks, as shown in the example below. Figure 14 , Figure 15 , Figure 16 , Figure 17 As shown in the table. Next, the perimeter of the closed shape formed by connecting the color blocks of each color system is obtained, as shown in Table 3:
[0115] Table 3 shows the perimeter of the closed shape formed by connecting the color blocks of each color system.
[0116] Red series (345-15) 25.207 Blue series (195-225) 13.325 Yellow-green color scheme (45-75) 18.129 Orange tones (15-45) 12.723 White 18.399
[0117] Next, the arithmetic mean K of the perimeter of the closed figure formed by connecting all the color blocks of all color schemes is calculated.
[0118]
[0119] S240: Obtain the total perimeter of the target image;
[0120] The total perimeter of the target image is Cframe. In this embodiment, Cframe = 2 * (10 + 15) = 50, which is the perimeter.
[0121] S250: Obtain the ratio between the average perimeter of different color blocks and the total perimeter of the target image to obtain the dispersion measure.
[0122] Since K is a distance value with units, it will change proportionally after the image is scaled. To eliminate this effect, we use the method of dividing the K value by the perimeter of the image's outer border to obtain the final value Z.
[0123] Z = K / Cframe
[0124] S30: Add the first color harmony and color dispersion values to obtain the final color harmony of the final target image.
[0125] M=O / C+Z=62.3 / 147+0.351=0.775
[0126] Further, in step S210: acquiring sampling points of the target image, and determining the color information of each sampling point, when the color of each sampling point is the same color, such as... Figure 18 As shown; or in step S231: during the process of dividing color blocks of the same color system into multiple adjacent areas, when each color system is divided into only one area, such as Figure 19 As shown, the color dispersion measure value is directly 0.
[0127] Furthermore, in step S231: during the process of dividing color blocks of the same color system into multiple adjacent regions, when each color system is divided into only two regions, the two regions cannot be connected to form a closed shape. At this time, the sampling points of the color blocks closest to the two regions are directly connected to form the shortest connection line, and then twice the shortest line segment is taken as the perimeter of the closed shape of the color system. Figure 20 The diagram illustrates a color system divided into only two regions, as shown below. Figure 20 As shown, the blue color scheme is divided into two regions, namely region S01 and region S02. Region S01 and region S02 cannot be connected to form a closed shape. At this time, the sampling points of the closest color blocks in region S01 and region S02 are connected to form the shortest line segment L. The perimeter of the closed shape of the blue color scheme is 2L.
[0128] The embodiments of the present invention have been described in detail above, but the content described is only a preferred embodiment of the present invention and should not be considered as limiting the scope of the present invention. All equivalent changes and improvements made within the scope of the present invention should still fall within the scope of this patent.
Claims
1. A method for evaluating color harmony, comprising: S10: Obtain the first color harmony of the target image based on the Moon-Spencer color harmony model; S20: Obtain the color dispersion measure of the target image; S30: Add the first color harmony and color dispersion values to obtain the final color harmony of the target image; Step S20 includes: S210: Obtain the sampling points of the target image and determine the color information of each sampling point; S220: Divide the target image into different color blocks based on the color information of each sampling point; S230: Connect color blocks of the same color scheme into closed shapes and obtain the perimeter of each closed shape; S240: Obtain the total perimeter of the target image; S250: Obtain the ratio between the average perimeter of different color blocks and the total perimeter of the target image to obtain the dispersion measure.
2. The method according to claim 1, wherein: Step S10 includes: S110: Set the base color; S120: At preset intervals, blur the target image based on its similarity and identity to obtain a color block image; S130: Record the hue, brightness, and saturation of each color block in the color block diagram; S140: Obtain the first color harmony of the target image according to the Moon-Spencer color harmony formula.
3. The method according to claim 1, wherein: In step S210, when the color of each sampling point is the same color, the color dispersion measure value is directly zero.
4. The method according to claim 1, wherein: Methods for connecting color blocks of the same color family to form a closed shape include: S231: Divide color blocks of the same color family into multiple adjacent areas; S232: Connect the collection points of the two nearest color block centers in adjacent areas; S233: Connect the endpoints of line segments located within a region; S234: If there are any remaining endpoints, connect the remaining endpoints to form a closed figure.
5. The method according to claim 4, wherein: In step S231, when each color system is divided into only one region, the color dispersion measure value is directly obtained as zero.
6. The method according to claim 4, wherein: In step S231, when each color system is divided into only two regions, the sampling points of the closest color blocks in the two regions are directly connected to form the shortest connection line. Then, twice the length of the shortest connection line is taken as the perimeter of the closed shape of the color system.
7. The method according to claim 1, wherein: In step S220, a first distance is extended in four directions from the sampling point to form a rectangular area, thereby expanding the sampling point into a color block area.
8. The method according to claim 7, wherein: The first distance is half the distance between adjacent sampling points.
Citation Information
Patent Citations
Hand area segmentation method deeply integrating significance detection and prior knowledge
CN106529432A
Urban block building color harmony degree evaluation method and device
CN113610293A