How do I shift the alignment of one image over the other?

4 visualizzazioni (ultimi 30 giorni)
I have two images (both are of crosses as in x. They were of different sizes and different colours, I converted both of them into binary images and brought the actual crosses (That is,the area of the cross, not the entire image wit whitespace and all) to the same scale. When I use imshowpair to subtract the two images, however, I get a very large answer because the two crosses are not aligned properly over each other. Reference : https://twitter.com/SamyuktaRamnath/status/355657777277968385/photo/1
So, I have two options. Either I just find their centres and align them, or I run an algorithm to find the difference between the two pictures and shift the alignment to the least difference, after shifting it.
But I don't know how to shift the second picture over the first. Any function, or any way that I can move it coordinate by coordinate?

Risposta accettata

Image Analyst
Image Analyst il 12 Lug 2013
First figure out the overlap region, then place it on a new canvass:
% Create blank new canvass the same size as the reference image.
newCanvass = zeros(size(referenceImage), 'uint8');
% Place overlap image down at row, column
newCanvass(row:end, column:end) = overlapImage;
  3 Commenti
Image Analyst
Image Analyst il 12 Lug 2013
Like say when the images are overlapped perfectly, the upper left corner of image 2 lands at row = 143, and column = 73 (or whatever). Pixels inside the overlap rectangle overlap acceptably while those outside the overlap region exist in either one image or the other but not both.
Stelios Fanourakis
Stelios Fanourakis il 3 Mag 2018
@Image Analyst. I want to do something similar. I have 15 dicom images. They are slightly shifted. Need to properly align them to a reference image.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by