我正在尝试平滑或内插掉积累到最大强度的“台阶”,同时保留表面的形状,以使估计的宽度不会移位或改变。我尝试使用2D样条线插值到更高分辨率,但是“阶梯”仍然存在,并且估计的最大区域发生了变化。有人可以帮我平滑/插值这些步骤,以使表面看起来更连续,同时保持表面形状吗?
一如既往,非常感谢您的任何建议或帮助!
尝试
conversion = 1/49.0196; % in mm/pixel
new_xData = linspace(xData(1), xData(end), 10*length(xData));
new_yData = linspace(yData(1), yData(end), 10*length(yData)).';
new_zData = interp2(xData, yData, zData, new_xData, new_yData, 'spline');
xData = new_xData; yData = new_yData; zData = new_zData;
h = figure();
surf(xData, yData, zData, 'LineStyle', 'none', 'FaceColor', 'interp');
xlim([xData(1) xData(end)])
ylim([yData(1) yData(end)])
zlim([0 ceil(max(zData(:)))]);
colormap(jet(4096))
xlabel('mm'); ylabel('mm'); zlabel('ln(Intensity)');
set(gca,'Ydir', 'reverse')
grid on
shading interp
view(3); axis vis3d; camlight;
% Change x and y tick labels from pixels to mm
addMM = @(x) sprintf('%.1f', x * conversion);
xticklabels(cellfun(addMM,num2cell(xticks'),'UniformOutput',false));
yticklabels(cellfun(addMM,num2cell(yticks'),'UniformOutput',false));
% Find maxium intensity region and plot it
hold on
maxValue = max(zData(:));
[rowsOfMaxes, colsOfMaxes] = find(zData == maxValue);
x_minind = min(colsOfMaxes(:));
x_maxind = max(colsOfMaxes(:));
p = zeros(1, 2);
p(1) = plot3(linspace(xData(x_minind), xData(x_minind), ...
length(yData)), yData, zData(:, x_minind), 'Linestyle', '-.', ...
'Color', 'black', 'LineWidth', 2.0);
p(2) = plot3(linspace(xData(x_maxind), xData(x_maxind), ...
length(yData)), yData, zData(:, x_maxind), 'Linestyle', '-.', ...
'Color', 'black', 'LineWidth', 2.0);
hold off
legend(p(1), 'Estimated width of maximum intensity', 'Location', 'North')
set(gca, 'FontSize', 14)