Closed daladim closed 4 months ago
This and https://github.com/image-rs/imageproc/pull/568 are both adding masked template matching.
cc @daladim and @cospectrum
This and #568 are both adding masked template matching.
cc @daladim and @cospectrum
My PR is compatible with OpenCV, which is a priority for me personally.
@cospectrum by “compatible with” do you mean being able to produce equal results, or something else?
@cospectrum by “compatible with” do you mean being able to produce equal results, or something else?
Equal results, according to their formulas. https://github.com/image-rs/imageproc/issues/567#issuecomment-2053753777
I did not see the open issue before implementing. Nice that the formulae for normalisations are posted there (and I realize that I also forgot to square the masked value for the correlation version). I'll try to compare both MRs tomorrow and see if I can make one with the best of both worlds.
@cospectrum 's version is arguably better than mine :) (does not support images-with-alpha-channel, but has a correct computation, especially with regards to the normalization) I'd be in favor of merging his as-is...before a third guy creates an MR with a third implementation!
I may try to create a separate MR to add tests for the match_template_parallel
(currently, no checks are ensuring its results are consistent with the sequential version).
And I won't merge my gray_alpha_image!
macro, as no one would use it for now
I may as well add a helper function that extracts the template from an image with an alpha channel, to be more convenient when loading a PNG file
Before @cospectrum merges his, I've added tests for the parallelized version at https://github.com/cospectrum/imageproc/pull/1
This MR could be closed now I've created
This MR is adding the
match_template_with_alpha
(and itsmatch_template_parallel_with_alpha
counterpart). This make this crate support "masked" templates (or "non rectangular" templates or templates "with an alpha channel", name it as you'd like :D )A few notes:
_inner
function).sum_squares
) in the case of an image with alpha. I'd be happy to have a review on this part (it's late and my brain is unable to get the meaning of the math behind this normalization, especially as the normalization term depending on the location of the image)Neat side effects:
match_template
andmatch_template_parallel
_parallel
functions are tested in CIgray_alpha_image!
macro