1、F=fft2(f),返回原大小的变换,原点在左上角。
2、F=fft2(f,P,Q),对图像填充0,使得大小为P*Q
3、S=abs(f) ,计算幅度值
4、在F为double是要注意显示用imshow(F,[])规定显示范围。
5、FC=fftshift(F),使得变换的原点在中间。
6、谱变换的对数增强显示:S=log(1+abs(F));
7、自定义的tofloat函数。
function [out,revertclass] = tofloat(inputimage)
%Copy the book of Gonzales
identify = @(x) x;
tosingle = @im2single;
table = {'uint8',tosingle,@im2uint8
'uint16',tosingle,@im2uint16
'logical',tosingle,@logical
'double',identify,identify
'single',identify,identify};
classIndex = find(strcmp(class(inputimage),table(:,1)));
if isempty(classIndex)
error('不支持的图像类型');
end
out = table{classIndex,2}(inputimage);
revertclass = table{classIndex,3};