• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Similarity between integers in a list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Similarity between integers in a list


  • Subject: Re: Similarity between integers in a list
  • From: Martin Orpen <email@hidden>
  • Date: Wed, 19 May 2004 12:27:05 +0100

[originally sent to the OP instead of the list by mistake]

on 19/5/04 3:04 am, BJ Terry at email@hidden wrote:

> I don't know how well this works in the real world, or how fast you
> need to be able to do this, but I strongly suspect that Photoshop would
> be the limiting factor in terms of performance. This script just takes
> the average difference between all the pixels and compares them to a
> set threshold. Adjust it for sensitivity. I suspect that 2 is two low,
> since the total average difference in the first case was 27, and only
> 1.7 for the second set of points, but it depends, as always, on your
> source images. Additionally, something that humans would consider
> neutrally colored, like sepia, would probably not be accurately
> classified by this program, but I'm sure you're familiar with issues
> such as that, working with Photoshop and all. It's dirt simple though.
>
> property imageThreshold : 2
> set image1 to {{71, 94, 97}, {95, 96, 98}, {60, 68, 73}, {41, 49, 56},
> {21, 23, 36}, {44, 47, 52}}
> set image2 to {{89, 89, 89}, {82, 82, 82}, {77, 77, 77}, {48, 49, 49},
> {48, 49, 50}, {66, 68, 68}}
>
> on neutralp(pixelList)
> set totalDiff to 0
> repeat with x from 1 to count pixelList
> set currentPixel to item x of pixelList
> set diff to abs ((item 1 of currentPixel) - (item 2 of currentPixel))
> set diff to diff + (abs ((item 1 of currentPixel) - (item 3 of
> currentPixel)))
> set diff to diff + (abs ((item 2 of currentPixel) - (item 3 of
> currentPixel)))
> set totalDiff to totalDiff + diff
> end repeat
> return (totalDiff / (count pixelList)) < imageThreshold
> end neutralp
>
> neutralp(image1)

Thanks for that BJ - I was able to drop that straight in to my script and
have some fun testing the thresholds with a number of images.

A threshold of 2 is great if the client has sent images that have been
"neutralized" in PS. A threshold of 6 would differentiate between images
that had a colour bias, but are still good candidates for a different
separation method.

I've got the threshold set at 10 at the moment and don't seem to be getting
any false positives.

Cheers

--
Martin Orpen
Idea Digital Imaging Ltd -- The Image Specialists
http://www.idea-digital.com
_______________________________________________
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.


References: 
 >Re: Similarity between integers in a list (From: BJ Terry <email@hidden>)

  • Prev by Date: [OT] Print to PDF
  • Next by Date: Re: Similarity between integers in a list
  • Previous by thread: Re: Similarity between integers in a list
  • Next by thread: Re: Similarity between integers in a list
  • Index(es):
    • Date
    • Thread