Add distance transform functionality - #594
Conversation
|
Aside from the first wikipedia test, all other test have been verified with openCV. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #594 +/- ##
===========================================
+ Coverage 82.05% 82.85% +0.79%
===========================================
Files 117 119 +2
Lines 5384 5634 +250
===========================================
+ Hits 4418 4668 +250
Misses 966 966 🚀 New features to boost your workflow:
|
|
As you might have noticed at some places (especially in the test file) reformatting should have been done after using clang-format, but I had a feeling to keep things as they are after they have been automatically formatted. Let me know about your preferences on this. Note that the second last commit has proper manual formatting. |
|
It is fine to try format any new code using the |
Use constexpr wherever preferred; Replace static const bool by inheriting std::true_type or std::false_type in metafunctions.
Moves 2 metafunctions: check_mask_size and check_distance_type to detail namespace and prefixes them with 'dt' (distance_transform) to avoid naming conflicts.
Uses the clang-format configuration provided in the latest commit of PR boostorg#596. Formatting is applied to test file and example file as well. I have made no changes whatsoever after using the clang-format.
|
I read through all three algorithms against their cited references:
I verified the precise transform numerically against real Euclidean geometry (not just trusting the read-through): a 5×5 image with a single "off" pixel at the corner produced distances matching One real inconsistency I found by probing degenerate input — images with no target pixel of the requested kind at all (e.g. distance_from::on_pixels on an all-black image):
|
bd907af to
5ce9ca9
Compare
|
#584 needs to be merged first. |
Description
Adds Distance Transform functionality to GIL, using algorithms which run in linear time in the worst case.
References
Precise Euclidean distance transform -
http://www.theoryofcomputing.org/articles/v008a019/v008a019.pdf
Manhattan and chessboard distance transforms -
Principles of Digital Image Processing - core Techniques by Wilhelm Burger, Mark J.Burge.
Approximate Euclidean distance transform -
http://www.cmm.mines-paristech.fr/~marcoteg/cv/publi_pdf/MM_refs/1986_Borgefors_distance.pdf
Tasklist