Changeset 13
- Timestamp:
- 25.10.2006 20:05:23 (2 years ago)
- Files:
-
- trunk/devel/FuzzyOcr.pm (modified) (6 diffs)
- trunk/devel/INSTALL (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/devel/FuzzyOcr.pm
r12 r13 15 15 16 16 use String::Approx 'adistr'; 17 use Image::Magick;17 #use Image::Magick; 18 18 use MLDBM qw(DB_File Storable); 19 19 use FileHandle; … … 32 32 33 33 our @bin_utils = qw/gifsicle giffix giftext gifinter giftopnm 34 jpegtopnm pngtopnm bmptopnm tifftopnm ppmhist gocr ocrad/;34 jpegtopnm pngtopnm bmptopnm tifftopnm ppmhist pamfile gocr ocrad/; 35 35 36 36 our @pgm_scores = qw/base add corrupt corrupt_unfixable wrongctype … … 379 379 380 380 my $retcode = $t->run_and_catch(sub { 381 @stdout_data = qx($App{gifsicle} --info $giffile);381 @stdout_data = qx($App{gifsicle} --info $giffile); 382 382 }); 383 383 … … 575 575 my ($rcode, $hash); 576 576 577 foreach my $a (qw/p pmhist/) {577 foreach my $a (qw/pamfile ppmhist/) { 578 578 unless (defined $App{$a}) { 579 579 info("FuzzyOcr: calc_image_hash cannot exec $a"); … … 586 586 return(1,''); 587 587 } 588 my $img = new Image::Magick; 588 589 my @stdout_data; 589 590 my ($w,$h,$s,$t) = (0,0,0,0); 590 ($w,$h,$s,$t) = $img->ping($pfile);591 592 591 $t = Mail::SpamAssassin::Timeout->new({ secs => $Option{timeout} }); 593 my @stdout_data; 592 $rcode = $t->run_and_catch(sub { 593 @stdout_data = qx($App{pamfile} $pfile 2>/dev/null); 594 }); 595 if ($rcode) { 596 chomp $rcode; 597 debuglog("$App{pamfile}: Timed out [$rcode], skipping..."); 598 return (1, ''); 599 } 600 if ($stdout_data[0] =~ m/(\d+) by (\d+)/) { 601 $w = $1; $h = $2; 602 $s = (stat($pfile))[7]; 603 } 604 594 605 $rcode = $t->run_and_catch(sub { 595 606 @stdout_data = qx($App{ppmhist} -noheader $pfile 2>/dev/null); … … 1033 1044 } 1034 1045 1035 printf RAWERR qq(## $App{tifftopnm} $file >$pfile 2>>$efile\n) if ($haserr>0);1046 printf RAWERR qq(## $App{tifftopnm} $file >$pfile 2>>$efile\n) if ($haserr>0); 1036 1047 $retcode = $t->run_and_catch(sub { 1037 1048 qx($App{tifftopnm} $file >$pfile 2>>$efile); trunk/devel/INSTALL
r11 r13 9 9 gifsicle: 10 10 http://www.lcdf.org/gifsicle/gifsicle-1.44.tar.gz (latest) 11 12 ImageMagic:13 http://www.imagemagick.org/script/binary-releases.php14 ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz15 16 PerlMagic:17 http://www.imagemagick.org/script/download.php18 11 19 12 gocr: (v0.40) suggested ... needs to be patched!
