Question: Calculate the offset of the image

March 25 2014 Christopher2222 4229
This question is related to the Question Image correlation

Using the two images from the branched question I tried to calculate the offset of the two images.  But it is too cumbersome and slow, can someone figure out a faster way?

Here's what I did,

I created both jpg images into a single row vector and then into an Array.  I then used a for loop with CircularShift to cycle one array and subtract it from the other.  I then took the absolute value and added all the values in the array and stored that value in another array.  The smallest value would indicate the highest probable position that both images have lined up.

Something like...


a:=convert(convert(img1,vector),Array)  #after img1 is padded to 184x184 from Markyan Hirnyk's answer

for i from 1 to 100 do
end do:

The problem is 100 shifts takes a long time, let alone go through the full image.  Is there a faster way to accomplish this?

Please Wait...