If you are looking for matching nonzero XY indices pairs, you can use boolean ANDing between the nonzero masks of the input arrays and then use np.nonzero, like so -
out = np.nonzero((img1!=0) & (img2!=0))
You can verify these results with np.intersect1d after getting the linear indices of matches from img1 and img2 giving us a second approach to solve the problem at hand , like so -
l_intsct = np.intersect1d(np.nonzero(img1.ravel())[0],np.nonzero(img2.ravel())[0])
out = np.unravel_index(l_intsct,img1.shape)
Sample run -
In [127]: img1
Out[127]:
array([[3, 2, 3, 1, 0],
[3, 1, 1, 2, 2],
[0, 2, 3, 2, 1],
[0, 0, 0, 4, 2]])
In [128]: img2
Out[128]:
array([[1, 1, 4, 0, 0],
[0, 0, 0, 0, 2],
[4, 1, 0, 3, 1],
[1, 0, 4, 1, 4]])
In [129]: np.nonzero(img1)
Out[129]:
(array([0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3]),
array([0, 1, 2, 3, 0, 1, 2, 3, 4, 1, 2, 3, 4, 3, 4]))
In [130]: np.nonzero(img2)
Out[130]:
(array([0, 0, 0, 1, 2, 2, 2, 2, 3, 3, 3, 3]),
array([0, 1, 2, 4, 0, 1, 3, 4, 0, 2, 3, 4]))
In [131]: np.nonzero((img1!=0) & (img2!=0))
Out[131]: (array([0, 0, 0, 1, 2, 2, 2, 3, 3]), array([0, 1, 2, 4, 1, 3, 4, 3, 4]))
In [132]: l_intsct = np.intersect1d(np.nonzero(img1.ravel())[0],np.nonzero(img2.ravel())[0])
In [133]: np.unravel_index(l_intsct,img1.shape)
Out[133]: (array([0, 0, 0, 1, 2, 2, 2, 3, 3]), array([0, 1, 2, 4, 1, 3, 4, 3, 4]))
img1andimg2and show us the expected output?