New answers tagged histograms
0
Setting the Axes option to either False or None will work.
Show[Hist, Epilog -> First@Pl, PlotRange -> {{0, 5}, {0, 1.5}}, Frame -> True, Axes -> False]
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]
0
Alexey,
Histogram probability is based on Area and BinCounts, and not on BinCounts alone...
If you use Max[data] you'll get
1.5443
So the area of your histogram will be computed untill 1.5443. (Try yourself: compare Histogram[data, {{-2, 0, Max[data]}},"PDF"] and Histogram[data, {{-2, 0, Max[data]}}]).
If you use Length[data] you'll get
15
...
3
Using SeedRandom[1] you get 3 observations higher than 1. When you use Histogram[data,{{-2,0,1}}] you're excluding those 3 observations...
If you exclude those 3 observations, now your probability (i.e., "PDF") should be based on 12 observations, and not 15...
2
At Vitaliy's behest:
You want the distribution SmoothKernelDistribution[], which can be treated like any other distribution by feeding it into PDF[], CDF[]...
Here's a comparison for reference:
BlockRandom[SeedRandom[197, Method -> "MersenneTwister"]; (* for reproducibility *)
data = RandomVariate[BinormalDistribution[.75], 25]];
dist = ...
Top 50 recent answers are included

