Answer the question
In order to leave comments, you need to log in
How to find the most similar match in an array to another?
We don’t look at matlab, I painted it as simply as possible, I need to understand the algorithm more.
The shortest description is to find the most similar array in another array.
The task is there are 2 images, 1 of them is a piece of the second (may not be), you need to find the coordinates where the smaller image looks the most like in the big one.
I decided to compare images with a mutual covariance function, where f images, N image widths, M heights
The first problem that appeared in this formula is sums, images have different lengths and heights (2 is always less than 1). Also, multiplying light pixels (255) will most often be the maximum, and black (0) the minimum, that is, the newly created array is not a similarity map, if you can call it that.
Problem 1 was solved by finding the sum of the product of the pixels of the smallest image with a shift with the image of the larger one.
for i = 1:N1
for j = 1:M1
for i1 = 1:N2
for j1 = 1:M2
B(i, j) = B(i, j) + f1(i + i1, j + j1) * f2(i1, j1);
end
end
end
end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question