Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you help resolve this #42

Open
diepthaiphu opened this issue Nov 17, 2019 · 1 comment
Open

Can you help resolve this #42

diepthaiphu opened this issue Nov 17, 2019 · 1 comment
Assignees
Labels

Comments

@diepthaiphu
Copy link

diepthaiphu commented Nov 17, 2019

Can you help resolve this
1
2
train
1

    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) {
            img.debugImage("debugPreprocessed");
            img.removeGray(10);
            img.debugImage("debugPreprocessed");
            img.blur();
            img.debugImage("debugPreprocessed");
            img.convolute([ [1, 0, 1],
                            [0, 1, 0],
                            [1, 0, 1] ], 1/3);
            img.debugImage("debugPreprocessed");
            img.blur();
            img.debugImage("debugPreprocessed");
            img.binarize(190);
            img.debugImage("debugPreprocessed");
            img.colorRegions(40, true);
            img.debugImage("debugPreprocessed");
        },
        character_set: "0123456789",
        blob_min_pixels: 50,
        blob_max_pixels: 500,
        pattern_width: 20,
        pattern_height: 20,
        allow_console_log: true,
        blob_debug: "debugSegmented"
    });
@skotz
Copy link
Owner

skotz commented Nov 17, 2019

First of all you need to increase the blob_max_pixels since those characters are pretty large. You may also want to switch to comparing colors in a perceptive colorspace with perceptive_colorspace and remove any image preprocessing that changes the colors to black before the colorRegions (this is because each character is a separate color, which makes it easier to segment later). I've also used a new command called removeLight, so you'll want to get the latest version of the library to use it.

var cbl = new CBL({
    preprocess: function(img) {
        img.debugImage("debugPreprocessed");
        img.removeLight(128);
        img.debugImage("debugPreprocessed");
        img.colorRegions(14, true);
        img.debugImage("debugPreprocessed");
    },
    character_set: "0123456789",
    exact_characters_width: 50,
    exact_characters_play: 2,
    exact_characters: 4,
    blob_min_pixels: 50,
    blob_max_pixels: 100000,
    blob_max_width: 50,
    pattern_width: 20,
    pattern_height: 20,
    allow_console_log: true,
    blob_console_debug: true,
    perceptive_colorspace: true,
    blob_debug: "debugSegmented"
});

cbl.train("3458.jpg");
cbl.train("4273.jpg");

Play around with that and see if it helps.

@skotz skotz self-assigned this Nov 17, 2019
@skotz skotz added the question label Nov 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants