Open yassinevic opened 4 years ago
Yeah, lines can be difficult to remove... I'd recommend playing around with convolution filters after the binarize
step to see if you can filter away the horizontal lines. Maybe start with something like this.
img.convolute([ [-1, 4, -1],
[-1, 2, -1],
[-1, 4, -1] ], 1);
Other than that I'd probably have to extend the library with a method to specifically detect and remove horizontal lines.
I've added a new method to remove lines. It's experimental, so it might have some bugs, It's not perfect but it works decently.
var cbl = new CBL({
preprocess: function(img) {
img.debugImage("debugPreprocessed");
img.cropRelative(20, 2, 20, 2);
img.debugImage("debugPreprocessed");
img.removeLight(16);
img.debugImage("debugPreprocessed");
img.removeHorizontalLine(2);
img.debugImage("debugPreprocessed");
img.colorRegions(50, true, 0);
img.debugImage("debugPreprocessed");
},
character_set: "0123456789abcdefghijklmnopqrstuvwxyz",
exact_characters_width: 18,
exact_characters_play: 3,
exact_characters: 5,
blob_min_pixels: 50,
blob_max_pixels: 10000,
pattern_width: 30,
pattern_height: 30,
allow_console_log: true,
blob_console_debug: true,
perceptive_colorspace: true,
blob_debug: "debugSegmented"
});
Its a five number captcha. this is where I get so far. var cbl = new CBL({ preprocess: function(img) { img.debugImage("debugPreprocessed"); img.binarize(32); img.debugImage("debugPreprocessed"); img.cropRelative(28, 2, 60, 2); img.debugImage("debugPreprocessed"); img.colorRegions(50, true, 0); }, character_set: "0123456789abcdefghijklmnopqrstuvwxyz", exact_characters_width: 50, exact_characters_play: 2, exact_characters: 5, blob_min_pixels: 10, blob_max_pixels: 10000, pattern_width: 30, pattern_height: 30, allow_console_log: true, blob_console_debug: true, blob_debug: "debugSegmented" });
Tnx a lot