test_image.m
来自「matlab的工具箱」· M 代码 · 共 34 行
M
34 行
% test for image transformation
name = 'barb';
n = 128;
M = load_image(name, n);
% find sampling location for an image
[Y,X] = meshgrid(1:n,1:n);
pos = [X(:),Y(:)]';
% perform the transform
alpert_vm = [2 2];
% this is very important for images
options.part_type = '2axis';
w = perform_alpert_transform_2d(M(:),pos,alpert_vm, 1, options);
% perform some thresholding
T = 20; % this threshold is ok for images in range [1...256], otherwise scale it
w1 = w .* (abs(w)>T);
% reconstruction
v1 = perform_alpert_transform_2d(w1,pos,alpert_vm, -1, options);
M1 = reshape(v1,n,n);
clf;
subplot(1,2,1);
imagesc(M);
title('Original'); axis image; axis off;
subplot(1,2,2);
imagesc(M1);
title('Approximated'); axis image; axis off;
colormap gray(256);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?