You could then setup suspicious range ranges of colors, and do whatever.#!/usr/bin/perl use warnings; use strict; use Image::Magick; my $file = shift or die "Need a file $!\n"; my $img = Image::Magick->new; $img->ReadImage($file); # if you want a pixel by pixel list of every color # a huge slow output #$img->Set(magick => 'txt'); #$img->Write("$0.txt"); #histogram #returned values are an array of #red, green, blue, opacity, and count values. my $tot = 0; my (@colors) = $img->Histogram(); #print join "\n\n", @colors; while (1){ if (scalar @colors == 0){last} my $r = shift @colors; my $g = shift @colors; my $b = shift @colors; my $o = shift @colors; my $count = shift @colors; $tot++; my $rh = sprintf('%02X',$r); my $gh = sprintf('%02X',$g); my $bh = sprintf('%02X',$b); print "$count ($rh,$gh,$bh) at $o opacity\n"; } print "\n$tot total colors\n";
Also google for "ImageMagick flesh color detection" for many other ideas.
In reply to Re: analyze image for color
by zentara
in thread analyze image for color
by fionbarr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |