Open serviciosecwifi opened 4 years ago
So the original CAPTCHA image is just a single letter with no distortion? What problems are you running into?
my problem is the image show o and not D when preprocess
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.
here more image same problem, maybe some wrong in the config the preproccess
you may test this images??
the code is very simple, function breakCaptcha(imgId) { return new Promise(resolve => cbl.solve(imgId).done(resolve)); }
sorry this the original image
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>
Also, make sure you have allow_console_log
enabled to provide helpful debugging information to the console.
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