color histogram?

Chipp Walters chipp at chipp.com
Fri Jul 8 18:57:02 EDT 2011


Hi Wilhelm,

Yes, I do remember your generous attributions and thank you for them--  but
your work went well beyond anything I had done and it has been a great
contribution to our community. Much thanks for that!

Also, thank-you for your fine assessment of the issue and when I have time,
I will try and implement exactly that. When done, I'll be sure and post an
example here as well as returning the compliment!

On Fri, Jul 8, 2011 at 5:24 PM, Wilhelm Sanke <sanke at hrz.uni-kassel.de>wrote:

> On Fri Jul 8, 2011, Jim Ault jimaultwins at yahoo.com wrote:
>
>
>  On Jul 7, 2011, at 11:08 PM, Chipp Walters wrote:
>>
>> > Hey guys, I'm building another education app for a state school
>> > system, and
>> > this time I'm creating a skinnable themed desktop, which kids can
>> > add their
>> > own wallpaper to. I'm wondering if anyone has a quick routine to
>> > calculate
>> > the 'main' colors of an image-- so I could automatically theme the
>> > button
>> > colors and some other objects.
>> >
>> > If not, I'll have to write my own. Thx.
>> >
>>
>>
>> You could take a look at Wilhem Sanke's ImageData Toolkit at
>>     http://www.sanke.org/**MetaMedia/Samples.htm<http://www.sanke.org/MetaMedia/Samples.htm>
>>
>> and here is a blast from the past you might appreciate Chipp
>>
>> http://runtime-revolution.**278305.n4.nabble.com/ANN-quot-**
>> Imagedata-Toolkit-2-quot-**released-td349536.html<http://runtime-revolution.278305.n4.nabble.com/ANN-quot-Imagedata-Toolkit-2-quot-released-td349536.html>
>>
>> Hope this helps.
>>
>> Jim Ault
>> Las Vegas
>>
>
> and
> Chipp Walters chipp at chipp.com answered:
>
>
>
>  Thanks Jim. That is a blast from the past. In fact, I'm pretty sure I
>> wrote
>> the first convolve matrix which Wilhelm used for his earlier work. I wrote
>> it to create blurred shadows for ButtonGaget and to help with some image
>> compositing.
>>
>> I suspect I'll have to write my own imagedata parser and do the necessary
>> math. It takes time... ;-(
>>
>
>
> Hello Chipp,
>
> You know that I have mentioned you as the author of the first convolve
> matrix fully scripted in Metacard/Revolution time and again at various
> places. For example, I refer to you in the script of button "scripted
> version" in my stack "Imagedata Toolkit Preview 3" <http://www.sanke.org/*
> *Software/**ImagedataToolkitPreview3.zip<http://www.sanke.org/Software/ImagedataToolkitPreview3.zip>>,
> and - as another example - I have given a detailed description of the
> transition steps from your original script to a speed-optimized version I
> use today (to which Mark Waddingham also contributed) even a few weeks ago
> in my post <""Blurred vision" of Rev Newsletter, Apr 21"> to this list on
> April 26, 2011.
>
> Concerning your question how to
>
>
> "calculate the 'main' colors of an image-- so I could automatically theme
> the  button colors and some other objects"
>
> with the help of a histogram
>
> I am not exactly sure what you intend to do, Are you looking for one or
> several "main colors" of an image to use with your buttons and other
> objects? And how to you intend to proceed from the various possible
> representations of a color histogram (for each of the RGB values, for the
> gray or even the hue values in HSV) to get one or several "main colors"?
>
> A general recipe to create histograms can be found in Wikipedia under items
>
>  "image histogram" and "color histogram". Maybe you could also use the free
> "Gimp" program and use the histogram data of an image from there?
>
> To write your own histogram tool should be relatively easy in principle:
>
> - Get the RGB values of each pixel of an image (or a selected area of an
> image).
> - count the number of occurences for each color of the RGB triple and for
> each value 0 to 255
> - show the accumulated numbers for each value category 0 to 255 in a chart.
>
> Thus you can get separate histograms for each of the three RGB colors or
> one for the gray values when you average the RGB values before.
>
> To find one single "main" color of an image, you could sum up all values
> for the three components R, G, and B separately and calculate the average
> for each component.
>
> Another approach would be to get the "hue" values of the image pixels using
> Scott Raney's RGBtoHSV function to be found in the Metacard "Color Chooser"
> and Livecode's "revcolorchooser" stacks (the latter of which is no longer
> actively used in the Livecode IDE, but has remained in the "Toolset"
> folder).
> Raney's function unfortunately is very slow when it comes to calculate all
> pixels of a medium-sized image, I prefer faster RGBtoHSL and HSLtoRGB
> functions that I have ported to Livecode from examples found in the net.
>
> I have so far not had a reason to use color histograms in my different
> image-processing stacks, but experimented with a number of other routines to
> set general parameters of images like "white balance", "mid balance", "black
> balance", "gamma correction", "dynamic range", "saturation", "set chroma",
> "brighten/darken", "contrast", "shift hues" etc. etc.-
>
> I take it that most of the things I mentioned in this context here are
> certainly not new to you, but if you could be a bit more specific about what
> you intend to achieve I could possibly also come up with an idea or two.
>
> Best regards,
>
> Wilhelm Sanke
>
>
>
>
> ______________________________**_________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode>
>



-- 
Chipp Walters
CEO, Shafer Walters Group, Inc.



More information about the use-livecode mailing list