Template matching with transparent regions
kevin.keraudren at googlemail.com
Tue Nov 10 15:26:55 EST 2015
What about simply masking out in the matching results the region you want to exclude:
import numpy as np
from skimage.feature import match_template
matching_result = match_template( image, template, pad_input=False )
matching_result = np.array(matching_result)
# mask out the region you want to exclude
matching_result[mask==0] = 0
# coordinates of the best match
best_match = np.unravel_index( np.argmax(matching_result), matching_result.shape )
See this example to better understand what matching_result should look like:
> On 10 Nov 2015, at 09:11, 'kwc' via scikit-image <scikit-image at googlegroups.com> wrote:
> Hi, I am new to scikit-image. I would like to use the Template Matching function in scikit-image.
> In my template image, there are some regions that I would like to ignore or exclude from the template matching process. I plan to change those regions to become transparent (alpha channel). Does the alpha channel have any effect on the template matching result?
> You received this message because you are subscribed to the Google Groups "scikit-image" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe at googlegroups.com <mailto:scikit-image+unsubscribe at googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the scikit-image