skotz / cbl-js

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

Help for this kind of CAPTCHA #64

Open Mykael11 opened 3 years ago

Mykael11 commented 3 years ago

4c75c21a-cc70-40bd-b370-ec8a12fb3f3c ed571325-663b-4090-acb6-7c0cdfdc57ec 8ad9fbff-3051-4e7c-9797-04caf39b5dc6 60bd0797-0a88-4249-8927-fd1d9f0fc1e3 00abbb79-128c-4638-a243-1a3c43d8e22d Capture 3 1 2 4581d337-23b8-4caa-bc22-a5758c857b88

Please provide the full JavaScript source to what you've already tried:

var cbl = new CBL({
            /* Define a method that takes an input CAPTCHA and performs a set of image operations to remove noise. */
            preprocess: function(img) {
                // Each pixel lighter than the grayscale threshold of 220 is turned white and everything darker is turned black.
                img.binarize(220);

                // Output the work-in-progress image to an element with a specific ID so we can see the effect of our image operations.
                img.debugImage("debugPreprocessed");

                // Flood-fill every blob (a grouping of similarly colored pixels) with a unique color. 
                // This is an important last step of the segmentation phase since the segmenter will create a separate character
                // image for each unique color in the image. If all the characters are black then the segmenter will only find one character.
                img.colorRegions(10);

                // Once again output the image to a div or something so we see the effect of colorization.
                img.debugImage("debugPreprocessed");

                 img.removeHorizontalLine(1);
        img.debugImage("debugPreprocessed");

       /*
        img.cropRelative(20, 2, 20, 2);
        img.debugImage("debugPreprocessed");
        img.removeLight(16);
        img.debugImage("debugPreprocessed");

        img.colorRegions(50, true, 0);
        img.debugImage("debugPreprocessed");*/
            },
            /* The set of characters that could potentially be in this CAPTCHA system. */
            character_set: "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
            /* The minimum number of pixels required to call a grouping of similar pixels a blob. Use this to filter out small specks before segmentation. */
            blob_min_pixels: 50,
            /* The maximum number of pixels required to call a grouping of similar pixels a blob. */
            blob_max_pixels: 400,
            /* The width of the extracted blobs. All patterns are normalized to this width. */
            pattern_width: 25,
            /* The height of the extracted blobs. All patterns are normalized to this height. */
            pattern_height: 25,
            /* Enable advanced logging in the browser's console. */
            allow_console_log: true,
            /* Compare the differences between colors using algorithms based on how the human eye perceives color (instead of just an RGB comparison). */
            perceptive_colorspace: true,
            /* The ID of the element to output all work-in-progress images of segmented characters from each image. */
            blob_debug: "debugSegmented"
        });

        // Queue up a few images for training. This will run the preprocess and segmentation steps on each image and 
        // display a modal popup prompting you to classify each character.
        // Note that if your browser gives you a Cross Origin Request error in the console log it's because you're attempting to load an
        // image via the file:// protocol which is a security concern. You either need to set up a local server and use http:// or
        // find some way to disable that security setting during development (not recommended).
        cbl.train("../captchas/codeproject/1.PNG");
        cbl.train("../captchas/codeproject/2.PNG");
        //cbl.train("../captchas/codeproject/3.PNG");    

        var saveModel = function() {
            // Download the model after training!
            // Note that if your browser doesn't automatically prompt you to download the model file (for security reasons), you can
            // get the serialized model using clb.serializeModel() instead and manually saving it to a file.
              cbl.condenseModel();
    cbl.sortModel();
    cbl.visualizeModel("visualizeModel");
    cbl.saveModel();
            cbl.saveModel();
        }
skotz commented 3 years ago

This one will be difficult since it looks hard even for a human to get correct in most cases.

Mykael11 commented 3 years ago

ok thanks anyway :)