Click4Ai

325.

Medium

Template Matching

====================

**Problem:** Given two images, find the location of the first image within the second image using template matching.

Example:

Suppose we have two images: an image of a cat and an image of a cat sitting on a chair. We want to find the location of the cat within the second image.

Constraints:

  • The images are 2D numpy arrays with pixel values between 0 and 255.
  • The first image is a smaller version of the second image.
  • Test Cases

    Test Case 1
    Input: [[[255, 255, 255], [255, 255, 255]], [[10, 10, 50, 50]]]
    Expected: [[1, 1]]
    Test Case 2
    Input: [[[0, 0, 0], [0, 0, 0]], [[100, 100, 200, 200]]]
    Expected: [[0, 0]]
    + 3 hidden test cases