curvelet matlab示例代码理解
1. fdct_wrapping
function C = fdct_wrapping(x, is_real, finest, nbscales, nbangles_coarse)
% fdct_wrapping.m - Fast Discrete Curvelet Transform via wedge wrapping - Version 1.0
%
% Inputs
% x M-by-N matrix 输入为MxN的矩阵
%
% Optional Inputs
% is_real Type of the transform 转化的类型
% 0: complex-valued curvelets 复数值的曲波变化
% 1: real-valued curvelets 实数值的曲波变化
% [default set to 0] 默认设置为0
% finest Chooses one of two possibilities for the coefficients at the
% finest level: 选择一种表示方式计算最优级的系数
% 1: curvelets 曲波变化
% 2: wavelets 小波变化
% [default set to 2] 默认设置为2
% nbscales number of scales including the coarsest wavelet level
% 包含最粗小波级在内的伸缩数
% [default set to ceil(log2(min(M,N)) - 3)]
% nbangles_coarse
% number of angles at the 2nd coarsest level, minimum 8,
% 第二粗糙级的角度数,最小为8
% must be a multiple of 4. [default set to 16]
% 必须为4的倍数,默认为16
% Outputs
% C Cell array of curvelet coefficients.
% C{j}{l}(k1,k2) is the coefficient at
% - scale j: integer, from finest to coarsest scale,
% 从最佳尺度到最粗尺度
% - angle l: integer, starts at the top-left corner and
% increases clockwise,
% 从左上角开始顺时针增长
% - position k1,k2: both integers, size varies with j
% and l.
% If is_real is 1, there are two types of curvelets,
% ‘cosine’ and ‘sine’。 For a given scale j, the ‘cosine’
% coefficients are stored in the first two quadrants (low
% values of l), the ‘sine’ coefficients in the last two
% quadrants (high values of l)。
%
% See also ifdct_wrapping.m, fdct_wrapping_param.m
%
% By Laurent Demanet, 200412345678910111213141516171819202122232425262728293031323334353637383940414243
2. DCT基本示例代码理解
% fdct_wrapping_demo_basic.m -- Displays a curvelet both in the spatial and frequency domains.
m = 1024;
n = 1024;
X = zeros(m,n);
%forward curvelet transform
disp(‘Take curvelet transform: fdct_wrapping’);
tic; C = fdct_wrapping(X,0,2,8,64); toc; %tic toc配合使用测量程序运行时间
%specify one curvelet
s = 7; %从1开始增大,空间域变细,频率域变粗
w = 10;%从1(左上角)开始增大,空间域顺时针旋转,与笛卡尔corona相对应
[A,B] = size(C{s}{w});%尺度为s,方向为w,的矩阵大小
a = ceil((A+1)/2);
b = ceil((B+1)/5);
C{s}{w}(a,b) = 1; %该尺度、方向中心位置元素设置为1
%adjoint curvelet transform
disp(‘Take adjoint curvelet transform: ifdct_wrapping’);
tic; Y = ifdct_wrapping(C,0); toc;%进行反曲波变化,得到空间域图像
%display the curvelet
F = ifftshift(fft2(fftshift(Y)));
subplot(1,2,1); colormap gray; imagesc(real(Y)); axis(‘image’); 。。。
title(‘a curvelet: spatial viewpoint’);
subplot(1,2,2); colormap gray; imagesc(abs(F)); axis(‘image’); 。。。
title(‘a curvelet: frequency viewpoint’);
%get parameters
[SX,SY,FX,FY,NX,NY] = fdct_wrapping_param(C);
评论
查看更多