Re: Similarity between integers in a list
Re: Similarity between integers in a list
- Subject: Re: Similarity between integers in a list
- From: Michael Ziober <email@hidden>
- Date: Tue, 18 May 2004 22:29:16 -0700
Try a double-sum-of-differences-squared. This is fast, but will only be
as good as your selection of random pixels. Some colorful images may be
incorrectly identified as neutral.
I suspect that a better solution is to script Photoshop to cancel out
identical color channels in a way that would produce a histogram which
indicates the relative saturation of the source image. Neutral images
would be nearly all black, and overall pixel brightness would increase
in relation to how colorful the image was.
Michael
(* I just typed this up without testing. Sorry if needs debugging. *)
on sod2(data) -- sum of differences squared
set samples to count data
set mean to 0.0
repeat with value in data
set mean to mean + value
end
set mean to mean / samples
set variance to 0.0
repeat with value in data
set variance to variance + (value - mean) ^ 2
end
set variance to variance / samples
return variance
end
on run
set data to
{{71,94,97},{95,96,98},{60,68,73},{41,49,56},{21,23,36},{44,47,52}}
--set data to
{{89,89,89},{82,82,82},{77,77,77},{48,49,49},{48,49,50},{66,68,68}}
set temp to {}
repeat with pixel in data
set end of temp to sod2(pixel)
end
return sod2(temp) --higher values indicate more colorful data
end
On Wed, 19 May 2004 00:01:24 +0100, Martin Orpen
<email@hidden> wrote:
I'm working on a Photoshop script that tries to work out whether an RGB
image is colourful or neutral.
The script gets RGB values from 6 (or more) randomly chosen pixels in
the
form:
Image 1
{{71, 94, 97}, {95, 96, 98}, {60, 68, 73}, {41, 49, 56}, {21, 23, 36},
{44,
47, 52}}
Image 2
{{89, 89, 89}, {82, 82, 82}, {77, 77, 77}, {48, 49, 49}, {48, 49, 50},
{66,
68, 68}}
I'd like to process each list so that I can differentiate between the
images
- image 1 being a conventional colour image where the lists show
greater
variation and image 2 being neutral and the pixel values tend to be
nearly
equal.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.