Tag Info

New answers tagged

3

One approach could be to set the scaling of the colors yourself: (I slightly cleaned up the code a bit, so that we do not get confused by double-setting the options) Module[{R1, R2, x, \[CapitalDelta], eqs}, R1 = 15; R2 = 5; eqs = {-((R1 + R2 + R1 x - R2 x - R2 \[CapitalDelta] - R1 x \[CapitalDelta] + R2 x \[CapitalDelta])/(-2 + ...


10

For those without v9, here's another attempt based on FindClusters, but using a different colour space. The idea is to reduce the effect of overall brightness on the "distance" between colours, so that the clustering gives more weight to differences of hue and is less likely to pick out different shades of gray. newspace[{r_, g_, b_}] := {r - g, b - g, (r + ...


9

Try use DominantColors on particular selections instead of the whole. After import select regions you want to analyze and copy that (optionally) multiple selections as a list of images. (New in 9?) img = Import["http://oaadonline.oxfordlearnersdictionaries.com" <> "/media/oaad8/fullsize/f/fru/fruit/fruit_fruit.jpg"] Paste it and apply dominants ...


12

Another potentially useful command of this kind is the CommonestFilter which looks locally about each pixel and chooses the most common value to display. Setting the neighborhood large causes large regions of constant color. For example img = Import["http://i.imgur.com/Wd9lPRa.jpg"] CommonestFilter[img, n] where img is the image from the OPs question ...


7

Here's another take. Not that successful though. It might have educational value. i = Import@"http://i.imgur.com/Wd9lPRa.jpg"; Extract pixel values into a list of length 9k+. data = Flatten[ImageData[i], 1]; Dimensions@data {9603, 3} Show the pixels as 3D points with (x, y, z) for (R, G, B) components. Table[Graphics3D[todraw, Axes -> True, ...


8

You might also enjoy playing with ColorQuantize, which reduces the number of colors used in an image. Here's a BarChart of the results of quantization: colorquantized = SortBy[ Tally[ Flatten[ImageData[ColorQuantize[img, 12, Dithering -> False]], 1]], Last]; BarChart[colorquantized[[All, 2]], ChartStyle -> RGBColor /@ ...


14

This may be what you are looking for. img = Import["http://i.imgur.com/Wd9lPRa.jpg"] Now use DominantColors. Graphics[{#, Disk[]}] & /@ DominantColors[img, 4]


3

For concreteness, here's how one might do Plato's suggestion: Module[{a, mid, colorFun}, BlockRandom[SeedRandom[42]; (* for reproducibility *) a = RandomInteger[{0, 100}, 100]]; mid = Mean[a]; colorFun[z_] := If[z <= mid, Red, Blue]; ArrayPlot[{a}, ColorFunction -> colorFun, ColorFunctionScaling -> ...


1

I am using this as a colorfunction: colorFun[z_] := Blend[{Red, Darker@Green}, (z - 1)/mean]; and it's working more or less fine. Please, never mind the noise, but maybe it will be useful for somebody else. Also I am using, as suggested by PlatoManiac, ColorFunctionScaling->False. Thanks!


2

Would ColorData["HTML"] solve your problem? There are 140 colors in that list. ColorData["HTML", "ColorRules"] // Take[#, 5] & // Column AliceBlue->RGBColor[0.941176,0.972549,1.] AntiqueWhite->RGBColor[0.980392,0.921569,0.843137] Aqua->RGBColor[0,1.,1.] Aquamarine->RGBColor[0.498039,1.,0.831373] Azure->RGBColor[0.941176,1.,1.] ...



Top 50 recent answers are included