Reputation: 43
So I have a matrix A
300x500 which contains binary image of some object (background 0
, object 1
), and noisy image B
with depicted the same object. I want to match binary mask A
to the image B
. Object on the mask has exactly the same shape as object on the noisy image. The problem is that images have different sizes (both of their planes and the objects depicted on them). Moreover the object on mask is located in the middle of the plane, contrary, on the image B
is translated. Does anyone now simple solution how can I match these images?
Upvotes: 1
Views: 262
Reputation: 573
Provided you don't rotate or scale your object the peak in cross-correlation should give you the shift between the two objects.
From the signal prcessing toolbox you can use xcorr2(A, B)
to do this. The help even has it as one of the examples.
The peak position indicates the offset to get from one to the other. The fact that one indut is noisy will introduce some uncertainty in your answer, but this is inevitable as they do not exactly match.
Upvotes: 1