How to perform image registration on non-rectangular image

4 views (last 30 days)
I'm interesting in peforming image registration using imregtform on a non-rectangular region of interest that would be the "moving" image. Is there any way to do this? I initially tried to turn all the pixels within the "moving" image matrix that I don't want to affect registration to NaNs, but the imregtform function won't accept that input.
Jeremy Eekhoff
Jeremy Eekhoff on 6 Jun 2022
That would not work because the black pixels would still affect registration. My images do not have a black background.

Sign in to comment.

Answers (2)

Matt J
Matt J on 6 Jun 2022
Edited: Matt J on 6 Jun 2022
If you have the Optimization Toolbox, you could use lsqcurvefit (don't be misled by the name) to minimize your own reigstration cost function, one which accepts an ROI mask.

Sign in to comment.

Image Analyst
Image Analyst on 1 Aug 2022
Is it rotating and scaling while it translates? If not, you could use normalized cross correlation. See attached demo.
Or try one of the panoramic stitching algorithms. They find matching regions, which is necessary to construct the overall image.
Matt J
Matt J on 11 Aug 2022
Does this seem like a reasonable solution or am I missing something that could be problematic?
I can't argue with success, but I vaguely wonder why setting the background pixels to some constant wouldn't do the same thing. An atomic distribution is independent of every distribution as well.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by