Problem using IPA package

From: Marijn Hofstra <hofstra.m_at_planet.nl>
Date: Sat, 05 Aug 2006 17:37:08 +0200
To: prima_at_prima.eu.org

Hello,

I have just installed Prima-1.20 and IPA-1.02 onto a fresh Debian sarge
machine. After installing the libx11-dev package and trying to 'perl
Makefile.PL', the build process alerted me that I had to install several
graphical libraries, so after searching using apt-cache I installed
libpng12-dev and libungif4-dev. The install script did not complain any
further, and compilation and installation went smoothly.

The actual problem is that if I execute the script below, I get the
following output:

/root/spamimages/works/test.png
479
IPA::Point::threshold: unsupported pixel type at ./imagespamtest.pl line 26.

It is pretty obvious that it does not like the image presented (a grayscale
png image), but I can't seem to find an image that _is_ accepted. I have fed
it both .gif and .png files (converted files and newly created files) to no
avail. The image itself seems to be fine as the width and height can be
extracted without problems.

The docs say that the threshold function takes a grayscale image, which as
far as I understand things am giving it. I copied the example directly from
http://www.prima.eu.org/IPA/IPA.html, but after a few hours of struggling I
am now banging my head against the wall over this one (being new to perl
doesn't exactly help either). Any help would be very much appreciated, all
I'd like to do is extract some information about the images for spam
detection purposes.

Best regards,

Marijn

---------------------

#!/usr/bin/perl -w

use Prima::noX11;
use Prima;
use IPA;
use IPA::Misc;
use IPA::Morphology;
use IPA::Point;

my $imagedir = "/root/spamimages/works";
opendir(DIR, $imagedir . "/.");
@files = readdir(DIR);
closedir(DIR);

foreach my $file (@files) {
    next if $file eq '.'; # skip over dot files
    next if $file eq '..'; # skip over dot files
    print $imagedir . "/" . "$file\n";
    my $image = Prima::Image-> load($imagedir . "/" . $file) or die "Error
loading:$@\n";
    $image-> set(
                 palette => 32,
                 type => im::bpp8,
                 );
    my $test = $image->width;
    print "$test\n";
    my $binary = IPA::Point::threshold( $image, minvalue => 128);
    my $newimage = IPA::Morphology::erode($image);
}
Received on Sat 05 Aug 2006 - 17:37:00 CEST

This archive was generated by hypermail 2.2.0 : Sat 19 Mar 2011 - 18:35:06 CET