Repository navigation
feat: unified image_to_svg function as complete pipeline #335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 42 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
6db1632
unified img_to_svg function
Krasner e9e5b4a
update py bindings
Krasner 7d203d1
run formatting
Krasner 06e01a3
Merge branch 'main' into feat/img_to_svg
Krasner 17b0b06
introduce img2num::ImageToSvgConfig with c and py bindings... js bind…
Krasner 477e812
Merge branch 'feat/img_to_svg' of https://github.com/Krasner/Img2Num …
Krasner dd4bec2
update js bindings
Krasner 35299a1
fix name
Krasner 70a73c1
resolve merge conflicts
Krasner 7e75ab1
remove debug prints
Krasner 63ffecd
pybind fix and add repr to ImageToSvgConfig
Krasner 771e0cf
formatting
Krasner b1230d4
add python badge
Krasner 7f58edf
define transparent ImageToSvgConfig struct in c bindings
Krasner 1802f5a
free res_svg2
Krasner dbce793
clean up. add arguments to pybind ImageToSvgConfig to allow for argum…
Krasner 3108e75
minor updates
Krasner dd7be65
Merge branch 'main' into feat/img_to_svg
Krasner 608f557
fixes
Krasner 085ed54
rework c bindings. separate BilateralFilterConfig and KMeansConfig in…
Krasner 90aa282
Merge branch 'main' into feat/img_to_svg
Krasner 1161b53
revert to nested struct
Krasner 54f3e71
Merge branch 'main' into feat/img_to_svg
Krasner c1e99ef
Very explicit c to cpp translation in c bindings
Krasner 2ca495d
Merge branch 'feat/img_to_svg' of https://github.com/Krasner/Img2Num …
Krasner 4fec31e
formatting
Krasner 72b1ba0
address pr
Krasner 972e335
Merge branch 'main' into feat/img_to_svg
Krasner 51bc81b
support None config in pybindings - i.e. user calls image_to_svg with…
Krasner c676e58
Merge branch 'feat/img_to_svg' of https://github.com/Krasner/Img2Num …
Krasner 491d0b0
image_to_svg config becomes kwarg
Krasner 7356417
pybind use constructor arguments 'bilateral_filter' and 'kmeans' for …
Krasner f6236c7
revert WasmImageProcessor to run pipeline step by step
Krasner 926f9f3
format
Krasner 2680187
make wasm_wrapper a C file. Update bindings/js CMakeLists
Krasner 2514e2d
small cleanup
Krasner dcceba0
add python typing hints
Krasner d7715d3
docs(core): document image_to_svg and its config struct
Ryan-Millard 0161b91
docs(packages/js): improve JSDocs in safeWasmWrappers.js
Ryan-Millard b3674b0
docs(bindings/c): match core's docs
Ryan-Millard 57aa0d3
fix(bindings/c): NULL tolerance via defaulting in image_to_svg
Ryan-Millard 42aaeb3
build(bindings/js): switch to C18 from C11
Ryan-Millard 8007a02
build(bindings/js): switch to C17 from C18 - blame Emscripten
Ryan-Millard 5d7db6f
refactor(packages/py): move config defaults into Python wrapper from …
Ryan-Millard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #include <cstring> | ||
| #include <vector> | ||
|
|
||
| #include "img2num.h" | ||
|
|
||
| namespace img2num { | ||
| std::string image_to_svg(const uint8_t* data, const int width, const int height, | ||
| const ImageToSvgConfig& config) { | ||
| // self deallocate | ||
| std::vector<uint8_t> img_data(static_cast<size_t>(width) * static_cast<size_t>(height) * 4); | ||
| std::vector<uint8_t> out_data(static_cast<size_t>(width) * static_cast<size_t>(height) * 4); | ||
| std::vector<int32_t> out_labels(static_cast<size_t>(width) * static_cast<size_t>(height)); | ||
|
|
||
| std::memcpy(img_data.data(), data, | ||
| static_cast<size_t>(width) * static_cast<size_t>(height) * 4); | ||
| bilateral_filter(img_data.data(), width, height, config.bilateral_filter.sigma_spatial, | ||
| config.bilateral_filter.sigma_range, config.color_space); | ||
| kmeans(img_data.data(), out_data.data(), out_labels.data(), width, height, config.kmeans.k, | ||
| config.kmeans.max_iter, config.color_space); | ||
|
Ryan-Millard marked this conversation as resolved.
Resolved
|
||
| std::string svg{labels_to_svg(data, out_labels.data(), width, height, config.min_cluster_area)}; | ||
|
|
||
| return svg; | ||
| } | ||
| } // namespace img2num | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.