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

4 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

Image Analyst
Image Analyst am 12 Jul. 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 Kommentare
Image Analyst
Image Analyst am 12 Jul. 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 am 3 Mai 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by