skotz / cbl-js

JavaScript CAPTCHA solving library
MIT License
155 stars 47 forks source link

Can't seem to solve this captcha #59

Closed nicolaspavlotsky closed 3 years ago

nicolaspavlotsky commented 3 years ago

Hi, I'm trying to solve this captchas:

0avp 7wmv 8hog 26j7 51fo 56t1

Without success. Here's my config:

preprocess: function(img){
  img.binarize(220);
  img.blur();
  img.binarize(110);
  img.colorRegions(100);
},
character_set: "abcdefghijklmnopqrstuvwxyz0123456789",
blob_min_pixels: 50,
blob_max_pixels: 400,
pattern_width: 25,
pattern_height: 25,
allow_console_log: true,
perceptive_colorspace: true,
skotz commented 3 years ago

Since all images appear to have exactly four characters that are always in the same locations, and since the background appears to be identical across all images, you could probably get away with just using fixed_blob_locations.

image

<div class="main">
    <div id="debugPreprocessed"></div>
    <div id="debugSegmented"></div>
    <div id="solution"></div>
    <div id="visualizeModel"></div>
</div>
<script>
    var cbl = new CBL({
        fixed_blob_locations: [
            { x1: 20, y1: 14, x2: 39, y2: 33 },
            { x1: 40, y1: 14, x2: 59, y2: 33 },
            { x1: 60, y1: 14, x2: 79, y2: 33 },
            { x1: 80, y1: 14, x2: 99, y2: 33 }
        ],
        character_set: "abcdefghijklmnopqrstuvwxyz0123456789",
        blob_min_pixels: 50,
        blob_max_pixels: 400,
        pattern_width: 20,
        pattern_height: 20,
        allow_console_log: true,
        perceptive_colorspace: true,
        exact_characters: 4,
        blob_console_debug: true,
        blob_debug: "debugSegmented"
    });

    cbl.train("0avp.jpg");
    cbl.train("7wmv.jpg");
    cbl.train("8hog.jpg");
    cbl.train("26j7.jpg");
    cbl.train("51fo.jpg");
    cbl.train("56t1.jpg");

    var saveModel = function() {
        cbl.condenseModel();
        cbl.sortModel();
        cbl.visualizeModel("visualizeModel");
        cbl.saveModel();
    }
</script>

The serialized model (created by calling saveModel() after training) is really clean. You'll just need to make sure you train on enough sample images to cover all the characters.

image

nicolaspavlotsky commented 3 years ago

Thanks!! You're a life saver!