in reply to analyze image for color
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: analyze image for color
by fionbarr (Friar) on Feb 19, 2010 at 16:01 UTC |