Mathematica Asked by Atique Khan on April 18, 2021
I am looking for a way to find the number and name of certain colors present in the image so that I can use them to count for each pixel. I am doing it but actually some other colors or can say mixed colors are also present in the image which when I count are left in the counting and it counts less and as I increase the size of image pixels the uncounted number increase. I am giving the color ranges for the visible 13 colors in the image but their are some other colors present too which I am missing. How can I find them? Thanks in advance e for the help, I am stuck with the problem since long time. My image is
Starting point:
img = Import["https://i.stack.imgur.com/nmMA6.png"];
dclist = DominantColors[img];
cols = Select[CommonName[WolframLanguageData[
EntityClass["WolframLanguageSymbol",
"FunctionalityAreas" -> ContainsAll[{"ColorSymbols"}]]]],
ColorQ[ToExpression[#]] &];
nF = Nearest[ToExpression[#] -> # & /@ cols, DistanceFunction -> ColorDistance];
Thread[dclist -> Flatten[nF /@ dclist]]
(* {RGBColor[0.999777, 0.999802, 0.999843, 1.] -> "White",
RGBColor[0.294036, 0.000946, 0.505736, 1.] -> "Purple",
RGBColor[0.998994, 0.747725, 0.790496, 1.] -> "LightRed",
RGBColor[1., 0.542326, 0.001075, 1.] -> "Orange",
RGBColor[0.999675, 0.999639, 0.005823, 1.] -> "Yellow",
RGBColor[0.00686, 0.999793, 0.999577, 1.] -> "Cyan",
RGBColor[0.642197, 0.16287, 0.162788, 1.] -> "Pink",
RGBColor[0.001085, 0.501557, 0.000758, 1.] -> "Green",
RGBColor[1., 0.003463, 0.00196, 1.] -> "Red",
RGBColor[0.00411, 0.497326, 0.496575, 1.] -> "Gray",
RGBColor[0.044676, 0.998876, 0.033376, 1.] -> "Green",
RGBColor[0.999746, 0.006697, 0.999446, 1.] -> "Magenta",
RGBColor[0.000869, 0.000804, 0.999725, 1.] -> "Blue"} *)
Answered by boy jojo on April 18, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP