📄 im_fill_norm.m
字号:
%IM_FILL_NORM Fill and normalize image for display puproses
%
% B = IM_FILL_NORM(A,N)
%
%Low level routine for the DATAFILE/SHOW command to display non-square
%images of the datafile A, inside square of NxN pixels. Empty areas are
%filled with gray.
function b = im_fill_norm(a,n)
if isa(a,'dataset')
isobjim(a);
b = filtim(a,'im_fill_norm',{n});
else
a = double(a);
[x,y] = size(a);
mx = max(a(:));
mn = min(a(:));
a = (a - mn)/(mx-mn+eps);
b = 0.5*ones(n,n);
z = floor(n/2);
if x > y
a = imresize(a,round(n*[x,y]/x));
k = size(a,2);
s = floor((n-k)/2)+1;
b(:,s:s+k-1) = a;
else
a = imresize(a,round(n*[x,y]/y));
k = size(a,1);
s = floor((n-k)/2)+1;
b(s:s+k-1,:) = a;
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -