• 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: BJ Terry <email@hidden>
  • Date: Tue, 18 May 2004 19:04:34 -0700

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)

BJ

On May 18, 2004, at 4:01 PM, Martin Orpen wrote:

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.

I need to get some sleep now, but if anybody has any ideas on how to crash
through these lists quickly I'd love to read about them in the morning :-)

Regards

--
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.


  • Follow-Ups:
    • Re: Similarity between integers in a list
      • From: Martin Orpen <email@hidden>
    • Re: Similarity between integers in a list
      • From: BJ Terry <email@hidden>
References: 
 >Similarity between integers in a list (From: Martin Orpen <email@hidden>)

  • Prev by Date: Re: problem to display Tibetan
  • Next by Date: Re: First Applescript
  • Previous by thread: Re: Similarity between integers in a list
  • Next by thread: Re: Similarity between integers in a list
  • Index(es):
    • Date
    • Thread