l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
October 7: Social gathering
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
Page last updated:
2007 Feb 22 09:57

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] count pixels
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] count pixels



On Thursday 22 February 2007 10:09, Wade Pinkston wrote:
> I put a webpage up with an example.
>
> http://bugs.osu.edu/wade
>
> As you can see its the same image but the first has no damage.  The
> second has damage.  So what I need it the percent difference.

$ convert red4.jpg -colors 16 red4.pnm
$ ppmhist red4.pnm
   r     g     b         lum     count
 ----- ----- -----      -----   -------
   253     0     1         76     32518
    82   114    73        100      3886
    73   104    55         89      2273
    58    84    42         71      1972
   111   144   107        130      1880
   231    35    39         94      1277
   101   135    87        119      1114
    71    91    50         80       705
   155   176   144        166       681
   104   130    60        114       537
    59    57    22         54       479
    53    80    31         66       467
   100   118    81        108       440
   189    77    67        109       327
   146   156   111        148       301
   136   154   131        146       295
$ convert red5.jpg -colors 16 red5.pnm
$ ppmhist red5.pnm
   r     g     b         lum     count
 ----- ----- -----      -----   -------
   253     0     1         76     33386
    82   114    73        100      3466
    74   104    55         89      1979
    58    83    42         71      1829
   111   144   107        130      1701
   227    34    36         92      1438
   101   135    87        119      1074
    74    90    50         81       800
   156   176   144        166       667
   104   130    60        114       503
    59    57    22         54       467
    53    79    30         66       446
   100   118    81        108       420
   183    75    61        106       384
   147   156   111        148       299
   136   153   131        145       293

Or to even more clearly cluster the pixels of different colors:
$ convert red5.jpg -colors 2 red5.pnm
$ ppmhist red5.pnm
   r     g     b         lum     count
 ----- ----- -----      -----   -------
   252     2     2         77     34627
    87   115    72        102     14525
$ convert red4.jpg -colors 2 red4.pnm
$ ppmhist red4.pnm
   r     g     b         lum     count
 ----- ----- -----      -----   -------
   252     2     2         77     33605
    87   115    72        102     15547

Now you can easlily compute the percentage difference

(15547.0-14525.0)/15547.0
=> 0.0657361548851869

Thanks to Henry House for suggesting ppmhist.

--Ken

-- 
Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu/~kbloom1/

Attachment: pgp00002.pgp
Description: PGP signature

_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech


LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.