diff options
author | jaseg <git@jaseg.de> | 2021-06-05 21:22:01 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2021-06-05 21:22:01 +0200 |
commit | 6685b7587a2d8c147715d89e27b0f3b40883b9f1 (patch) | |
tree | d73f82073aecaa4d6c87f279d30fc29f8a977d62 /svg-flatten/src/vec_core.cpp | |
parent | 3ef3f0223e9662f6c3cc6d213afcd74944399f6b (diff) | |
download | gerbolyze-6685b7587a2d8c147715d89e27b0f3b40883b9f1.tar.gz gerbolyze-6685b7587a2d8c147715d89e27b0f3b40883b9f1.tar.bz2 gerbolyze-6685b7587a2d8c147715d89e27b0f3b40883b9f1.zip |
Fix binary contours vectorizer
Replace teh-chin with ramer-douglas-peucker
Diffstat (limited to 'svg-flatten/src/vec_core.cpp')
-rw-r--r-- | svg-flatten/src/vec_core.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/svg-flatten/src/vec_core.cpp b/svg-flatten/src/vec_core.cpp index 2819965..86641dd 100644 --- a/svg-flatten/src/vec_core.cpp +++ b/svg-flatten/src/vec_core.cpp @@ -435,8 +435,10 @@ void gerbolyze::OpenCVContoursVectorizer::vectorize_image(xform2d &mat, const pu draw_bg_rect(local_xf, width, height, clip_path, sink); - img->binarize(); - nopencv::find_contours(*img, nopencv::simplify_contours_teh_chin([&sink, &local_xf, &clip_path, off_x, off_y, scale_x, scale_y](Polygon_i& poly, nopencv::ContourPolarity pol) { + img->binarize(128); + nopencv::find_contours(*img, + nopencv::simplify_contours_douglas_peucker( + [&sink, &local_xf, &clip_path, off_x, off_y, scale_x, scale_y](Polygon_i& poly, nopencv::ContourPolarity pol) { if (pol == nopencv::CP_HOLE) { std::reverse(poly.begin(), poly.end()); |