我有扫描电镜图像扫描在两个放大,类似于这个样本图像。我想把这些合并成一个图像,这样我就可以在小尺度和大尺度上获得关于毛孔的信息。我想知道如何使用python或Matlab从那些2D切片创建单个图像。
发布于 2021-04-18 22:09:26
您可以使用MATLAB estimateGeometricTransform示例:
% Read the images.
I1 = rgb2gray(imread('macro.png'));
I2 = rgb2gray(imread('micro.png'));
% Reuse MATLAB example.
original = I1;
distorted = I2;
% Detect and extract features from the original and the transformed images.
% (Use more octaves and scales and lower threshold for improving robustness).
ptsOriginal = detectSURFFeatures(original, 'NumOctaves', 5, 'NumScaleLevels', 5, 'MetricThreshold', 10);
ptsDistorted = detectSURFFeatures(distorted, 'NumOctaves', 5, 'NumScaleLevels', 5, 'MetricThreshold', 10);
[featuresOriginal,validPtsOriginal] = extractFeatures(original,ptsOriginal);
[featuresDistorted,validPtsDistorted] = extractFeatures(distorted,ptsDistorted);
% Match and display features between the images.
index_pairs = matchFeatures(featuresOriginal,featuresDistorted);
matchedPtsOriginal = validPtsOriginal(index_pairs(:,1));
matchedPtsDistorted = validPtsDistorted(index_pairs(:,2));
figure
showMatchedFeatures(original,distorted,matchedPtsOriginal,matchedPtsDistorted)
title('Matched SURF Points With Outliers');
% Exclude the outliers, estimate the transformation matrix, and display the results.
[tform,inlierPtsDistorted,inlierPtsOriginal] = estimateGeometricTransform(matchedPtsDistorted,matchedPtsOriginal, 'similarity');
figure
showMatchedFeatures(original,distorted, inlierPtsOriginal,inlierPtsDistorted);
title('Matched inlier points');
%Recover the original image from the distorted image.
outputView = imref2d(size(original));
Ir = imwarp(distorted,tform,'OutputView',outputView);
figure; imshow(Ir);
title('Recovered image');
% Visualize it somehow...
imshowpair(original, Ir)结果:

注意:
我手动删除了图像中的文本。
https://stackoverflow.com/questions/67142592
复制相似问题