image alignment and stitching
이전 댓글 표시
I'm trying to align several images so I can stitch them together.
My idea is to filter then to enhance the contrast so that matlab can then properly align them using a rigid transformation. I've tried aligning only parts of them and that doesn't work very well.
For filtering I've been trying local adaptive thresholding (<http://www.mathworks.com/matlabcentral/fileexchange/8647-local-adaptive-thresholding>) with median and wiener2 filters.
Tomorrow I'm going to try to remove the dark spots that are in every picture and replace them with the median of the surrounding pixels on the perimeter.
On an somewhat related note, does anyone have some articles or guides I could have a look at to understand when I should apply which kind of filter? Everything I find on the subject explains how the filters work but not when to apply which so I've been just trying different things and seeing how it looks.
Thanks in advance for your help!
댓글 수: 3
Ben
2012년 12월 5일
Image Analyst
2012년 12월 5일
Sure - give it a shot. You could also try normxcorr2() - search Answers for a demo I posted.
Ben
2012년 12월 5일
답변 (2개)
Image Analyst
2012년 12월 5일
0 개 추천
Well I'm no expert in the stitching field but I don't see anything that you've listed that would do the stitching or even help with the stitching at all. But I can refer you to this page which has dozens of different published algorithm from the past 15 years: 18.4.1 Mosaic Generation, Image Stitching, Photomosaic If I were you I'd pick one of those successful algorithms and try to program it up.
댓글 수: 5
siqian yang
2020년 9월 9일
편집: siqian yang
2020년 9월 9일
Hello, I want to ask whether there are algorithms that help me to repairing the cracks intrinsically caused by microscope during whole slide scan? I will appreciate if you kindly answer me . Thank you a lot.
Image Analyst
2020년 9월 9일
Not that I know of, but I would not doubt it. Just search the bibliography in the link I gave.
siqian yang
2020년 9월 11일
Let me explain more specific. Everytime I scan the same slide, I find that when I registration each slide, there are some cracks and mismatches between slides. Because the whole slide scan is devided into many small regions. Would you please give me some tips. Thanks.
Image Analyst
2020년 9월 11일
Same answer/suggestion.
siqian yang
2020년 9월 12일
Thank you so much.
Image Analyst
2012년 12월 5일
Ben: Here's my demo on normxcorr2():
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures.
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
format longg;
format compact;
fontSize = 20;
% Check that user has the Image Processing Toolbox installed.
hasIPT = license('test', 'image_toolbox');
if ~hasIPT
% User does not have the toolbox installed.
message = sprintf('Sorry, but you do not seem to have the Image Processing Toolbox.\nDo you want to try to continue anyway?');
reply = questdlg(message, 'Toolbox missing', 'Yes', 'No', 'Yes');
if strcmpi(reply, 'No')
% User said No, so exit.
return;
end
end
% Read in a standard MATLAB color demo image.
folder = fullfile(matlabroot, '\toolbox\images\imdemos');
baseFileName = 'peppers.png';
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
if ~exist(fullFileName, 'file')
% Didn't find it there. Check the search path for it.
fullFileName = baseFileName; % No path this time.
if ~exist(fullFileName, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
rgbImage = imread(fullFileName);
% Get the dimensions of the image. numberOfColorBands should be = 3.
[rows columns numberOfColorBands] = size(rgbImage);
% Display the original color image.
subplot(2, 2, 1);
imshow(rgbImage, []);
axis on;
title('Original Color Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
smallSubImage = imcrop(rgbImage, [192 82 60 52]);
subplot(2, 2, 2);
imshow(smallSubImage, []);
axis on;
title('Template Image to Search For', 'FontSize', fontSize);
% Search the red channel for a match.
correlationOutput = normxcorr2(smallSubImage(:,:,1), rgbImage(:,:,1));
subplot(2, 2, 3);
imshow(correlationOutput, []);
title('Correlation Output', 'FontSize', fontSize);
[maxCorrValue, maxIndex] = max(abs(correlationOutput(:)));
[ypeak, xpeak] = ind2sub(size(correlationOutput),maxIndex(1));
corr_offset = [(xpeak-size(smallSubImage,2)) (ypeak-size(smallSubImage,1))];
subplot(2, 2, 4);
imshow(rgbImage);
hold on;
rectangle('position',[corr_offset(1) corr_offset(2) 50 50],...
'edgecolor','g','linewidth',2);
title('Template Image Found in Original Image', 'FontSize', fontSize);
카테고리
도움말 센터 및 File Exchange에서 Communications Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!