Skip to content

Getting findMatches to work when a template doesn't fit the searchBox #11

Closed
@insertscode

Description

@insertscode

To speed up the matchTemplates function I decided to first run some image preprocessing and extract rectangles representing my regions of interest. With some templates being smaller than others I often get rectangles that only fit the smaller templates. When a template bigger than the currrent searchbox is tried, the error

  • cv2.error: (-215:Assertion failed) _img.size().height <= _templ.size().height && ;_img.size().width <= _templ.size().width in function 'cv::matchTemplate'

occurs on

  • init line 143 corrMap = computeScoreMap(template, image, method, mask=mask)

I bandaided the issue by wrapping that line in a try except block, but some logic to check sizes earlier in the function would probably save time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions