How do I shift the alignment of one image over the other?
4 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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
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
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 Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!