Template matching with transparent regions

Stéfan van der Walt stefanv at berkeley.edu
Wed Nov 11 03:08:25 EST 2015


I think kwc meant that he wanted parts of the template to be ignored. I
have the same problem at the moment, so will have to investigate soon if no
other dev informs us how :)

Stéfan
On Nov 10, 2015 12:26 PM, "'Kevin Keraudren' via scikit-image" <
scikit-image at googlegroups.com> wrote:

> Hi,
>
> 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:
> http://scikit-image.org/docs/dev/auto_examples/plot_template.html
>
> Kind Regards,
>
> Kevin
>
>
> 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?
>
> Thanks.
>
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20151111/f608ce11/attachment.html>


More information about the scikit-image mailing list