[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to count % color coverage?

On 8/26/05, Paolo Pedaletti <paolo.pedaletti@unimib.it> wrote:
> ciao,
> may be someone here knows if exist a tool (imagemagick?) that can count
> how mutch black or white exist in a photo/image
> The problem is:
> I have a photo with spots with different size.
> I want to know how much this spost fill the photo surface (in %)
> and I want to do it via script (no human interaction, if possible)
> Do you know something usefull?
> Now I do it whit gimp, but I think is overkill for such things...
> thank you.
> (better were if I could count how much (%) of each color [.gif, indexed]
> is present in the photo, but I can resolve this in other way...)


Octave and octave-forge are your friends:

#! /usr/bin/octave -qf
# Print percentages of colours present in a 256-color image
# given as a command line argument

[x,n] = hist(imread(argv{1})(:), 256, 100);
disp([n', x']);


All the best,


Reply to: