📄 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 + -