Re: find largest cluster?
- From: ImageAnalyst <imageanalyst@xxxxxxxxxxxxxx>
- Date: Thu, 10 Apr 2008 17:33:41 -0700 (PDT)
On Apr 10, 4:46 am, bugbear <bugbear@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
ImageAnalyst wrote:
On Apr 9, 6:35 am, bugbear <bugbear@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Given a list of RGB (or other triple) colours,
rgb0, rgb1... rgbN I would like to be able
to detect what the largest "common" colour.
I think this would need to be within a tolerance
(e.g. from a list of 10, 4 are identical
within +- 2 in each channel).
There are some obvious nested loop
algorithms, but they're very inefficient
(essentially form and calculate all permutations
of the list).
Is this a standard problem, or does
anyone have an ah-hah algorithm?
BugBear
-----------------------------------------------------------
BugBear:
Here's an eye opening experience for you:
Download ImageJ and install it - it's freeware from the NIH.
http://rsb.info.nih.gov/ij/
Then go here
http://rsb.info.nih.gov/ij/plugins/color-inspector.html
and install the 3D Color Inspector/Color Histogram.
This amazing gamut visualization program lets you visualize the color
gamut in several different color spaces. You read in your color
image
and it plots the gamut scatterplot in 3D and lets you interact with
it
in several ways, such as reorienting the axes. It's really amazing
how much you can learn when you see what colors you actually have in
your image displayed graphically in a 3D scatterplot. Plus it lets
you pick several color classifiers such as Median Cut, and Wu's color
quantization. You can even specify the number of colors you wish to
classify your gamut into.
You can tell the plot to plot each and every pixel in the scatterplot
with equal intensity (shows all colors that are there), or you can
tell it to plot more frequent colors brighter and less frequent colors
darker (gamut will fade away as you get farther away from more
frequent colors).
The selections like Median Cut, etc. basically do what you want to
do. They find clusters based on how frequent the color is and how
concentrated the clusters are. You can specify how many colors
(clusters) you want to chop up your gamut into. Once you've
visualized your gamut in 3D and can easily see your clusters, and
checked out several quantization schemes, you can look the algorithms
somewhere.
Seriously, do this (it's free, painless, and easy), and then let me
know how you like it. You'll be glad you did. It's really cool!
Best wishes,
ImageAnalyst
I've seen it - it's wonderful.
But it doesn't do the thing I want.
BugBear- Hide quoted text -
- Show quoted text -
Well then why not just do the brute force method of making a 3D
histogram. Make a 3D array with one axis being the Red value, one
axis being the green value and one axis being the blue value. Then
just go through your millions of short lists reading their R, G, and B
value and incrementing that cell in your 3D array. I.e.
for all lists:
for all entries in this one list
R = list(entry, 1)
G = list(entry, 2)
B = list(entry, 3)
hist3d(R,G,B) = hist3d(R,G,B) + 1
end
end
Then it's just a simple task to scan all 16.7 million entries in the
array to find the cell with the highest count. This will of course
find the mode color. This is rather straightforward and intuitive. I
imagine you must have thought of this already, so that leaves me
wondering "What's the catch?" Is your situation really as simple as
this?
I can't guess what your riddle is. I don't know why you'd have
millions of lists with just a handfull of colors in each list. Are
the lists really feature vectors and the colors are really parameters
instead of colors? Is it a multispectral issue? Is it related to
some kind of stitching/panorama-creation method?
Regards,
ImageAnalyst
.
- References:
- find largest cluster?
- From: bugbear
- Re: find largest cluster?
- From: ImageAnalyst
- Re: find largest cluster?
- From: bugbear
- find largest cluster?
- Prev by Date: Re: find largest cluster?
- Next by Date: Re: movement vector from video
- Previous by thread: Re: find largest cluster?
- Next by thread: CFP: IEEE CIS2008. Deadline 5 May 2008
- Index(es):
Relevant Pages
|