Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- def get_first_one_pixel(img):
- for y in range(len(img)):
- for x in range(len(img[0])):
- if img[y, x] == 1:
- return y, x
- img1 = np.loadtxt('images/img1.txt', skiprows=2)
- img2 = np.loadtxt('images/img2.txt', skiprows=2)
- img1_first_pixel = get_first_one_pixel(img1)
- img2_first_pixel = get_first_one_pixel(img2)
- print(img1_first_pixel[0] - img2_first_pixel[0], img1_first_pixel[1] - img2_first_pixel[1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement