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

4 ビュー (過去 30 日間)
Samyukta Ramnath
Samyukta Ramnath 2013 年 7 月 12 日
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?

採用された回答

Image Analyst
Image Analyst 2013 年 7 月 12 日
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 件のコメント
Image Analyst
Image Analyst 2013 年 7 月 12 日
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 2018 年 5 月 3 日
@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.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by