資源簡介
自適應(yīng)直方圖均衡(AHE)算法的實(shí)現(xiàn),提供了樣圖進(jìn)行對比。
代碼片段和文件信息
%ahe?which?I?implemented
????function?img_new=ahe(imggridlimit)?
????
????img_new=img;?%img_new?is?the?img?after?AHE
????[mn]=size(img);??
????
????%ECR
????
????grid_cols=grid;
????grid_rows=grid;
????grid_width=int32(fix(m/grid_cols));
????grid_height=int32(fix(n/grid_rows));
????
????map=zeros(grid_colsgrid_rows256);
????
????%for?each?gridwe?create?their?mapping?function
????for?i=1:grid_cols
????????for?j=1:grid_rows
????????????map(ij:)=MakeHistogram(img1+(i-1)*grid_width1+(j-1)*grid_heightgrid_widthgrid_heightlimit);?
????????end
????end
????
????
%interpolate
%boundary?cases?I?followed?the?Karel?Zuiderveld‘s?implement(C?version)
xi?=?1;?
for?i?=?1:grid_cols+1?
????if?i?==?1?
????????subx?=?grid_width/2;?
????????xu?=?1;?
????????xd?=?1;?
????elseif?i?==?grid_cols+1?
????????subx?=?grid_width/2;?
????????xu?=??grid_cols;?
????????xd?=??grid_cols;?
????else?
????????subx?=?grid_width;?
????????xu?=?i?-?1;?
????????xd?=?i;?
????end?
????yi?=?1;?
????for?j?=?1:grid_rows+1
????????if?j?==?1?
????????????suby?=?grid_height/2;?
????????????yl?=?1;?
????????????yr?=?1;?
????????elseif?j?==?grid_rows+1
????????????suby?=?grid_height/2;?
????????????yl?=?grid_rows;?
????????????yr?=?grid_rows;?
????????else?
????????????suby?=?grid_height;?
????????????yl?=?j?-?1;?
????????????yr?=?j;?
????????end?
????????UL?=?map(xuyl:);?
????????UR?=?map(xuyr:);?
????????DL?=?map(xdyl:);?
????????DR?=?map(xdyr:);?
????????subimg?=?img(xi:xi+subx-1yi:yi+suby-1);?
????????subimg?=?Interpolate(subimgULURDLDRsubxsuby);?
????????img_new(xi:xi+subx-1yi:yi+suby-1)?=?subimg;?
????????yi?=?yi?+?suby;?
????end?
????xi?=?xi?+?subx;?
end?
????
????
????
????
????end
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-11-04?23:29??bonus2\
?????文件???????79888??2014-11-04?23:20??bonus2\ahe?16grids.jpg
?????文件??????140546??2014-11-04?23:20??bonus2\ahe?256grids.jpg
?????文件??????129478??2014-11-04?23:20??bonus2\ahe?64grids.jpg
?????文件??????100165??2014-11-04?23:20??bonus2\ahe?with?limit?150.jpg
?????文件??????114298??2014-11-04?23:20??bonus2\ahe?with?limit?300.jpg
?????文件??????129478??2014-11-04?23:20??bonus2\ahe?without?clipping.jpg
?????文件????????1930??2014-11-04?23:12??bonus2\ahe.asv
?????文件????????1779??2014-11-04?23:19??bonus2\ahe.m
?????文件??????105113??2014-11-04?23:20??bonus2\he.jpg
?????文件?????????882??2014-11-03?09:19??bonus2\he.m
?????文件?????????661??2014-11-04?23:12??bonus2\Interpolate.asv
?????文件?????????599??2014-11-04?23:20??bonus2\Interpolate.m
?????文件?????????548??2014-11-04?23:27??bonus2\main.asv
?????文件?????????546??2014-11-04?23:09??bonus2\main.m
?????文件????????1222??2014-11-02?17:24??bonus2\MakeHistogram.asv
?????文件????????1631??2014-11-04?22:52??bonus2\MakeHistogram.m
?????文件???????54649??2014-11-04?20:22??bonus2\source.jpg