?? get_median.m
字號:
%#emlfunction [min,med,max] = get_median(inbuf)numpixels = length(inbuf);tbuf = inbuf;for ii=eml.unroll(1:numpixels) if bitand(ii,uint32(1)) == 1 tbuf = compare_stage1(tbuf); else tbuf = compare_stage2(tbuf); endendmin = tbuf(1);med = tbuf(ceil(numpixels/2));max = tbuf(numpixels);endfunction outbuf = compare_stage1(inbuf)numpixels = length(inbuf);tbuf = compare_stage(inbuf(1:numpixels-1));outbuf = [tbuf(:)' inbuf(numpixels)];endfunction outbuf = compare_stage2(inbuf)numpixels = length(inbuf);tbuf = compare_stage(inbuf(2:numpixels));outbuf = [inbuf(1) tbuf(:)'];endfunction [outbuf] = compare_stage(inbuf)step = 2;numpixels = length(inbuf);outbuf = inbuf;for ii=eml.unroll(1:step:numpixels) t = compare_pixels([inbuf(ii), inbuf(ii+1)]); outbuf(ii) = t(1); outbuf(ii+1) = t(2);endendfunction outbuf = compare_pixels(inbuf)if (inbuf(1) > inbuf(2)) outbuf = [inbuf(1), inbuf(2)];else outbuf = [inbuf(2), inbuf(1)];endend
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -