skotz / cbl-js

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

Help with this #43

Open serviciosecwifi opened 4 years ago

serviciosecwifi commented 4 years ago

d

i use this config:

preprocess: function(img) {
img.opaque(); img.binarize(200); img.colorRegions(50, true); },
blob_min_pixels: 50, blob_max_pixels: 1000, pattern_width: 50, pattern_height: 50, pattern_maintain_ratio: true

skotz commented 4 years ago

So the original CAPTCHA image is just a single letter with no distortion? What problems are you running into?

serviciosecwifi commented 4 years ago

my problem is the image show o and not D when preprocess

skotz commented 4 years ago

I'd need to see more of your code and more examples images. Also it looks like you made some modifications since the opaque method doesn't exist in the base library.

serviciosecwifi commented 4 years ago

jj r j

here more image same problem, maybe some wrong in the config the preproccess

serviciosecwifi commented 4 years ago

you may test this images??

serviciosecwifi commented 4 years ago

the code is very simple, function breakCaptcha(imgId) { return new Promise(resolve => cbl.solve(imgId).done(resolve)); }

serviciosecwifi commented 4 years ago

doriginal

sorry this the original image

skotz commented 4 years ago

Did you train a model? The solve method won't do anything unless you've loaded a model. And I'm not sure what the opaque method in your code does, but it's probably unnecessary.

I only see small sections of your code, so I'm not sure where you problem might be. Here's an example of generally what you should be doing. You'll need to train on at least one example of every possible letter, both lower and upper case.

<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({
        preprocess: function(img) {
            img.debugImage("debugPreprocessed");
            img.binarize(100);
            img.debugImage("debugPreprocessed");
            img.colorRegions(50, true);
            img.debugImage("debugPreprocessed");
        },
        character_set: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
        pattern_width: 32,
        pattern_height: 32,
        pattern_maintain_ratio: true,
        allow_console_log: true,
        blob_console_debug: true,
        blob_debug: "debugSegmented"
    });

    cbl.train("D.png");

    var saveModel = function() {
        cbl.condenseModel();
        cbl.sortModel();
        cbl.visualizeModel("visualizeModel");
        cbl.saveModel();
    }
</script>
skotz commented 4 years ago

Also, make sure you have allow_console_log enabled to provide helpful debugging information to the console.

serviciosecwifi commented 4 years ago

traincbl