skotz / cbl-js

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

problems with new captcha #15

Closed BillRizer closed 6 years ago

BillRizer commented 6 years ago

Hello, I'm trying to solve the captcha: https://image.ibb.co/ePUrBH/3.jpg

but I'm not getting it, it does not seem to identify all the characters

var cbl = new CBL({
            preprocess: function(img) {
                img.binarize(32);
                img.debugImage("debugPreprocessed");
            },
            character_set: "abcdefghijklmnopqrstuvwxyz0123456789",
            model_file: "cryptographp-model.txt",
            blob_min_pixels: 40,
            blob_max_pixels: 350,
            pattern_width: 24,
            pattern_height: 24,
            pattern_maintain_ratio: true,
            allow_console_log: true,
            perceptive_colorspace: true,
            blob_debug: "debugSegmented",
            model_loaded: function() {
                document.getElementById("aSolve").style.display = "inline-block";
            }
        });

cbl.train("image.jpg");

After using the filter apparently the captcha is well cleaned, what am I doing wrong? https://image.ibb.co/jztCJx/ccc.png 😄

skotz commented 6 years ago

The blob segmentation step creates a separate character for each distinct color in the image, so in the last step of preprocessing you need to give each character a different color with colorRegions(). Without that step it tries to create a single character out of everything black and then resize it to 24x24.

Another trick I use when dealing with CAPTCHAs with lines in them is to remove the lines (as you already did) then blur them to rejoin the sections of each letter back together, then re-binarize and colorize. It actually works quite well.

preprocess: function(img) {
    img.binarize(32);
    img.debugImage("debugPreprocessed");
    img.blur(1);
    img.debugImage("debugPreprocessed");
    img.binarize(255);
    img.debugImage("debugPreprocessed");
    img.colorRegions(40, true);
    img.debugImage("debugPreprocessed");
}

image

Hope that helps!

BillRizer commented 6 years ago

Hi, Thank you very much, it worked very well. your project is excellent, it helped me a lot.  You are a ninja.. ⚔️