...making Linux just a little more fun!
Jimmy O'Regan [joregan at gmail.com]
Since I got commit access to Tesseract, I've been getting a little more interested in image recognition in general, and I was pleased to find a Java-based 'face annotation' system on Sourceforge: http://faint.sourceforge.net
The problem is, it doesn't support face detection on Linux, but it does have a relatively straightforward way of annotating the image using XMP tags. Perl to the rescue - there's a module called Image::ObjectDetect on CPAN... it's a pity the example in the POD is incorrect.
Here's a correct example that generates a simple HTML map (and nothing else
#!/usr/bin/perl use warnings; use strict; use Image::ObjectDetect; my $cascade = '/usr/share/opencv/haarcascades/haarcascade_frontalface_alt2.xml'; my $file = $ARGV[0]; my @faces = Image::ObjectDetect::detect_objects($cascade, $file); my $count=1; print "<map name='mymap'>\n"; for my $face (@faces) { print " <area shape='rect' alt='map$count' href='http://www.google.com' coords='"; print $face->{x}, ", "; print $face->{y}, ", "; print $face->{x}+$face->{width}, ", "; print $face->{y}+$face->{height}, "'/>\n"; } print "</map>\n"; print "<img src='$file' usemap='mymap'/>\n";
(to install Image::ObjectDetect, you first need OpenCV. On Debian, that's
apt-get install libcv-dev libcvaux-dev libhighgui-dev
cpan Image::ObjectDetect
and you're done
-- <Leftmost> jimregan, that's because deep inside you, you are evil. <Leftmost> Also not-so-deep inside you.
Jimmy O'Regan [joregan at gmail.com]
On 27 June 2010 18:46, Jimmy O'Regan <joregan at gmail.com> wrote:
> Since I got commit access to Tesseract, I've been getting a little > more interested in image recognition in general, and I was pleased to > find a Java-based 'face annotation' system on Sourceforge: > http://faint.sourceforge.net > > The problem is, it doesn't support face detection on Linux, but it > does have a relatively straightforward way of annotating the image > using XMP tags. Perl to the rescue - there's a module called > Image::ObjectDetect on CPAN... it's a pity the example in the POD is > incorrect. > > Here's a correct example that generates a simple HTML map (and nothing else > > #!/usr/bin/perl > > use warnings; > use strict; > > use Image::ObjectDetect; > > my $cascade = '/usr/share/opencv/haarcascades/haarcascade_frontalface_alt2.xml'; > my $file = $ARGV[0]; > my @faces = Image::ObjectDetect::detect_objects($cascade, $file); > my $count=1; > > print "<map name='mymap'>\n"; > for my $face (@faces) { > ? ?print " ?<area shape='rect' alt='map$count' > href='http://www.google.com' coords='"; > ? ?print $face->{x}, ", "; > ? ?print $face->{y}, ", "; > ? ?print $face->{x}+$face->{width}, ", "; > ? ?print $face->{y}+$face->{height}, "'/>\n";
Oops. Forgot the
$count++;
line here.
> } > print "</map>\n"; > > print "<img src='$file' usemap='mymap'/>\n"; > > (to install Image::ObjectDetect, you first need OpenCV. On Debian, that's > apt-get install libcv-dev libcvaux-dev libhighgui-dev > cpan Image::ObjectDetect > and you're done > > -- > <Leftmost> jimregan, that's because deep inside you, you are evil. > <Leftmost> Also not-so-deep inside you. >
-- <Leftmost> jimregan, that's because deep inside you, you are evil. <Leftmost> Also not-so-deep inside you.
Thomas Adam [thomas at xteddy.org]
On Sun, Jun 27, 2010 at 06:46:50PM +0100, Jimmy O'Regan wrote:
> Since I got commit access to Tesseract, I've been getting a little > more interested in image recognition in general, and I was pleased to > find a Java-based 'face annotation' system on Sourceforge:
I've done a lot of work on image transform domains, edge-detection, etc., from static images (steganography related), so if you have any questions, just ask.
-- Thomas Adam
-- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.)
Jimmy O'Regan [joregan at gmail.com]
On 27 June 2010 18:50, Thomas Adam <thomas at xteddy.org> wrote:
> On Sun, Jun 27, 2010 at 06:46:50PM +0100, Jimmy O'Regan wrote: >> Since I got commit access to Tesseract, I've been getting a little >> more interested in image recognition in general, and I was pleased to >> find a Java-based 'face annotation' system on Sourceforge: > > I've done a lot of work on image transform domains, edge-detection, etc., > from static images (steganography related), so if you have any questions, > just ask. >
Well, the part that interested me most about Tesseract was that it came complete with tools to train it for a new language (none of the other open source OCR systems do): the image processing parts are all pretty complete, I'm only really reading up on things as a bug takes me into a new area of the code. None of the bugs so far have been critical to me, so I'm having fun with it.
There's code for face detection in Faint, using OpenCV, that would only take a line or two of changes to work on Linux, but I don't have the diskspace to check it out at the moment (y'know, Java, 350 million .jar files in the SVN repository), so writing a quick script or two seemed like a good compromise to tide me over until I'm motivated to sprint clean my disk.
Thanks for the offer, though.
-- <Leftmost> jimregan, that's because deep inside you, you are evil. <Leftmost> Also not-so-deep inside you.