% pdfbdenoiseimagethmt.m
% written by: Duncan Po
% Date: January 14, 2004
% Clean the noisy image using the model and state probabilities of the
% noisy image. The image is assumed to be square.
% Usage: cleanimage = pdfbdenoiseimage( model, stateprob, nvar, nc, imname, imformat)
% Inputs: model - model of the noisy image
% stateprob - state probabilities of the noisy image
% nvar - noise variance, normalized to the image range
% (ie. should be between 0 and 1)
% nc - noise variance in contourlet domain. Input '' if
% unknown
% imname - name of the image file
% imformat - format of the image file (e.g. 'gif')
% Output: cleanimage - the denoised image
function cleanimage = pdfbdenoiseimage( model, stateprob, nvar, nc, imname, imformat)
pyrfilter = '9-7';
dirfilter = 'pkva';
nlevel = model{1}.nlevels;
for lev = 1:nlevel
levndir(lev) = log2(length(model{1}.stdv{lev})*length(model));
end;
if nargin == 6
coef = contourlet(pyrfilter, dirfilter, levndir, imname, imformat);
elseif nargin == 5
coef = contourlet(pyrfilter, dirfilter, levndir, imname);
end;
% Verify image is square and obtain image dimensions
[nrow, ncol] = size(coef{2}{1});
imagestats = imfinfo(imname, imformat);
imdim = imagestats.Width;
if imdim ~= imagestats.Height
error('Image must be square.');
end
for state = 1:size(stateprob{1}{1},2)
for lev = 1:nlevel+1
newstateprob{state}{lev} = [];
covariance{state}{lev} = [];
end;
end;
% process stateprob, and covariance so that it has the same structure as coef
for state = 1:size(stateprob{1}{1},2)
for dir = 1:2.^levndir(1)
for scale = 1:length(stateprob{dir})
tempsp{scale} = stateprob{dir}{scale}(:,state);
end;
tempstateprob = tree2contourlet(tempsp, dir, levndir, nrow, ncol);
for lev = 1:nlevel
newstateprob{state}{lev+1} = [newstateprob{state}{lev+1} tempstateprob{lev}];
for subdir = 1:length(model{dir}.stdv{lev})
covariance{state}{lev+1} = [covariance{state}{lev+1} ...
{ones(size(coef{lev+1}{(dir-1)*(2.^(levndir(lev)-levndir(1)))+subdir},1),...
size(coef{lev+1}{(dir-1)*(2.^(levndir(lev)-levndir(1)))+subdir},2))*...
model{dir}.stdv{lev}{subdir}(state)*model{dir}.stdv{lev}{subdir}(state)}];
end;
end;
end;
end;
% calculates the noise variance in contourlet domain
if isempty(nc)
nc = contournc(nvar, pyrfilter, dirfilter, levndir, imdim);
end;
% computes the attenuator for each coefficient and state
for state = 1:length(covariance)
for lev = 2:nlevel+1
for dir = 1:length(covariance{state}{lev})
[covrow, covcol] = size(covariance{state}{lev}{dir});
covariance{state}{lev}{dir}=max(covariance{state}{lev}{dir}...
-nc{lev}{dir}, zeros(covrow, covcol))./covariance{state}{lev}{dir};
end;
end;
end;
% multiplies each contourlet coefficient with its corresponding state probabilities
for state = 1:length(newstateprob)
for lev = 2:nlevel+1
for dir = 1:length(newstateprob{state}{lev})
newcoef{state}{lev}{dir} = newstateprob{state}{lev}{dir}...
.*coef{lev}{dir};
end;
end;
end;
% we don't denoise the scaling function since its SNR is high
cleancoef{1} = coef{1};
% initialize the clean coefficients
for lev = 2:nlevel+1
for dir = 1:length(newstateprob{state}{lev})
cleancoef{lev}{dir} = zeros(size(coef{lev}{dir},1), size(coef{lev}{dir},2));
end;
end;
% denoise
for state = 1:length(newstateprob)
for lev = 2:nlevel+1
for dir = 1:length(newstateprob{state}{lev})
cleancoef{lev}{dir}=cleancoef{lev}{dir}+covariance{state}{lev}{dir}...
.*newcoef{state}{lev}{dir};
end;
end;
end;
cleanimage = pdfbrec(cleancoef, pyrfilter, dirfilter);
figure;
imshow(uint8(cleanimage));
没有合适的资源?快使用搜索试试~ 我知道了~
HMT-Hidden-Markov-Contourlet隐马尔科夫树模型,用于计算图像的Contourlet系数
共72个文件
m:21个
cc:11个
mexsol:7个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 185 浏览量
2022-04-15
23:40:32
上传
评论
收藏 2.94MB ZIP 举报
温馨提示
HMT-Hidden-Markov-Contourlet隐马尔科夫树模型,用于计算图像的Contourlet系数
资源推荐
资源详情
资源评论
收起资源包目录
HMT-Hidden-Markov-Contourlet隐马尔科夫树模型,用于计算图像的Contourlet系数.zip (72个子文件)
HMT-Hidden-Markov-Contourlet隐马尔科夫树模型,用于计算图像的Contourlet系数
pdfbgen_tdata.mexsol 234KB
pdfbprotrain_thmt.cc 3KB
tree.hh 2KB
load_pdfbmodel_from_file.mexa64 221KB
pdfbflip_model.m 2KB
load_pdfbimagemodel.m 1KB
pdfbcalc_KLD.mexmac 836KB
generate_model.m 1KB
dump_pdfbmodel_to_file.mexglx 217KB
pdfbthmt.cc 41KB
pdfbtrain_thmt.cc 4KB
pdfbtrain_thmt.mexsol 235KB
type4detransform.m 404B
contournc.m 1KB
pdfbtrainthmt.m 3KB
pdfbdenoiseimage.m 4KB
pdfbthmt.hh 5KB
pdfbest_KLD.mexglx 234KB
pdfbtrain_thmt.mexglx 222KB
pdfbtrain_thmt.mexw32 48KB
pdfbcalc_KLD.mexw32 40KB
pdfbprotrain_thmt.mexa64 224KB
pdfbtestall_imagekld.m 2KB
load_pdfbmodel_from_file.mexglx 217KB
pdfbcreate_equiv_models.m 814B
pdfbest_KLD.mexa64 233KB
pdfbtrain_thmt.mexa64 224KB
matrix.hh 704B
utils.cc 2KB
pdfbgen_tdata.cc 2KB
type3detransform.m 332B
pdfbtrain_thmt.mexmac 828KB
pdfbcalc_KLD.mexglx 234KB
dump_pdfbmodel_to_file.mexmac 824KB
tree.cc 4KB
utils.hh 5KB
pdfbcalc_KLD.cc 2KB
load_pdfbmodel_from_file.cc 2KB
dump_pdfbimagemodel.m 507B
pdfbprotrain_thmt.mexmac 828KB
makenoise.m 1KB
dump_pdfbmodel_to_file.mexsol 225KB
type4transform.m 360B
pdfbcalc_KLD.mexsol 240KB
contourlet.m 939B
pdfbgen_tdata.mexmac 824KB
dump_pdfbmodel_to_file.cc 2KB
pdfbprotrain_thmt.mexsol 235KB
pdfbclassify_texture.m 2KB
pdfbgen_tdata.mexa64 224KB
load_pdfbmodel_from_file.mexmac 828KB
load_pdfbmodel_from_file.mexw32 40KB
pdfbest_KLD.mexsol 240KB
pdfbest_KLD.mexw32 48KB
pdfbgentdata.m 572B
pdfbgen_tdata.mexw32 40KB
load_pdfbmodel_from_file.mexsol 225KB
contourlet2tree.m 2KB
pdfbprotrain_thmt.mexw32 48KB
readme 5KB
pdfbgen_tdata.mexglx 218KB
pdfbcalc_imagekld.m 3KB
dump_pdfbmodel_to_file.mexa64 221KB
pdfbcalc_KLD.mexa64 233KB
pdfbest_KLD.mexmac 836KB
tree2contourlet.m 2KB
pdfbprotrain_thmt.mexglx 222KB
pdfbest_KLD.cc 2KB
pdfbtrainimagethmt.m 1KB
matrix.cc 5KB
dump_pdfbmodel_to_file.mexw32 40KB
type3transform.m 290B
共 72 条
- 1
资源评论
wouderw
- 粉丝: 268
- 资源: 2960
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功