V
V
Vincent2019-06-11 16:04:52
Python
Vincent, 2019-06-11 16:04:52

Why are non-identical numpy arrays considered identical?

Hello!
I'm taking a piece of the grayscale image and assigning it to a variable so it's represented as an array.
With the help of OpenCV I find this pattern in the image.
OpenCV finds the pattern if it is in the image, and if not, it finds a place where it could be.
Therefore, I decided to cut out a piece of the image of the same size, in the place where OpenCV found it, and check if they match, then it found it correctly.
Where OpenCV found it correctly, equality worked, and where it didn’t, it didn’t (the first pattern from the list is not in the image, and equality did not work).
Question: There are, for some reason, such arrays that are not equal, but are counted, why is this and how to solve it?

Picture

5cffa6c9b0e70280567505.png

Picture

5cffa6d26b9b1526708362.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andy_U, 2019-06-11
@Andy_U

So you are not comparing arrays element by element, but what the all function gives for them. See here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question