1

so the case is I have a large picture (name as screenshot) and second pic is the smallest (name as reference).

so the program will check and tell if the reference pic exist in large picture or not (no matter where location is).

is there any program that similar?


if not, It seems that I should make it :( . Any recommended software programing beside "MathLab" that can compare pixel between different image?


anyway here is the sample of large pic and small pic to be easily understood of what I need.

large pic: large pic

small pic: refr pic

Many Thanks.

  • What OS shall it run on? What is your price limit if it comes to paid software? – Izzy Nov 20 '17 at 16:51
1

Here's a simple approach with Python and the Python image-manipulation library Pillow. The program scans through the larger image one pixel at a time looking for an exact duplicate of the smaller image.

import sys
from PIL import Image
import numpy as np

haystack, needle = (np.array(Image.open(x)) for x in sys.argv[1:3])

for y in range(haystack.shape[0] - needle.shape[0]):
    for x in range(haystack.shape[1] - needle.shape[1]):
        if np.array_equal(
                 haystack[y : (y + needle.shape[0]), x : (x + needle.shape[1])],
                 needle):
            print("Found at", (x, y))
            exit()

print("Not found")

When invoked as python3 subimage.py Capture01.png referenceSamplePic.png on my machine, it prints Found at (426, 128) after about 2 seconds.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.