Page 1 of 1

Check image for large fields of one* color

Posted: 2017-07-15T09:35:54-07:00
by holden
Hey all, I need to be able to check large numbers of images and flag them if they have large areas of a single color. Some specifics:
Be able to check that a percentage of the image is one color and flag it
Be able to define "one color" as a small range of colors, as it would seem that what looks like a solid field can actually contain a mix of varying pixel colors.

Thanks!

Re: Check image for large fields of one* color

Posted: 2017-07-15T10:35:57-07:00
by fmw42
Please always provide your IM version and platform, since syntax and scripting may differ.

I would suggest you just look at the histogram of your images to see the counts. Sort the histogram by counts so that the largest count is at the top.

Code: Select all

convert logo: -format "%c" histogram:info: | sed 's/^[ ]*//' | tr ":" " " | sort -r -n -k1,1

Code: Select all

256244  (255,255,255) #FFFFFF white
12466  ( 34, 62,146) #223E92 srgb(34,62,146)
7150  (  4,  7,  7) #040707 srgb(4,7,7)
2942  (255,  0,  0) #FF0000 red
2538  ( 33, 32, 95) #21205F srgb(33,32,95)
1603  (247,152,104) #F79868 srgb(247,152,104)
1468  (245,238, 54) #F5EE36 srgb(245,238,54)
804  ( 69, 70, 70) #454646 srgb(69,70,70)
560  (138,140,143) #8A8C8F srgb(138,140,143)
558  ( 38, 45,115) #262D73 srgb(38,45,115)
539  ( 34, 35, 99) #222363 srgb(34,35,99)
500  ( 36, 39,105) #242769 srgb(36,39,105)
422  ( 39, 48,119) #273077 srgb(39,48,119)
412  ( 38, 54,130) #263682 srgb(38,54,130)
405  ( 38, 56,134) #263886 srgb(38,56,134)
404  (189,190,193) #BDBEC1 srgb(189,190,193)
379  ( 37, 42,109) #252A6D srgb(37,42,109)
337  ( 36, 59,139) #243B8B srgb(36,59,139)
318  (237,237,238) #EDEDEE srgb(237,237,238)
315  (243,244,244) #F3F4F4 srgb(243,244,244)
309  (156,158,161) #9C9EA1 srgb(156,158,161)
305  (222,223,224) #DEDFE0 srgb(222,223,224)
284  (191,192,195) #BFC0C3 srgb(191,192,195)
270  ( 20, 23, 23) #141717 srgb(20,23,23)
239  (158,160,163) #9EA0A3 srgb(158,160,163)
229  (172,174,177) #ACAEB1 srgb(172,174,177)
228  ( 39, 50,124) #27327C srgb(39,50,124)
213  (206,207,208) #CECFD0 srgb(206,207,208)
210  (231,231,232) #E7E7E8 srgb(231,231,232)
206  (254,205,  8) #FECD08 srgb(254,205,8)
206  (237, 31, 36) #ED1F24 srgb(237,31,36)
199  ( 47, 73,140) #2F498C srgb(47,73,140)
193  ( 98,100,100) #626464 srgb(98,100,100)
187  (143,144,147) #8F9093 srgb(143,144,147)
182  (148,150,153) #949699 srgb(148,150,153)
180  (130,131,132) #828384 srgb(130,131,132)
179  (207,208,210) #CFD0D2 srgb(207,208,210)
176  ( 35, 38, 38) #232626 srgb(35,38,38)
175  (175,176,179) #AFB0B3 srgb(175,176,179)
174  (214,215,216) #D6D7D8 srgb(214,215,216)
173  (207,103, 51) #CF6733 srgb(207,103,51)
167  (167,169,172) #A7A9AC srgb(167,169,172)
163  ( 51, 54, 54) #333636 srgb(51,54,54)
159  (223,224,225) #DFE0E1 srgb(223,224,225)
152  (114,116,116) #727474 srgb(114,116,116)
147  (140,142,145) #8C8E91 srgb(140,142,145)
142  (255,191,191) #FFBFBF srgb(255,191,191)
142  ( 30, 55,129) #1E3781 srgb(30,55,129)
141  (227,124, 73) #E37C49 srgb(227,124,73)
139  (251,250,244) #FBFAF4 srgb(251,250,244)
136  (  6,  9, 14) #06090E srgb(6,9,14)
133  ( 83, 85, 85) #535555 srgb(83,85,85)
130  (255, 64, 64) #FF4040 srgb(255,64,64)
130  (203,203,205) #CBCBCD srgb(203,203,205)
130  ( 13, 20, 42) #0D142A srgb(13,20,42)
129  (239,240,240) #EFF0F0 srgb(239,240,240)
126  (181,182,185) #B5B6B9 srgb(181,182,185)
125  (255,239,239) #FFEFEF srgb(255,239,239)
120  (  9, 14, 25) #090E19 srgb(9,14,25)
119  (232,227, 60) #E8E33C srgb(232,227,60)
118  (255, 16, 16) #FF1010 srgb(255,16,16)
118  (205, 32, 39) #CD2027 srgb(205,32,39)
112  (193,194,195) #C1C2C3 srgb(193,194,195)
111  (  6, 10, 16) #060A10 srgb(6,10,16)
110  (100, 12, 13) #640C0D srgb(100,12,13)
109  (255,127,127) #FF7F7F srgb(255,127,127)
107  (255, 96, 96) #FF6060 srgb(255,96,96)
107  (239,239,240) #EFEFF0 srgb(239,239,240)
106  ( 20, 35, 77) #14234D srgb(20,35,77)
105  (255,223,223) #FFDFDF srgb(255,223,223)
104  (247,152,103) #F79867 srgb(247,152,103)
99  (161,163,164) #A1A3A4 srgb(161,163,164)
99  ( 74, 95,129) #4A5F81 srgb(74,95,129)
98  (215,216,217) #D7D8D9 srgb(215,216,217)
98  (199,200,202) #C7C8CA srgb(199,200,202)
98  ( 27, 48,111) #1B306F srgb(27,48,111)
98  ( 14, 26, 55) #0E1A37 srgb(14,26,55)
97  (164,166,169) #A4A6A9 srgb(164,166,169)
97  ( 11, 17, 34) #0B1122 srgb(11,17,34)
96  (250,201, 55) #FAC937 srgb(250,201,55)
95  (255, 32, 32) #FF2020 srgb(255,32,32)
95  (210,210,211) #D2D2D3 srgb(210,210,211)
93  (247,149,100) #F79564 srgb(247,149,100)
93  (197,198,201) #C5C6C9 srgb(197,198,201)
91  (245,228, 55) #F5E437 srgb(245,228,55)
90  (249,164, 55) #F9A437 srgb(249,164,55)
89  (208,103, 52) #D06734 srgb(208,103,52)
88  (255,159,159) #FF9F9F srgb(255,159,159)
88  ( 20, 11, 10) #140B0A srgb(20,11,10)
87  (249,185, 55) #F9B937 srgb(249,185,55)
87  (146,147,148) #929394 srgb(146,147,148)
86  ( 25, 45,103) #192D67 srgb(25,45,103)
85  (159,160,159) #9FA09F srgb(159,160,159)
85  ( 28, 52,120) #1C3478 srgb(28,52,120)
84  (255,207,207) #FFCFCF srgb(255,207,207)
84  (226,226,227) #E2E2E3 srgb(226,226,227)
84  ( 19, 23, 56) #131738 srgb(19,23,56)
83  ( 26, 27, 75) #1A1B4B srgb(26,27,75)
83  ( 19, 18, 12) #13120C srgb(19,18,12)
80  (177,179,180) #B1B3B4 srgb(177,179,180)
80  ( 53, 36, 24) #352418 srgb(53,36,24)
79  ( 30, 30, 86) #1E1E56 srgb(30,30,86)
78  (255, 48, 48) #FF3030 srgb(255,48,48)
77  (249,218, 55) #F9DA37 srgb(249,218,55)
77  (127,128,129) #7F8081 srgb(127,128,129)
76  (205,205, 71) #CDCD47 srgb(205,205,71)
76  (106,108,108) #6A6C6C srgb(106,108,108)
75  (170,171,173) #AAABAD srgb(170,171,173)
73  (219,220,221) #DBDCDD srgb(219,220,221)
73  ( 75, 75, 75) #4B4B4B srgb(75,75,75)
69  (113,128,112) #718070 srgb(113,128,112)
68  (  9, 13, 19) #090D13 srgb(9,13,19)
67  (209,105, 53) #D16935 srgb(209,105,53)
67  ( 71, 74, 74) #474A4A srgb(71,74,74)
67  ( 15, 17, 41) #0F1129 srgb(15,17,41)
63  (213,109, 57) #D56D39 srgb(213,109,57)
62  (255, 80, 80) #FF5050 srgb(255,80,80)
62  (186,187,189) #BABBBD srgb(186,187,189)
62  (186,116, 80) #BA7450 srgb(186,116,80)
61  (166,172, 89) #A6AC59 srgb(166,172,89)
61  ( 18, 30, 67) #121E43 srgb(18,30,67)
60  (247,212, 56) #F7D438 srgb(247,212,56)
59  (255,175,175) #FFAFAF srgb(255,175,175)
59  (140,150,100) #8C9664 srgb(140,150,100)
58  (232,143, 98) #E88F62 srgb(232,143,98)
58  ( 90, 91, 92) #5A5B5C srgb(90,91,92)
57  (219,216, 66) #DBD842 srgb(219,216,66)
57  ( 95, 61, 43) #5F3D2B srgb(95,61,43)
56  (245,145, 94) #F5915E srgb(245,145,94)
55  (255,143,143) #FF8F8F srgb(255,143,143)
55  (243,140, 89) #F38C59 srgb(243,140,89)
55  ( 10, 11, 11) #0A0B0B srgb(10,11,11)
54  (179,174, 41) #B3AE29 srgb(179,174,41)
54  (154,155,157) #9A9B9D srgb(154,155,157)
54  ( 65, 43, 31) #412B1F srgb(65,43,31)
53  (237,134, 83) #ED8653 srgb(237,134,83)
53  (126, 80, 56) #7E5038 srgb(126,80,56)
52  (217,113, 62) #D9713E srgb(217,113,62)
52  (156, 99, 68) #9C6344 srgb(156,99,68)
52  (152,151,151) #989797 srgb(152,151,151)
52  (150,152,155) #96989B srgb(150,152,155)
52  (144,144,143) #90908F srgb(144,144,143)
52  (141,115, 79) #8D734F srgb(141,115,79)
52  (134,136,137) #868889 srgb(134,136,137)
51  (255,112,112) #FF7070 srgb(255,112,112)
51  ( 87,105,122) #57697A srgb(87,105,122)
51  ( 81, 73, 85) #514955 srgb(81,73,85)
50  (192,194, 77) #C0C24D srgb(192,194,77)
50  (183,184,187) #B7B8BB srgb(183,184,187)
50  ( 51, 16, 13) #33100D srgb(51,16,13)
50  ( 35, 25, 19) #231913 srgb(35,25,19)
49  (230,224, 51) #E6E033 srgb(230,224,51)
49  (221,118, 67) #DD7643 srgb(221,118,67)
48  ( 25, 37, 87) #192557 srgb(25,37,87)
47  (201,125, 86) #C97D56 srgb(201,125,86)
47  (173,110, 72) #AD6E48 srgb(173,110,72)
47  (150,144, 35) #969023 srgb(150,144,35)
47  (121,123,123) #797B7B srgb(121,123,123)
46  (179,183, 83) #B3B753 srgb(179,183,83)
45  (213,137, 86) #D58956 srgb(213,137,86)
45  (125,123, 31) #7D7B1F srgb(125,123,31)
44  ( 87, 85, 87) #575557 srgb(87,85,87)
43  (254,219, 75) #FEDB4B srgb(254,219,75)
42  (254,208, 23) #FED017 srgb(254,208,23)
41  (141, 89, 62) #8D593E srgb(141,89,62)
41  ( 69, 69, 20) #454514 srgb(69,69,20)
41  ( 63, 65, 66) #3F4142 srgb(63,65,66)
40  (216,210, 50) #D8D232 srgb(216,210,50)
40  ( 49, 50, 17) #313211 srgb(49,50,17)
39  ( 93, 97,102) #5D6166 srgb(93,97,102)
38  (139,133, 98) #8B8562 srgb(139,133,98)
38  (113,118,106) #71766A srgb(113,118,106)
38  ( 41, 43, 43) #292B2B srgb(41,43,43)
37  (254,225,108) #FEE16C srgb(254,225,108)
37  (153,161, 94) #99A15E srgb(153,161,94)
37  (152, 26, 30) #981A1E srgb(152,26,30)
37  (103,116,116) #677474 srgb(103,116,116)
37  ( 46, 49, 50) #2E3132 srgb(46,49,50)
36  ( 23, 41, 94) #17295E srgb(23,41,94)
35  (209,143, 52) #D18F34 srgb(209,143,52)
35  (125,127,129) #7D7F81 srgb(125,127,129)
35  ( 94, 94, 25) #5E5E19 srgb(94,94,25)
35  ( 13, 17, 22) #0D1116 srgb(13,17,22)
34  (126,138,106) #7E8A6A srgb(126,138,106)
34  (110, 70, 49) #6E4631 srgb(110,70,49)
33  (254,231,137) #FEE789 srgb(254,231,137)
33  (197,176, 72) #C5B048 srgb(197,176,72)
33  ( 60, 84,135) #3C5487 srgb(60,84,135)
32  ( 60, 53, 90) #3C355A srgb(60,53,90)
32  ( 46, 42, 93) #2E2A5D srgb(46,42,93)
32  ( 34, 36, 17) #222411 srgb(34,36,17)
31  (255,246,209) #FFF6D1 srgb(255,246,209)
31  (255,239,178) #FFEFB2 srgb(255,239,178)
31  (121, 18, 20) #791214 srgb(121,18,20)
30  (232,177, 56) #E8B138 srgb(232,177,56)
30  (232,129, 78) #E8814E srgb(232,129,78)
30  (209,173, 58) #D1AD3A srgb(209,173,58)
30  ( 35, 42,101) #232A65 srgb(35,42,101)
29  (203,196, 48) #CBC430 srgb(203,196,48)
29  (174, 89, 46) #AE592E srgb(174,89,46)
28  (136, 22, 25) #881619 srgb(136,22,25)
28  (114,104, 84) #726854 srgb(114,104,84)
28  (103,105,103) #676967 srgb(103,105,103)
27  (175, 30, 35) #AF1E23 srgb(175,30,35)
27  (141, 76, 42) #8D4C2A srgb(141,76,42)
26  (174,140, 73) #AE8C49 srgb(174,140,73)
26  (109,108, 28) #6D6C1C srgb(109,108,28)
25  (147,141, 84) #938D54 srgb(147,141,84)
25  (109, 85, 81) #6D5551 srgb(109,85,81)
25  ( 81, 13, 14) #510D0E srgb(81,13,14)
25  ( 52, 56,109) #34386D srgb(52,56,109)
25  ( 24, 27, 27) #181B1B srgb(24,27,27)
24  ( 79, 82,108) #4F526C srgb(79,82,108)
24  ( 51, 50, 42) #33322A srgb(51,50,42)
23  (255,236,162) #FFECA2 srgb(255,236,162)
23  ( 81, 52, 37) #513425 srgb(81,52,37)
23  ( 30, 20, 13) #1E140D srgb(30,20,13)
22  (251,227, 49) #FBE331 srgb(251,227,49)
22  ( 72, 58, 88) #483A58 srgb(72,58,88)
21  (109, 16, 18) #6D1012 srgb(109,16,18)
21  ( 70, 41, 24) #462918 srgb(70,41,24)
21  ( 57, 59, 60) #393B3C srgb(57,59,60)
20  (241,210, 48) #F1D230 srgb(241,210,48)
19  (189, 32, 37) #BD2025 srgb(189,32,37)
19  (175, 25, 29) #AF191D srgb(175,25,29)
19  ( 30, 33, 33) #1E2121 srgb(30,33,33)
17  (167,169, 84) #A7A954 srgb(167,169,84)
17  (111, 58, 31) #6F3A1F srgb(111,58,31)
17  ( 78, 50, 23) #4E3217 srgb(78,50,23)
16  (196,100, 51) #C46433 srgb(196,100,51)
15  (151,106, 40) #976A28 srgb(151,106,40)
14  (255,249,224) #FFF9E0 srgb(255,249,224)
14  (203, 30, 36) #CB1E24 srgb(203,30,36)
14  ( 80, 68, 22) #504416 srgb(80,68,22)
13  (235,152, 55) #EB9837 srgb(235,152,55)
13  (176,170, 76) #B0AA4C srgb(176,170,76)
12  (104, 86, 99) #685663 srgb(104,86,99)
11  (211, 32, 39) #D32027 srgb(211,32,39)
11  (195, 32, 38) #C32026 srgb(195,32,38)
11  (179,109, 51) #B36D33 srgb(179,109,51)
11  (132, 91, 72) #845B48 srgb(132,91,72)
11  ( 51, 70,133) #334685 srgb(51,70,133)
9  (255,242,193) #FFF2C1 srgb(255,242,193)
9  (106, 81, 27) #6A511B srgb(106,81,27)
9  ( 55, 71,126) #37477E srgb(55,71,126)
8  (136, 90, 30) #885A1E srgb(136,90,30)
8  (119, 72, 42) #77482A srgb(119,72,42)
7  ( 76, 58, 54) #4C3A36 srgb(76,58,54)
6  (251,229, 47) #FBE52F srgb(251,229,47)
6  ( 38, 30, 34) #261E22 srgb(38,30,34)
5  (179,144, 43) #B3902B srgb(179,144,43)
4  (198,111, 68) #C66F44 srgb(198,111,68)
4  (110, 95, 42) #6E5F2A srgb(110,95,42)
3  ( 31, 49,114) #1F3172 srgb(31,49,114)
2  (219,200, 67) #DBC843 srgb(219,200,67)
2  (192,126, 50) #C07E32 srgb(192,126,50)

Re: Check image for large fields of one* color

Posted: 2017-07-15T13:19:42-07:00
by snibgo
The question is very vague. Sample images would help.

What is a "large area"? Is 3x3 large? How about 50x50?
holden wrote:... that what looks like a solid field can actually contain a mix of varying pixel colors.
How much variation is allowed while still considering this to be a "solid" colour?

This seems to be an image simplification problem, where some pixels and areas can be simplified to a single colour, and others can't. Blur, unique-colors and/or histograms and "-colors" and "-remap" are useful tools, and then "-connected-components" may help to define the areas.

Re: Check image for large fields of one* color

Posted: 2017-07-15T14:26:15-07:00
by fmw42
Simplifying colors may also be done with -mean-shift or my script, kmeans. -kuwahara can be used to reduce noise also. As user snibgo said, -connected-components with a -fuzz value specified can be used to simplify colors and find large regions. See http://magick.imagemagick.org/script/co ... onents.php