📄 test_glcm_features.html
字号:
<html xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--This HTML is auto-generated from an M-file.To make changes, update the M-file and republish this document. --> <title>Test_GLCM_Features</title> <meta name="generator" content="MATLAB 7.0.1"> <meta name="date" content="2008-12-07"> <meta name="m-file" content="Test_GLCM_Features"><style>body { background-color: white; margin:10px;}h1 { color: #990000; font-size: x-large;}h2 { color: #990000; font-size: medium;}p.footer { text-align: right; font-size: xx-small; font-weight: lighter; font-style: italic; color: gray;}pre.codeinput { margin-left: 30px;}span.keyword {color: #0000FF}span.comment {color: #228B22}span.string {color: #A020F0}span.untermstring {color: #B20000}span.syscmd {color: #B28C00}pre.showbuttons { margin-left: 30px; border: solid black 2px; padding: 4px; background: #EBEFF3;}pre.codeoutput { color: gray; font-style: italic;}pre.error { color: red;}/* Make the text shrink to fit narrow windows, but not stretch too far in wide windows. On Gecko-based browsers, the shrink-to-fit doesn't work. */ p,h1,h2,div { /* for MATLAB's browser */ width: 600px; /* for Mozilla, but the "width" tag overrides it anyway */ max-width: 600px; /* for IE */ width:expression(document.body.clientWidth > 620 ? "600px": "auto" );} </style></head> <body><pre class="codeinput"><span class="comment">% Timing improvement between GLCM_Features1.m and GLCM_Features2.m</span>clear <span class="string">all</span>offsetmat = [];<span class="keyword">for</span> i = 1:10 offsetmat = [offsetmat; i*[1 0]]; I = imread(<span class="string">'circuit.tif'</span>); GLCM2 = graycomatrix(I,<span class="keyword">...</span> <span class="string">'NumLevels'</span>,64,<span class="string">'Offset'</span>,offsetmat); tic; stats1 = GLCM_Features1(GLCM2,0); t1(i) = toc; clear <span class="string">stats1</span> t = cputime; stats1 = GLCM_Features1(GLCM2,0); ct1(i) = cputime-t; clear <span class="string">stats1</span> tic; stats2 = GLCM_Features2(GLCM2,0); t2(i) = toc; clear <span class="string">stats2</span> t = cputime; stats2 = GLCM_Features2(GLCM2,0); ct2(i) = cputime-t; clear <span class="string">stats2</span><span class="keyword">end</span>figure; subplot(2,1,1); hold <span class="string">on</span> plot(t1,<span class="string">'-*'</span>); plot(t2,<span class="string">':sr'</span>); xlabel(<span class="string">'No. of GLCMs input'</span>); ylabel(<span class="string">'Execution time (secs)'</span>); legend(<span class="string">'GLCM Features1'</span>,<span class="string">'GLCM Features2'</span>); hold <span class="string">off</span> subplot(2,1,2); hold <span class="string">on</span> plot(ct1,<span class="string">'-*'</span>); plot(ct2,<span class="string">':sr'</span>); xlabel(<span class="string">'No. of GLCMs input'</span>); ylabel(<span class="string">'CPU time (secs)'</span>); legend(<span class="string">'GLCM Features1'</span>,<span class="string">'GLCM Features2'</span>); hold <span class="string">off</span></pre><img vspace="5" hspace="5" src="Test_GLCM_Features_01.png"> <p class="footer"><br> Published with MATLAB® 7.0.1<br></p> <!--##### SOURCE BEGIN #####% 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
##### SOURCE END #####--> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -