skotz / cbl-js

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

how to solve captcha with random positions. #28

Closed paulebe closed 5 years ago

paulebe commented 5 years ago

E.g 1. 1 2. 2 3. 3 4. 4 5. 5

paulebe commented 5 years ago

I solved...But it is not properly segmented... 101 100 103

skotz commented 5 years ago

It looks like the border is getting in the way. You could try using the crop command first to cut it off, but I think the easier way is to set blob_min_pixels to something small enough to filter out the large border blob while still allowing the letters through.

paulebe commented 5 years ago

@skotz could you provide me the solution code?

skotz commented 5 years ago

What's your current code look like?

paulebe commented 5 years ago

What's your current code look like?

      var cbl = new CBL({
preprocess: function(img) {

    img.debugImage("debugPreprocessed");
    img.convolute([ [1, 1, 0],
                    [1, 2, 1],
                    [0, 1, 0] ], 1/6);
    img.debugImage("debugPreprocessed");
    img.binarize(242);
    img.debugImage("debugPreprocessed");
},
       /* The set of characters that could potentially be in this CAPTCHA system. */
        character_set: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
        /* The minimum number of pixels required to call a grouping of similar pixels a blob. Use this to filter out small specks before segmentation. */
         pattern_width: 20,
        /* The height of the extracted blobs. All patterns are normalized to this height. */
        pattern_height: 20,
        /* 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). */

        /* The ID of the element to output all work-in-progress images of segmented characters from each image. */

    });
skotz commented 5 years ago

Try specifying the min and max blob sizes.

blob_min_pixels: 10,
blob_max_pixels: 150,

And adding a call to colorRegions as the last command in the preprocess section.

img.colorRegions(50);
paulebe commented 5 years ago

Try specifying the min and max blob sizes.

blob_min_pixels: 10,
blob_max_pixels: 150,

And adding a call to colorRegions as the last command in the preprocess section.

img.colorRegions(50);

It is not working in most cases..

skotz commented 5 years ago

I'd recommend that you continue to play around with the image manipulation methods. This one might be a bit tricky, but it looks doable.