Closed lvlashnin closed 3 years ago
You'll need to crop the image so that the horizontal line touches the leftmost side of the image. See an example here.
Sorry, but it isn't works :(
You'll need more examples to build any usable model. From one image I can't tell how distortion, font, location, rotation, character count, noise, and so on changes from one image to another.
Thanks for your time!
Thanks. Since there's no variation between images at all, this one will be easy to get 100% accuracy on. The digits and lines are in the exact same location in every image, meaning you can simply specify the exact location of every digit and not worry about removing the lines.
You'll want to make sure you pick your training samples very carefully so that you get at least one of each digit in each of the four locations (i.e., one image each for 0-9 as the first digit, an image each for 0-9 as the second digit, and so on so that you train on every possible pattern). Once you create your model, don't condense it so that you maintain the exact patters from the original.
var cbl = new CBL({
preprocess: function(img) {
img.binarize(200);
},
fixed_blob_locations: [
{ x1: 38, y1: 9, x2: 38 + 27, y2: 9 + 37 },
{ x1: 69, y1: 19, x2: 70 + 25, y2: 19 + 37 },
{ x1: 97, y1: 12, x2: 97 + 25, y2: 12 + 40 },
{ x1: 123, y1: 9, x2: 123 + 28, y2: 9 + 37 }
],
character_set: "0123456789",
exact_characters: 4,
pattern_width: 24,
pattern_height: 24,
allow_console_log: true,
blob_console_debug: true,
perceptive_colorspace: true,
blob_debug: "debugSegmented"
});
cbl.train("3059.jpg");
cbl.train("6204.jpg");
cbl.train("7945.jpg");
cbl.train("8064.jpg");
cbl.train("8677.jpg");
cbl.train("9609.jpg");
cbl.train("9993.jpg");
var saveModel = function() {
cbl.sortModel();
cbl.visualizeModel("visualizeModel");
cbl.saveModel();
}
Don't removed horizontal line by img.removeHorizontalLine(2) example :![line](https://user-images.githubusercontent.com/37155395/74926276-b1469d80-53e6-11ea-8ab0-577a2bf7a9f9.png)
Thank you!