test_glcm_features.m
来自「segmentation code in image processing」· M 代码 · 共 42 行
M
42 行
% Timing improvement between GLCM_Features1.m and GLCM_Features2.m
clear all
offsetmat = [];
for i = 1:10
offsetmat = [offsetmat; i*[1 0]];
I = imread('circuit.tif'); GLCM2 = graycomatrix(I,...
'NumLevels',64,'Offset',offsetmat);
tic; stats1 = GLCM_Features1(GLCM2,0); t1(i) = toc;
clear stats1
t = cputime; stats1 = GLCM_Features1(GLCM2,0); ct1(i) = cputime-t;
clear stats1
tic; stats2 = GLCM_Features2(GLCM2,0); t2(i) = toc;
clear stats2
t = cputime; stats2 = GLCM_Features2(GLCM2,0); ct2(i) = cputime-t;
clear stats2
end
figure; subplot(2,1,1);
hold on
plot(t1,'-*');
plot(t2,':sr');
xlabel('No. of GLCMs input');
ylabel('Execution time (secs)');
legend('GLCM Features1','GLCM Features2');
hold off
subplot(2,1,2);
hold on
plot(ct1,'-*');
plot(ct2,':sr');
xlabel('No. of GLCMs input');
ylabel('CPU time (secs)');
legend('GLCM Features1','GLCM Features2');
hold off
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?