Changeset 84

Show
Ignore:
Timestamp:
04.12.2006 13:05:09 (2 years ago)
Author:
decoder
Message:

Fixed: Mysql password no longer shown in debug output
Added: FuzzyOcr? now re-checks the score before doing OCR (i.e. if original score + score by other FuzzyOcr? tests > autodisable score, then skip OCR
as well)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/devel/FuzzyOcr.pm

    r82 r84  
    9999    my ( $self, $conf, $pms ) = @_; 
    100100 
     101    my $internal_score = 0; 
    101102    my $current_score = $pms->get_score(); 
    102103    my $score = $conf->{focr_autodisable_score} || 100; 
     
    334335            if ( ($$pic{ctype} !~ /gif/i) and not $generic_ctype) { 
    335336                wrong_ctype( "GIF", $$pic{ctype} ); 
     337                $internal_score += $conf->{'focr_wrongctype_score'}; 
    336338            } 
    337339 
    338340            if ( $suffix and $suffix !~ /gif/i) { 
    339341                wrong_extension( "GIF", $suffix); 
     342                $internal_score += $conf->{'focr_wrongext_score'}; 
    340343            } 
    341344 
     
    406409                    infolog("Skipping corrupted interlaced image..."); 
    407410                    corrupt_img($conf->{focr_corrupt_unfixable_score}, $corrupt); 
     411                    $internal_score += $conf->{focr_corrupt_unfixable_score}; 
    408412                    next; 
    409413                } 
     
    411415                    infolog("Uncorrectable corruption detected, skipping non-interlaced image..."); 
    412416                    corrupt_img($conf->{focr_corrupt_unfixable_score}, $corrupt); 
     417                    $internal_score += $conf->{focr_corrupt_unfixable_score}; 
    413418                    next; 
    414419                } 
    415420                infolog("Image is corrupt, but seems fixable, continuing..."); 
    416421                corrupt_img($conf->{focr_corrupt_score}, $corrupt); 
     422                $internal_score += $conf->{focr_corrupt_score}; 
    417423            } 
    418424 
     
    476482            if ( ($$pic{ctype} !~ /(jpeg|jpg)/i) and not $generic_ctype) { 
    477483                wrong_ctype( "JPEG", $$pic{ctype} ); 
     484                $internal_score += $conf->{'focr_wrongctype_score'}; 
    478485            } 
    479486 
    480487            if ( $suffix and $suffix !~ /(jpeg|jpg|jfif)/i) { 
    481488                wrong_extension( "JPEG", $suffix); 
     489                $internal_score += $conf->{'focr_wrongext_score'}; 
    482490            } 
    483491 
     
    515523            if ( ($$pic{ctype} !~ /png/i) and not $generic_ctype) { 
    516524                wrong_ctype( "PNG", $$pic{ctype} ); 
     525                $internal_score += $conf->{'focr_wrongctype_score'}; 
    517526            } 
    518527            if ( $suffix and $suffix !~ /(png)/i) { 
    519528                wrong_extension( "PNG", $suffix); 
     529                $internal_score += $conf->{'focr_wrongext_score'}; 
    520530            } 
    521531            foreach my $a (qw/pngtopnm/) { 
     
    553563            if ( ($$pic{ctype} !~ /bmp/i) and not $generic_ctype) { 
    554564                wrong_ctype( "BMP", $$pic{ctype} ); 
     565                $internal_score += $conf->{'focr_wrongctype_score'}; 
    555566            } 
    556567            if ( $suffix and $suffix !~ /(bmp)/i) { 
    557568                wrong_extension( "BMP", $suffix); 
     569                $internal_score += $conf->{'focr_wrongext_score'}; 
    558570            } 
    559571            foreach my $a (qw/bmptopnm/) { 
     
    590602            if ( ($$pic{ctype} !~ /tif/i) and not $generic_ctype) { 
    591603                wrong_ctype( "TIFF", $$pic{ctype} ); 
     604                $internal_score += $conf->{'focr_wrongctype_score'}; 
    592605            } 
    593606            if ( $suffix and $suffix !~ /tif/i) { 
    594607                wrong_extension( "TIFF", $suffix); 
     608                $internal_score += $conf->{'focr_wrongext_score'}; 
    595609            } 
    596610 
     
    654668            infolog("Image hashing disabled in configuration, skipping..."); 
    655669        } 
     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 
    656680        my @ocr_results = (); 
    657681        my $scansets = get_scansets(); 
  • trunk/devel/FuzzyOcr/Config.pm

    r82 r84  
    549549        next unless $k =~ m/^focr_/; 
    550550        next if $k =~ m/^focr_bin_/; 
     551        next if $k =~ m/^focr_mysql_pass/; 
    551552        debuglog(" $k => ".$conf->{$k}); 
    552553    }