Restore trained stroke extractor

This commit is contained in:
Shaunak Kishore
2015-09-30 01:58:22 -04:00
parent c10079bba4
commit 33c5656771
6 changed files with 2241 additions and 3 deletions

View File

@ -354,7 +354,7 @@ if (this.stroke_extractor !== undefined) {
}
this.stroke_extractor = {};
this.stroke_extractor.getBridges = (glyph, classifier) => {
stroke_extractor.getBridges = (glyph, classifier) => {
assert(glyph.stages.path)
const paths = svg.convertSVGPathToPaths(glyph.stages.path);
const endpoints = [];
@ -363,11 +363,12 @@ this.stroke_extractor.getBridges = (glyph, classifier) => {
endpoints.push(new Endpoint(paths, [i, j]));
}
}
const bridges = getBridges(endpoints, classifier || handTunedClassifier);
classifier = classifier || stroke_extractor.combinedClassifier;
const bridges = getBridges(endpoints, classifier);
return {endpoints: endpoints, bridges: bridges};
}
this.stroke_extractor.getStrokes = (glyph) => {
stroke_extractor.getStrokes = (glyph) => {
assert(glyph.stages.path)
assert(glyph.stages.bridges)
const paths = svg.convertSVGPathToPaths(glyph.stages.path);
@ -383,3 +384,5 @@ this.stroke_extractor.getStrokes = (glyph) => {
const strokes = stroke_paths.map((x) => svg.convertPathsToSVGPath([x]));
return {log: log, strokes: strokes};
}
stroke_extractor.handTunedClassifier = handTunedClassifier;