Open avinashsonee opened 5 years ago
You're pretty much there. I'd start with a cropRelative
to remove the border, and then make sure you don't merge the patterns before generating your model. The method used here for recognition isn't very good against rotation, but you can make it work if you supply enough sample data. Basically instead of one pattern to represent a given character you're saving multiple: one for each general rotation.
This seems to work well:
var cbl = new CBL({
preprocess: function(img) {
img.cropRelative(2, 2, 2, 2);
img.debugImage("debugPreprocessed");
img.binarize(120);
img.debugImage("debugPreprocessed");
img.blur();
img.debugImage("debugPreprocessed");
img.binarize(50);
img.debugImage("debugPreprocessed");
img.colorRegions(50, true, 1);
img.debugImage("debugPreprocessed");
},
character_set: "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
pattern_width: 25,
pattern_height: 25,
blob_min_pixels: 10,
blob_max_pixels: 250,
allow_console_log: true,
blob_console_debug: true,
perceptive_colorspace: true,
blob_debug: "debugSegmented"
});
cbl.train("6HYFHM.png");
cbl.train("76US7T.png");
cbl.train("D9QQ8U.png");
cbl.train("H6E7V2.png");
var saveModel = function() {
// cbl.condenseModel(); // don't do this since the letters vary in rotation
cbl.sortModel();
cbl.visualizeModel("visualizeModel");
cbl.saveModel();
}
Thanks Scott 👍 I tried with couple more training data but the results are not accurate yet. Will try with a more number of training set and hopefully that should solve the problem along with some more tweaking.
I tried with this