Changeset 84
- Timestamp:
- 04.12.2006 13:05:09 (2 years ago)
- Files:
-
- trunk/devel/FuzzyOcr.pm (modified) (9 diffs)
- trunk/devel/FuzzyOcr/Config.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/devel/FuzzyOcr.pm
r82 r84 99 99 my ( $self, $conf, $pms ) = @_; 100 100 101 my $internal_score = 0; 101 102 my $current_score = $pms->get_score(); 102 103 my $score = $conf->{focr_autodisable_score} || 100; … … 334 335 if ( ($$pic{ctype} !~ /gif/i) and not $generic_ctype) { 335 336 wrong_ctype( "GIF", $$pic{ctype} ); 337 $internal_score += $conf->{'focr_wrongctype_score'}; 336 338 } 337 339 338 340 if ( $suffix and $suffix !~ /gif/i) { 339 341 wrong_extension( "GIF", $suffix); 342 $internal_score += $conf->{'focr_wrongext_score'}; 340 343 } 341 344 … … 406 409 infolog("Skipping corrupted interlaced image..."); 407 410 corrupt_img($conf->{focr_corrupt_unfixable_score}, $corrupt); 411 $internal_score += $conf->{focr_corrupt_unfixable_score}; 408 412 next; 409 413 } … … 411 415 infolog("Uncorrectable corruption detected, skipping non-interlaced image..."); 412 416 corrupt_img($conf->{focr_corrupt_unfixable_score}, $corrupt); 417 $internal_score += $conf->{focr_corrupt_unfixable_score}; 413 418 next; 414 419 } 415 420 infolog("Image is corrupt, but seems fixable, continuing..."); 416 421 corrupt_img($conf->{focr_corrupt_score}, $corrupt); 422 $internal_score += $conf->{focr_corrupt_score}; 417 423 } 418 424 … … 476 482 if ( ($$pic{ctype} !~ /(jpeg|jpg)/i) and not $generic_ctype) { 477 483 wrong_ctype( "JPEG", $$pic{ctype} ); 484 $internal_score += $conf->{'focr_wrongctype_score'}; 478 485 } 479 486 480 487 if ( $suffix and $suffix !~ /(jpeg|jpg|jfif)/i) { 481 488 wrong_extension( "JPEG", $suffix); 489 $internal_score += $conf->{'focr_wrongext_score'}; 482 490 } 483 491 … … 515 523 if ( ($$pic{ctype} !~ /png/i) and not $generic_ctype) { 516 524 wrong_ctype( "PNG", $$pic{ctype} ); 525 $internal_score += $conf->{'focr_wrongctype_score'}; 517 526 } 518 527 if ( $suffix and $suffix !~ /(png)/i) { 519 528 wrong_extension( "PNG", $suffix); 529 $internal_score += $conf->{'focr_wrongext_score'}; 520 530 } 521 531 foreach my $a (qw/pngtopnm/) { … … 553 563 if ( ($$pic{ctype} !~ /bmp/i) and not $generic_ctype) { 554 564 wrong_ctype( "BMP", $$pic{ctype} ); 565 $internal_score += $conf->{'focr_wrongctype_score'}; 555 566 } 556 567 if ( $suffix and $suffix !~ /(bmp)/i) { 557 568 wrong_extension( "BMP", $suffix); 569 $internal_score += $conf->{'focr_wrongext_score'}; 558 570 } 559 571 foreach my $a (qw/bmptopnm/) { … … 590 602 if ( ($$pic{ctype} !~ /tif/i) and not $generic_ctype) { 591 603 wrong_ctype( "TIFF", $$pic{ctype} ); 604 $internal_score += $conf->{'focr_wrongctype_score'}; 592 605 } 593 606 if ( $suffix and $suffix !~ /tif/i) { 594 607 wrong_extension( "TIFF", $suffix); 608 $internal_score += $conf->{'focr_wrongext_score'}; 595 609 } 596 610 … … 654 668 infolog("Image hashing disabled in configuration, skipping..."); 655 669 } 670 671 # Note: $current_score is here the score that the message had at the beginning 672 # and $score is the autodisable_score defined in the config 673 # $internal_score describes the score that the message got by FuzzyOcr so far. 674 if ($internal_score + $current_score > $score) { 675 my $total = $internal_score + $current_score; 676 infolog("OCR canceled, message got already more than $score points ($total) by other FuzzyOcr tests."); 677 return 0; 678 } 679 656 680 my @ocr_results = (); 657 681 my $scansets = get_scansets(); trunk/devel/FuzzyOcr/Config.pm
r82 r84 549 549 next unless $k =~ m/^focr_/; 550 550 next if $k =~ m/^focr_bin_/; 551 next if $k =~ m/^focr_mysql_pass/; 551 552 debuglog(" $k => ".$conf->{$k}); 552 553 }
