mirror of
https://github.com/skishore/makemeahanzi.git
synced 2025-11-01 12:07:15 +08:00
Restore trained stroke extractor
This commit is contained in:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user