image search python and opencv stackoverflow

Solutions on MaxInterview for image search python and opencv stackoverflow by the best coders in the world

showing results for - "image search python and opencv stackoverflow"
Sara
26 Oct 2019
1import cv2
2import numpy as np
3
4img = cv2.imread('one.jpg')
5
6pixel = img[801,600]
7print (pixel) # pixel value i am searching for
8
9def search_for():
10    for iidx, i in enumerate(img):
11        for xidx, x in enumerate(i):
12            if (x == pixel).all():
13                print (f"SUCCESS - [{iidx} {xidx}]")
14
15if __name__ == "__main__":
16    print("Search using for loops...")
17    search_for()