资源简介
引导滤波matlab源代码,可以直接运行
代码片段和文件信息
function imDst = boxfilter(imSrc r)
% BOXFILTER O(1) time box filtering using cumulative sum
%
% - Definition imDst(x y)=sum(sum(imSrc(x-r:x+ry-r:y+r)));
% - Running time independent of r;
% - Equivalent to the function: colfilt(imSrc [2*r+1 2*r+1] ‘sliding‘ @sum);
% - But much faster.
[hei wid] = size(imSrc);
imDst = zeros(size(imSrc));
%cumulative sum over Y axis
imCum = cumsum(imSrc 1);
%difference over Y axis
imDst(1:r+1 :) = imCum(1+r:2*r+1 :);
imDst(r+2:hei-r :) = imCum(2*r+2:hei :) - imCum(1:hei-2*r-1 :);
imDst(hei-r+1:hei :) = repmat(imCum(hei :) [r 1]) - imCum(hei-2*r:hei-r-1 :);
%cumulative sum over X axis
imCum = cumsum(imDst 2);
%difference over Y axis
imDst(: 1:r+1) = imCum(: 1+r:2*r+1);
imDst(: r+2:wid-r) = imCum(: 2*r+2:wid) - imCum(: 1:wid-2*r-1);
imDst(: wid-r+1:wid) = repmat(imCum(: wid) [1 r]) - imCum(: wid-2*r:wid-r-1);
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 607 2010-07-08 20:19 example_flash.m
文件 285 2010-07-08 19:46 example_smoothing.m
文件 957 2010-07-08 21:57 guidedfilter.m
文件 2462 2011-05-03 04:12 guidedfilter_color.m
文件 1111 2012-04-20 21:34 readme.txt
文件 2880056 2010-03-05 16:09 img_enhancement\tulips.bmp
文件 947480 2010-07-08 22:24 img_feathering\toy-mask.bmp
文件 947480 2010-07-08 22:24 img_feathering\toy.bmp
文件 786488 2010-02-24 13:31 img_flash\cave-flash.bmp
文件 786488 2010-02-24 13:30 img_flash\cave-noflash.bmp
文件 77256 2010-02-27 16:16 img_smoothing\cat.bmp
文件 931 2010-07-08 19:30 boxfilter.m
文件 452 2010-07-08 20:22 example_enhancement.m
文件 341 2010-07-08 22:24 example_feathering.m
目录 0 2010-07-08 20:20 img_enhancement
目录 0 2010-07-08 21:11 img_feathering
目录 0 2010-07-08 19:45 img_flash
目录 0 2010-07-08 19:45 img_smoothing
----------- --------- ---------- ----- ----
6432394 18
评论
共有 条评论