boxfilter 实现
生活随笔
收集整理的這篇文章主要介紹了
boxfilter 实现
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
A implementation of boxfilter
? ? ? ? ? ? ? ? ?boxfilter 是均值濾波的一種改進。在以下這篇blog里面有介紹。
http://www.cnblogs.com/easymind223/archive/2012/11/13/2768680.html
這里我使用matlab對其進行實現(xiàn)。
可是這里邊界問題沒有處理好,假設viewer有好的意見歡迎告訴我
% % ********************************************************* % code writer : EOF % code file : my_boxfilter.m % code date : 2014.10.21 % e-mail : jasonleaster@gmail.com % % Code description : % Here is my implementation of boxfilter :) % It work correctly in the region where is not close to % the end boundary but will meet problem on some where % close to the image end boundary. % *********************************************************function Filted_Img = my_boxfilter(Image)if size(Image,3) ~= 1fprintf('ERROR Imput-Image must be ##ONE## channel image\n');return;endHeight_Img = size(Image,1);Width_Img = size(Image,2);Buffer = zeros(1,Width_Img);Filted_Img = zeros(Height_Img,Width_Img);% treat this varible as a constantSEARCH_WIN_HEIGHT = 10;SEARCH_WIN_WIDTH = 10;for row = 1: Height_Imgfor col = 1: Width_Imgsum_value = 0;if (row + SEARCH_WIN_HEIGHT) < Height_Imgfor temp = row : (row + SEARCH_WIN_HEIGHT)sum_value = sum_value + Image(temp,col);endelsefor temp = row : Height_Imgsum_value = sum_value + Image(temp,col);end endBuffer(col) = sum_value;endfor col = 1:Width_Imgif (col + SEARCH_WIN_WIDTH) < Width_Imgfor temp = col : col + SEARCH_WIN_WIDTHFilted_Img(row,col) = Filted_Img(row,col) + Buffer(temp);endelsefor temp = col : Width_ImgFilted_Img(row,col) = Filted_Img(row,col) + Buffer(temp);endendendendFilted_Img = Filted_Img./(SEARCH_WIN_HEIGHT * SEARCH_WIN_WIDTH); end
版權聲明:本文博客原創(chuàng)文章,博客,未經同意,不得轉載。
轉載于:https://www.cnblogs.com/bhlsheji/p/4682760.html
總結
以上是生活随笔為你收集整理的boxfilter 实现的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 万用金在哪提前还款
- 下一篇: 自定义UITableViewCell需注