Can you give some more details? "my best bet is to find the more colorful as appose to a more homogeneous surrounding": I am not sure I get this question. Do you simply want to count how many different colors are used in an image? If yes, you can compute the histogram of each image and then count the non-zero histogram bins. Or you can extract a statistic out of the histogram, like the standard deviation, in order to have a measurement of the colors' variation.
I was thinking of dividing the image check the no. of colors in each segment and according to it erase data...
a sort of quad tree and then process
I am not sure I get your idea (erase what data?). And if you want simply to count the colors used in an image, what's wrong in using a color histogram and count the NON-ZERO histogram bins (or better the beans whose values are above a specific dynamic threshold???)
when I said erase data I meant sort of a filter to get only the part that interests me (colorful).
"And if you want simply to count the colors used in an image, what's wrong in using a color histogram and count the NON-ZERO histogram bins (or better the beans whose values are above a specific dynamic threshold???)"
Nothing. I just want to do it with a window over the image (blocks of matrix) rather than the entire image. devide to section, count colors and filter.
could be I'm just complicating things...
kinda new to this..
Given an input image like the one you attached, what is the sort of output you are looking for ?
- A processed image ?
- The number of colors in the image ?
- Something else ?
It's hard to try and help you find a solution without understanding what you want to achieve.
BTW, if you goal is just to count the number of different colors in the image, trying to seperate the image into blocks and such is way too complicated than the straight forward solution yiannakop suggested.
My final goal is to detect the colored ball (magenta with green & yellow) in a picture. to do this I got 30 pictures to get the data from and test on.
these are the 2 less complex. the pictures are taken from a variaty of distance, lighting conditions etc. and the ball is in a variety of backgrounds- bushes, desk, chairs, wastebin etc. etc.
my approach is to focus on the colorful area which interests me, then do an edge detection, hough etc. I need to detect JUST the colored ball- i.e. that it's a ball and the one I want.
since giving it a range of colors gives me a wide detection I want to focus on an area where there's a large variety of colors- regardless of which they are.
I tried the block process with an IF command (just for magenta and yellow) and couldn't really get it to work (something I wrote wrong I guess).
I am not interested in counting the no. of colors in an image, because the whole idea was to be able to "zoom" on an area in the image through the fact that it contains more colors than other sections of the image.
ok, so after a few filtering and detection I can find the ball, or actually I should say BALLS. and I've got them labeled (bwlabel).
in order to distinguish which is the colored I want to go to the original picture, converted to grayscale, and check what is the STD (which should be high if it's colorful).
I know std2 will give it for the whole picture, but how can I do that to my chosen area??
ok, so after a few filtering and detection I can find the ball, or actually I should say BALLS. and I've got them labeled (bwlabel).
in order to distinguish which is the colored I want to go to the original picture, converted to grayscale, and check what is the STD (which should be high if it's colorful).
I know std2 will give it for the whole picture, but how can I do that to my chosen area??
Ok, if i get it right bwlabel is a MxN matrix (MxN is also the image size) with binary values (1 specifies that it is a pixels of interest). First of all, if you haven't done it already, you should label your regions of interest separately. For example if you have 3 balls, bwlabel should contain 0 (for background pixels), 1 (for the first region), 2 (for the 2nd) etc.
Afterwards, in order to calculate the STD value of each region you should simply do the following in matlab:
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.