function [M_list1,nbr_bits_geom] = perform_quadtree_transform(M_list,qt,dir,k,options)
% perform_quadtree_transform - sub-function transform a quadtree
%
% [M_list1,nbr_bits_geom] = perform_quadtree_transform(M_list,qt,dir,k,options);
%
% 'k' is the number of the instancied quadtree.
%
% Copyright (c) 2004 Gabriel Peyr�
options.null = 1;
if nargin<3
dir = 1;
end
if nargin<4
k = 1;
end
if isfield(options, 'alpert_vm')
alpert_vm = options.alpert_vm;
else
alpert_vm = -1;
end
% number of bit to code each geometric feature
if isfield(options, 'nbr_bits_nogeom_token')
nbr_bits_nogeom_token = options.nbr_bits_nogeom_token;
else
nbr_bits_nogeom_token = 1;
end
if isfield(options, 'nbr_bits_geom_token')
nbr_bits_geom_token = options.nbr_bits_geom_token;
else
nbr_bits_geom_token = 1;
end
if isfield(options, 'nbr_bits_split_token')
nbr_bits_split_token = options.nbr_bits_split_token;
else
nbr_bits_split_token = 1;
end
n = length(M_list{1});
nbr_bits_geom = 0;
% size of the QT
j_max = length(qt)-1;
j_min = 0;
while isempty(qt{j_min+1}) && j_min<j_max
j_min = j_min + 1;
end
for j = j_min:j_max
nl = qt{j+1}; % node list
w = n/2^j; % size of the dyadic squares
% compute the cost of coding the geometry
if isfield(options, 'geom_epsi') && isfield(options, 'geom_s') && isfield(options, 'geom_d')
G_list = sample_geometry(w, options.geom_d, options.geom_s, options.geom_epsi, options);
nbr_G = size(G_list,2); clear G_list;
else % hum, works only for exhaustive linear geoemtry
nbr_G = w^2;
end
for kx=1:2^j
for ky=1:2^j
node = nl{kx,ky};
if node.type(k)==2 % this node is a leaf : perform transform
% location of the square
pos = ([kx ky]-1)/2^j;
posn = pos*n+1;
selx = posn(1):posn(1)+w-1;
sely = posn(2):posn(2)+w-1;
% the geometry choosen
g = node.geometry(:,k);
if g(1)~=Inf
% square to transform
for q=1:length(M_list)
M{q} = M_list{q}(selx,sely);
end
% perform the transform
M = perform_bandelet_transform_square(M,g,alpert_vm, dir);
% assign the result
for q=1:length(M_list)
M_list{q}(selx,sely) = M{q};
end
geom_cost = log2(nbr_G) + nbr_bits_geom_token;
nbr_bits_geom = nbr_bits_geom + geom_cost;
elseif length(g)>1 && g(2)>=1
% HAAR transform
for q=1:length(M_list)
if g(2)==1
M_list{q}(selx,sely) = perform_haar_transform(M_list{q}(selx,sely), dir);
else
A = M_list{q}(selx,sely);
options.part_type = '2axis';
options.degree_type = 'sum';
[Y,X] = meshgrid(1:w,1:w); pos = [X(:)'; Y(:)'];
A = perform_alpert_transform_2d(A(:), pos, g(2), dir, options);
M_list{q}(selx,sely) = reshape( A, w, w );
end
end
else
% NO GEOMETRY: NO TRANSFORM
nbr_bits_geom = nbr_bits_geom + nbr_bits_nogeom_token;
end
elseif node.type(k)==1
if size(node.geometry, 1)>1
nbr_bits_geom = nbr_bits_geom + nbr_bits_split_token;
end
end
end
end
end
M_list1 = M_list;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% subfunction : transform a dyadic square using a known geometry
function M1 = perform_bandelet_transform_square(M,g,alpert_vm, dir);
[n,p] = size(M{1});
% sampling location
[Y,X] = meshgrid(1:p,1:n);
pos = [X(:)'; Y(:)'];
% warp the locations
posr = perform_warping(pos,g);
% X shoud be perpendicular to the discontinuity
if g(1)==1
posr = posr(2:-1:1,:);
end
M1 = M;
Jmin = 1;
for q=1:length(M)
if alpert_vm(1)<0
[tmp,I] = sort(posr(1,:));
if alpert_vm(1)==-1
%%%%%%%%%% HAAR TRANSFORM %%%%%%%%%
M1{q}(I) = perform_haar_transform(M1{q}(I), Jmin, dir);
else
%%%%%%%%%% WAVELET TRANSFORM %%%%%%
M1{q}(I) = perform_lifting_transform_byname(M1{q}(I), Jmin, dir, '7_9');
end
else
[M1{q}(:),info] = perform_alpert_transform_2d(M1{q}(:),posr,alpert_vm, dir);
end
end
没有合适的资源?快使用搜索试试~ 我知道了~
toolbox_bandelets
共45个文件
m:39个
repository:1个
dll:1个
3星 · 超过75%的资源 需积分: 9 16 下载量 125 浏览量
2009-11-15
21:57:58
上传
评论 2
收藏 29KB RAR 举报
温馨提示
bandelets的Matlab工具箱,bandelets是二维小波变换,是超小波的一种,对于处理纹理图像效果较好。
资源推荐
资源详情
资源评论
收起资源包目录
toolbox_bandelets.rar (45个子文件)
toolbox_bandelets
test_mex.m 4KB
sample_geometry.m 2KB
perform_quatree_list_creation.m 3KB
perform_bandelet_transform.m 2KB
perform_bandelet_transform_wavelets.m 1KB
CVS
Entries 2KB
Entries.Extra 897B
Repository 34B
Root 43B
perform_parameter_optimization_slow.m 3KB
quadtree_cart_optimization.m 3KB
perform_warping.m 722B
perform_quatree_list_creation_wavelets.m 949B
test_monores.m 2KB
callback_quadtree_display.m 2KB
toolbox
gen_signal.m 602B
psnr.m 359B
get_color_from_index.m 241B
evaluate_nbr_bits.m 689B
norme.m 159B
perform_haar_transform_slow.m 2KB
convert_wavelets2list.m 3KB
keep_above.m 340B
perform_haar_transform.dll 5KB
compute_distance_to_points.m 548B
compute_quadrant_selection.m 857B
compute_error_threshold.m 414B
evaluate_nbr_bits_wavelets.m 784B
dirac.m 361B
reverse_permutation.m 277B
rescale.m 265B
keep_biggest.m 600B
quadtree_tag_below_leaf.m 1KB
perform_geometry_testing_slow.m 1KB
perform_parameter_optimization.m 1KB
perform_quadtree_transform.m 5KB
plot_projected_curve.m 694B
readme 82B
plot_quadtree.m 4KB
perform_geometry_testing.m 201B
plot_linreg_wavband.m 2KB
quadtree_init.m 2KB
plot_geometry.m 1024B
compile_mex.m 126B
quadtree_cart_init.m 3KB
共 45 条
- 1
资源评论
- sunbird5322013-11-12和我之前用的工具箱不同。
yyttzhzhzx
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功