skotz / cbl-js Goto Github PK
View Code? Open in Web Editor NEWJavaScript CAPTCHA solving library
License: MIT License
JavaScript CAPTCHA solving library
License: MIT License
Chrome CORS stuff is preventing locally run copies of this library from loading images into a canvas.
Hi, I am trying to recognize this captcha. and came across a problem.
captcha :
When run train.html,
var cbl = new CBL({
preprocess: function(img) {
img.binarize(32);
img.debugImage("debugPreprocessed");
img.blur(1);
img.debugImage("debugPreprocessed");
img.binarize(255);
img.debugImage("debugPreprocessed");
img.colorRegions(40, true);
img.debugImage("debugPreprocessed");
},
character_set: "0123456789",
model_file: "model.txt",
blob_min_pixels: 40,
blob_max_pixels: 350,
pattern_width: 24,
pattern_height: 24,
pattern_maintain_ratio: true,
allow_console_log: true,
perceptive_colorspace: true,
blob_debug: "debugSegmented"
});
The result of 16 sample training is :
Then, update model.txt and solve.html file, it can't fully identify the captcha.
Target captcha:
Result:
var cbl = new CBL({
preprocess: function(img) {
img.binarize(100);
img.blur(1);
img.binarize(220);
img.colorRegions(40);
},
/* Load the model we saved during training. */
model_file: "model.txt",
character_set: "0123456789",
blob_min_pixels: 40,
blob_max_pixels: 350,
pattern_width: 24,
pattern_height: 24,
perceptive_colorspace: true,
/* Define a method that fires immediately after successfully loading a saved model. */
model_loaded: function() {
// Don't enable the solve button until the model is loaded.
document.getElementById('solve').style.display = "block";
}
});
Is it because of Not enough sample training or other else's ?Could you help me to fix it? Thanks!
I tried with this
var cbl = new CBL({
preprocess: function(img) {
img.binarize(150);
img.debugImage("debugPreprocessed");
img.blur();
img.debugImage("debugPreprocessed");
img.binarize(50);
img.debugImage("debugPreprocessed");
img.colorRegions(50,true, 1);
img.debugImage("debugPreprocessed");
},
/* The set of characters that could potentially be in this CAPTCHA system. */
character_set: "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
/* The minimum number of pixels required to call a grouping of similar pixels a blob. Use this to filter out small specks before segmentation. */
blob_min_pixels: 100,
/* The maximum number of pixels required to call a grouping of similar pixels a blob. */
blob_max_pixels: 400,
/* The width of the extracted blobs. All patterns are normalized to this width. */
pattern_width: 25,
/* The height of the extracted blobs. All patterns are normalized to this height. */
pattern_height: 25,
/* 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). */
perceptive_colorspace: true,
/* The ID of the element to output all work-in-progress images of segmented characters from each image. */
blob_debug: "debugSegmented"
});
hello, how can I generate the model of the hash to solve my captcha?
because of what I understand the .txt file has a hash that when loaded by the project understands * what each letter is. but my captcha is different and I need to train it and generate this new hash, but I do not know how to generate this hash
Add an option (much like loading an image) that can load a trained model from another file on the server.
hello,
I'm trying to adapt cbl.js to work on nodejs, but I'm having a problem.
cbl does a getElementById () to get the image, but I currently have this image saved in a /src directory and as I run with the nodejs I do not have the DOM (I can try to use a package for virtual DOM, but I think it can not be best choice).
any tips?
colorCompareMaxRGB is defined twice, right by each other - is there a reason for this?
When training is done and saveModel() is called, open a modal dialog with a textarea containing the encoded model. Optionally add a button to let the user compress the patterns first.
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"
});
cbl.train("./sss/0.png");
cbl.train("./sss/1.png");
cbl.train("./sss/2.png");
cbl.train("./sss/3.png");
cbl.train("./sss/4.png");
cbl.train("./sss/5.png");
cbl.train("./sss/6.png");
cbl.train("./sss/7.png");
cbl.train("./sss/8.png");
cbl.train("./sss/9.png");
Tnx a lot
Hi it's me again, thanks for your help last time. This time I have a kind of annoying captcha, I tried to do the decoding but still failed. This captcha is not the same as normal, it requires converting letters into numbers. Hope to receive your help!
Here are some examples of this captcha code type
Create a Chrome and/or FireFox plugin that can solve simple CAPTCHAs.
Right now there's no way to label a pattern as incorrect during training.
hello, i have a harder challange, how would i use the library to presegment and actually solve this single character captcha?
It is a single number from 1-9
I have a working method but i'd like to do with this method just for curiosity of how to get it working with javascript.
Those images are just a small portion of the big dataset as an example. How would i get rid of the trashy background ?
Thanks in the future
Hi, I tried to resolve this captcha but without success, I hope someone can help me.
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) {
// Each pixel lighter than the grayscale threshold of 220 is turned white and everything darker is turned black.
img.binarize(220);
// Output the work-in-progress image to an element with a specific ID so we can see the effect of our image operations.
img.debugImage("debugPreprocessed");
// Flood-fill every blob (a grouping of similarly colored pixels) with a unique color.
// This is an important last step of the segmentation phase since the segmenter will create a separate character
// image for each unique color in the image. If all the characters are black then the segmenter will only find one character.
img.colorRegions(1, true);
// Once again output the image to a div or something so we see the effect of colorization.
img.debugImage("debugPreprocessed");
},
/* The set of characters that could potentially be in this CAPTCHA system. */
character_set: "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz",
/* The minimum number of pixels required to call a grouping of similar pixels a blob. Use this to filter out small specks before segmentation. */
blob_min_pixels: 140,
/* The maximum number of pixels required to call a grouping of similar pixels a blob. */
blob_max_pixels: 700,
/* The width of the extracted blobs. All patterns are normalized to this width. */
pattern_width: 25,
/* The height of the extracted blobs. All patterns are normalized to this height. */
pattern_height: 25,
/* 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). */
perceptive_colorspace: true,
/* The ID of the element to output all work-in-progress images of segmented characters from each image. */
blob_debug: "debugSegmented"
});
Hello, I'm trying to solve the captcha:
https://image.ibb.co/ePUrBH/3.jpg
but I'm not getting it, it does not seem to identify all the characters
var cbl = new CBL({
preprocess: function(img) {
img.binarize(32);
img.debugImage("debugPreprocessed");
},
character_set: "abcdefghijklmnopqrstuvwxyz0123456789",
model_file: "cryptographp-model.txt",
blob_min_pixels: 40,
blob_max_pixels: 350,
pattern_width: 24,
pattern_height: 24,
pattern_maintain_ratio: true,
allow_console_log: true,
perceptive_colorspace: true,
blob_debug: "debugSegmented",
model_loaded: function() {
document.getElementById("aSolve").style.display = "inline-block";
}
});
cbl.train("image.jpg");
After using the filter apparently the captcha is well cleaned, what am I doing wrong?
https://image.ibb.co/jztCJx/ccc.png
๐
I am currently trying to decode this type of SVG image captcha (https://www.npmjs.com/package/svg-captcha). I tried to configure but still could not filter out the characters, they only set about 60%, some of them were blurred. Hope to receive your help
Hey. I'm trying to fiddle around with your captcha solver.
I tried to add this image for the program to solve:
without any luck. Do i need to strip down each character and store it as a master image, or how do i go about doing this?
Can you please help to solve this kind of Captcha it is 6 numbers with line (Thank you so much for your examples and your efforts)
I just modified the index in the elvincth example as follow :
var cbl = new CBL({
preprocess: function(img) {
img.debugImage("debugPreprocessed");
img.binarize(168);
img.debugImage("debugPreprocessed");
img.convolute([ [1, 0, 1],
[0, 1, 0],
[1, 0, 1] ], 0.44);
img.debugImage("debugPreprocessed");
img.blur();
img.debugImage("debugPreprocessed");
img.binarize(75);
img.debugImage("debugPreprocessed");
img.colorRegions(40, true);
img.debugImage("debugPreprocessed");
},
character_set: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
blob_min_pixels: 20,
blob_max_pixels: 800,
pattern_width: 40,
pattern_height: 30,
allow_console_log: true,
blob_debug: "debugSegmented"
});
I got this
after
please help with this - thank you
Hey,
Is this project still alive? If yes how this is supposed to be used?
I'm trying to solve this captcha but these circles are disturbing, have any tips?
https://ibb.co/nz7QQx
https://ibb.co/kvuiCc
https://ibb.co/h7g8dH
I have a lot of trouble in executing cbl.js on server side. any help???
Hallo, I tried to implement cbl-js for the following images:
I implemented the code below:
var cbl = new CBL(
{
preprocess: function(img)
{
img.binarize(190);
img.blur();
img.binarize(32);
img.colorRegions(50,true,0);
},
character_set: "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
blob_min_pixels: 50,
blob_max_pixels: 400,
pattern_width: 25,
pattern_height: 25,
perceptive_colorspace: true,
});
Any idea how to improve it?
Right now colors are compared in the RGB colorspace. Segmentation based on color works best when using a perceptive (as perceived by the human eye) colorspace.
The exact_characters
setting will split in half but not into thirds, so this:
Splits awkwardly down the middle of the 8:
The split characters need to be cropped to the resulting character boundaries, not keep the boundaries of the pre-split image. For example:
The p
needs some space cropped off the top after the split, and the 4
needs some space cropped off the bottom.
See #32
Basically just average all images in a group into a single pattern.
Use some form of ZIP compression or at least convert values to hex and eliminate commas.
Can you help resolve this
train
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"
});
D
Use the download attribute to specify the file name when downloading serialized models.
I'm trying to train this thing to solve an easy captcha, but getting stuck a little. If the captcha has two characters that are touching then there's no combination I can try to get it to pick up both characters.
Do you know how this could be done? Maybe I'm missing a setting that should be changed? Some examples are attached.
The first one won't recognize the 5 and a, second one won't recognize the m and the d, and third one won't recognize the p or the 4.
Hello! I'm trying to solve following Captcha.
I found out, that following settings are the best, but may be you have any suggestion how to improve the result?
img.convolute([[0, -1, 0], [-1, 4.9, -1], [0, -1, 0]]);
img.debugImage("debugPreprocessed");
img.binarize(120);
img.debugImage("debugPreprocessed");
img.blur(1);
img.debugImage("debugPreprocessed");
img.binarize(120);
img.debugImage("debugPreprocessed");
img.colorRegions(50);
img.debugImage("debugPreprocessed");
Thanks for this library! :D
Is there a way I can just have this solve a captcha from the downloaded image instead of through an img element? I'm doing some cross domain stuff, and I want to avoid opening an iframe as it slows things down.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.