小波实验报告双树复小波变换

合集下载

基于双树复小波变换的图像去噪的开题报告

基于双树复小波变换的图像去噪的开题报告

基于双树复小波变换的图像去噪的开题报告一、选题背景随着数字图像技术的发展,图像噪声问题成为了图像处理领域中的一个重要问题,尤其是在数字信号传输、数字摄影、数字视频压缩等领域中,图像噪声问题更是不可避免。

因此,图像去噪技术成为了图像处理领域中的研究热点问题之一。

在现代图像处理技术中,基于小波变换的去噪技术已经被广泛应用。

小波变换方法可以将图像数据通过一定的方法进行变换,使得信号特征得到更好的表现,同时还可以减小信号噪声的影响。

但是在实际应用中,小波变换的去噪方法也存在一定的缺陷,如对于高斯噪声和脉冲噪声效果并不理想等。

为了解决小波变换方法的缺陷,研究人员提出了双树复小波变换去噪方法。

双树复小波变换是小波变换的一种扩展方法,其能够提供更好的信号描述力和更准确的信号特征表示。

因此,双树复小波变换在图像处理领域中具有较高的研究价值和应用前景。

二、研究目的本研究的目的是探究基于双树复小波变换的图像去噪方法,研究双树复小波变换的原理及实现方法,对其进行分析、优化和改进,提出一种基于双树复小波变换的图像去噪算法,并进行实验验证,以提高图像噪声去除的效率和精度。

三、研究内容1. 双树复小波变换的原理与实现方法的研究双树复小波变换是对小波变换的扩展方法,该方法采用双树结构和复数扩展,能够更好地描述信号特征。

本研究将学习双树复小波变换的原理,介绍其在信号处理中的优劣势,并实现其算法。

2. 基于双树复小波变换的图像去噪算法的设计在研究双树复小波变换的基础上,本研究将探讨其在图像处理中的应用,并设计一种基于双树复小波变换的图像去噪算法,该算法能够有效消除噪声影响并保持图像细节特征。

3. 基于算法的实验验证在算法设计完成后,本研究将进行实验验证。

该实验将采用一系列有噪图像,分别对比本算法与其他常见的基于小波变换的图像去噪算法,包括小波软阈值去噪算法、小波硬阈值去噪算法等,分析其去噪效果、处理速度等指标,并比较其优缺点。

四、研究意义1. 提高图像去噪的效率和精度,满足实际应用需要双树复小波变换能够提供更好的信号特征描述能力,因此在图像去噪中具有一定优势。

基于双树复小波变换的心电信号去噪研究

基于双树复小波变换的心电信号去噪研究
t r e e c o mp l e x wa v e l e t t r a n s f o m r c a n be u s e d a s a n e w d e no i s i n g me t h o d f o r b i o me d i c a l s i g n l a d e no i s i n g p r o c e s s i n g . Ke y wo r d s:d u a l — t r e e c o mp l e x wa v e l e t t r a n s f o m ; r ECG s i na g l; ma xi mu m a p o s t e r i o r i e s t i ma t i o n; d i s c r e t e wa v e l e t t r ns a —
i n g, a n e w ECG s i na g l d e n o i s i n g a l g o it r h m i s p r e s e n t e d, wh i c h i s b a s e d o n d u l— a t r e e c o mp l e x wa v e l e t t r a n s f o r m a n d c o mb i n e d wi 山 t h e ma x i mu m a p o s t e r i o r i e s t i ma t i o n t o d e t e r mi n e t he t h r e s h o l d. Th e s i g na l— t o — n o i s e r a t i o nd a me a n s q u a r e e r r o r re a u s e d t o e v a l u a t e t h e d e n o i s i n g e f f e c t s o f t h e d u l- a t r e e c o mp l e x wa v e l e t t r a n s f o m r a n d d i s c r e t e wa v e l e t t r a n s f o m . r h e T e x p e r i me n t l a r e s u l t s h o ws t ha t c o mp a r e d wi t h t r a d i t i o na l d i s c r e t e wa v e l e t t r ns a f o m , r t h e d ua l- t r e e t o m—

双树复小波变换

双树复小波变换

E HRStffI i N r A a«VT创新助手报告——主题分析报告创新助手平台提供北京万方软件股份有限公司Array2014-07-10报告目录报告核心要素 ....................................................... I.一、主题简介 ...................................................... 1.二、主题相关科研产出总体分析 (1)2.1文献总体产出统计 (1)2.2学术关注趋势分析 (2)三、主题相关科技论文产出分析 (2)3.1中文期刊论文................................................ 2.3.1.1近十年中文期刊论文分布列表 (2)3.1.2中文期刊论文增长趋势 (3)3.1.3发文较多期刊 (4)3.1.4发文较多的机构 (4)3.1.5发文较多的人物 (4)3.1.6核心期刊分布数量对比 (4)3.1.7最近相关中文期刊论文 (5)3.1.8被引较多的相关期刊论文 (6)3.2学位论文.................................................... 7.3.2.1近十年学位论文年代分布列表 (7)3.2.2学位论文增长趋势 (8)3.2.3硕博学位论文数量对比 (8)3.2.4发文较多的机构 (9)3.2.5发文较多的人物 (9)3.2.6最近相关学位论文 (9)3.3中文会议论文 (10)3.3.1近十年中文会议论文年代分布列表 (10)3.3.2中文会议论文增长趋势................................. 1.13.3.3中文会议论文主办单位分布............................. 1 13.3.4发文较多的机构....................................... 1.23.3.5发文较多的人物....................................... 1.23.3.6最近相关中文会议论文................................. 1.33.4外文期刊论文 (13)3.4.1近十年外文期刊论文年代分布列表 (13)3.4.2外文期刊论文增长趋势................................. 1.43.4.3最近相关外文期刊论文 (14)3.5外文会议论文 (15)。

基于双密度双树复小波变换的图像压缩

基于双密度双树复小波变换的图像压缩

Image Compression Based on Dual Density Dual Tree Complex Wavelet Transform
Wanshe Li, Ruizhi Zhu
School of Mathematics and Information Science, Shaanxi Normal University, Xi’an Shaanxi Received: Nov. 27 , 2018; accepted: Dec. 13 , 2018; published: Dec. 20 , 2018
Open Access
1. 引言
近年来,信息技术和移动通讯的爆炸式发展,使得图像数据的传送有了海量的增长,伴随着高清和 超清图像视频的普及,图像压缩编码技术发挥着越来越重要的作用。图像压缩[1]是在确保图像质量的基 本要求下,实现尽可能大幅度地减小图像的数据量,当图像本身的数据大比例降低了,它的传输和存储 就变得方便容易得多。 小波变换的图像压缩编码方法是先通过小波变换对图像进行多分辨率分解得到不同空间且不同频率 的一系列子图像,再对所得的子图像分别进行系数编码。小波基函数的选择是其中关键的内容,选择不 同的小波基函数来进行图像压缩所取得的压缩效果一般都不一样,本论文的研究中选择的是以双密度双 树复小波变换作为小波基函数。 小波变换[2]在频域以及时域上有着良好的局部化特性,同时能够把图像数据信息定位至任意数量级 的精度上。正是因为这些优点,基于小波变换的图像压缩编码方法逐渐发展并取代了传统的基于离散余 弦变换和其他子带编码技术,成为当今应用广泛并且有着可观发展前景的数据压缩方法。
th th th
Abstract
With the rapid development of multimedia information technology, the extremely large image data is produced. When these massive image data are stored and transmitted, it is necessary to use image compression coding technology to reduce the amount of data. The purpose of this study is to find a method of a better quality of compressed image. The paper is based on the theory of wavelet transform and image compression, and an image compression method based on dual-density dual-tree complex wavelet transform is proposed. According to MATLAB simulation, experimental results are given. Finally, it is confirmed that this method has obvious optimization compared with the traditional image compression method for image compression quality.

基于双树复小波变换的图像检索新算法

基于双树复小波变换的图像检索新算法

基于双树复小波变换的图像检索新算法舒彬【摘要】本文研究了一种双树复小波变换的图像形状特征检索算法。

第一步,利用双树复小波对原图像进行变换,取各层的2个低频子图像,分别求出它们的模极大值的平均值和原图像的模极大值的平均值;第二步,将它们分别作为下一层的阈值,找出每层的边缘图像;第三步,通过计算不变矩之间的欧式距离,查询出与原图相似的图像。

实验结果表明,此算法的检索效率比canny算子的算法和Mallt小波变换的算法都高。

【期刊名称】《产业与科技论坛》【年(卷),期】2016(015)009【总页数】2页(P57-58)【关键词】双树复小波变换;模极大值;动态阈值;不变矩;图像检索【作者】舒彬【作者单位】陕西学前师范学院【正文语种】中文形状是图像最基本的特征之一。

提取形状特征对图像进行检索,是一种很重要的方法。

因为具有很强的多尺度分析能力[1]和非常良好的时频局域化性质,从而使双树复小波变换很适合检测目标图像的概貌和微小的细节。

表述形状特征的时候[2],表示它们的描述符应该具备如下优点:旋转、平移和尺度不变形等。

尽管对于描述物体形状的方法有很多,可它们大多给的结论不详细,对边缘的表述不好理解。

基于此,本文研究了利用双树复小波变换对图像的形状特征进行检索的算法。

在信号分析中,如果用离散小波变换分析形状特征的话,非常微小的平移,便会引起小波系数在不同尺度上的很大差异,尽管形状相同的两个物体,产生的形状特征向量却不相同。

它缺乏方向选择性,弱化了其它方向的信息,从而丢失了一些重要的信息[3]。

为了克服这些问题,Kingsbury等人提出了双树复小波变换(Dual-tree Complex Wavelet Transform,DT-CWT)[4]。

双树复小波变换采用两个实小波可称为树A 和树B。

其中上部树A表示变换的实部,下部树B表示变换的虚部。

树A及树B 变换采用两个不同的滤波器集合,它们都符合重建条件。

假设h0(n)表示树A对应的滤波器组的低通滤波器对,h1(n)表示高通滤波器对,g0(n)表示树B对应的滤波器组的低通滤波器对,g1(n)表示高通滤波器对。

双树复小波变换

双树复小波变换

双树复小波变换
双树复小波变换(Dual-Tree Complex Wavelet Transforms, DT-CWT)是一种
为定位有用的(directional)信号分析中的关键技术,它利用相同的波形分解加
以微调,除了满足基于小波的特征分析需求外,还采取双树的结构,以确保理论预期的增益。

DT-CWT具有一种较强的完整性(coherence),可以有效地捕获复杂的
频率特征,即使是在低频域存在噪声的情况下仍可突出高频特征,因此受到了广泛的关注。

DT-CWT具有若干优势,如它有良好的分辨率,可以提取频带范围较窄的信号;具有几乎抗磁性的鲁棒性,能够具备良好的微弱信号抽取性能;另外它还具有优越的均衡性,可以很好地处理数据不均匀性,实现对复杂应用场景的有效建模;其次,它能够有效识别一时间周期分量,从而进一步提高定位能力。

作为一种基于实值小波变换的先进技术,DT-CWT非常适用于图像处理过程,
能够满足不同信号处理任务的要求,如图像压缩、图像分类、图像定位及图像剪裁等,为图像处理中高精度的实现奠定了基础。

DT-CWT在其他领域的应用也同样引
起了广泛的关注,如信号处理中定位低频信号、改善医学影像质量及构建语音自动识别系统等应用都能体现出其决定性的作用。

可以看出,DT-CWT不仅是一种简单有效的信号分析工具,而且对复杂信号处
理有着广泛的应用前景,未来估计可期预料其研究范围和领域的进一步扩大。

基于双密度双树复小波变换的目标检测和跟踪算法研究的开题报告

基于双密度双树复小波变换的目标检测和跟踪算法研究的开题报告

基于双密度双树复小波变换的目标检测和跟踪算法研究的开题报告一、选题背景目标检测和跟踪是计算机视觉领域的重要研究方向之一。

在实际应用中,它们广泛应用于智能监控、自动驾驶、无人机、机器人等领域。

目标检测主要是通过对图像或视频进行处理,找出其中的感兴趣目标,而目标跟踪则是跟踪目标在连续帧中的位置和运动轨迹。

传统的目标检测和跟踪方法通常采用特征提取和分类器技术,这些方法已经取得了不错的效果,但是在面对复杂场景、目标形变和遮挡等问题时存在一定的局限性。

为了克服这些问题并提高检测和跟踪的效果,近年来涌现出了一些基于深度学习、卷积神经网络等技术的新方法。

本课题将针对目标检测和跟踪中存在的问题,探讨一种基于双密度双树复小波变换的新方法。

该方法结合了小波变换和复小波变换的优势,可以提高图像处理的精度和速度,同时保持较好的图像局部特征。

二、研究内容本课题的主要研究内容包括以下方面:1.研究双密度双树复小波变换的理论和算法,了解其优势和局限性。

2.基于双密度双树复小波变换构建目标检测和跟踪模型,实现对感兴趣的目标的提取和跟踪。

3.对模型进行优化和测试,对比传统的目标检测和跟踪方法的效果,并对模型的性能进行评估和改进。

4.设计相关实验,验证方法的实用性和效果,并对实验结果进行分析和总结。

三、研究意义本课题采用基于双密度双树复小波变换的目标检测和跟踪方法,有以下研究意义:1.充分发掘小波变换和复小波变换的优势和特点,提高图像处理的精度和速度。

2.优化传统的目标检测和跟踪方法,提高检测和跟踪的成功率和鲁棒性。

3.扩展目标检测和跟踪的应用领域,使其在智能监控、自动驾驶、无人机、机器人等领域更具实用性。

四、研究方法本课题主要采用实验法和分析法进行研究,具体方法如下:1.收集本领域的相关文献和数据集,对相关技术进行深入了解和研究,为构建目标检测和跟踪模型提供理论支持。

2.设计双密度双树复小波变换的目标检测和跟踪模型,并优化模型框架和参数,提高检测和跟踪的准确性和鲁棒性。

基于双树复数小波的图像去噪-毕业论文

基于双树复数小波的图像去噪-毕业论文

---文档均为 word 文档,下载后可直接编辑使用亦可打印-要噪声抑制是任何图像处理任务的组成部分,噪声会显着降低图像质量,因此使观察者难以区分图像的细节,特别是在诊断检查中。

经过几十年的研究,已经提出了大量关于图像去噪的方法。

通过使用空间滤波或变换域滤波,可以减少图像中噪声的影响。

在变换域小波方法中,提供更好的去噪效果,同时保留像边缘那样的图像细节。

离散小波变换具有一些缺点,即由于缺乏移位不变性和较差的方向选择性,导致其在图像处理中的应用尚未确定。

为了克服这些缺点,使用了双树复数小波变换,其在传统的小波变换上提供了完美的重构。

它使用 2 个离散实小波变换;第一个离散实小波变换给出了变换的实部,而第二个离散实小波变换给出了变换的虚部。

它在二维和更高维度上有限的冗余几乎是不变和定向选择性的。

双树复数小波变换在图像去噪和增强等应用方面优于离散小波变换。

双树复数小波变换的优点之一是它可用于实现比二维离散小波变换方向更具选择性的二维小波变换。

二维双树复数小波在每个尺度上产生十二个子带,每一个都以不同的角度精确定位。

关键词:图像;去噪;双树复数小波;阈值ABSTRACTNoise suppression is an integral part of any image processing task. Noisesignificantly degrades the image quality and hence makes it difficult for the observer todiscriminate fine detail of the images especially in diagnostic examinations. Throughdecades of research, a lot of methods on image denoising have been proposed .Theeffect of noise in the images can be reduced by using either spatial filtering or transformdomain filtering. In transform domain, the wavelet method provides better denoisingeffect while preserving the details of images like edges. The Discrete WaveletTransform (DWT) has some disadvantages that undetermined its application in imageprocessing as lack of shift invariance and poor directional selectivity. In order toovercome these disadvantages Dual Tree Complex Wavelet Transform (DT-CWT) isused which provide perfect reconstruction over the traditional wavelet transform. Itemploys 2 real DWTs; the first DWT gives the real part of the transform while secondDWT gives the imaginary part. It is nearly shift invariant and directionally selective intwo and higher dimensions with limited redundancy. The DTCWT outperforms theDWT for applications like image denoising and enhancement. One of the advantagesof the DTCWT is that it can be used to implement 2D wavelet transforms that are moreselective with respect to orientation than is the 2D DWT. The 2D DTCWT producestwelve sub-bands at each scale, each of which are strongly oriented at distinct angles.Keywords: image ; denoising ; Dual Tree Complex wavelet; threshold前言近年来小波变换的快速发展,尤其是双树复数小波,很大程度上提升了图像处理算法的优化,双树复数小波最显著的优点是具有近似的平移不变性和更多的方向选择性。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

一、题目:双树复小波变换二、目的:双树复小波和实小波变换的比较三、算法及其实现:提取阶梯型边界点1.算法。

幅值:相位:2.代码实现。

我采用Matlab函数编程实现。

具体程序见shift_test_2D.m,drawcirc.m,setfig.m,dtwavexfm2.m,dtwaveifm2.m,waveifm2.m,wavexfm2.mSkelMap.m。

设和分别是双正交对偶尺度函数与对偶小波,,,和实部:虚部:双树复小波变换可以通过离散小波变换DWT实现:一个DWT产生实部,另一个产生虚部。

四、实现工具:Matlab五、程序代码:(1)shift_test_2D.m:% shift_test_2D.m%% M-file to perform a 4-level wavelet transform on a circle using Q-shift% dual wavelet tree and DWT, and to compare shift invariance properties.%% Nick Kingsbury, Cambridge University, May 2002.clear allclose all% Draw a circular disc.x = round((drawcirc(64,1,0,0,256) - 0.5) * 200);setfig(1);colormap(gray(256))image(min(max(x+128,1),256));set(gca,'position',[0.1 0.25 .25 .5]);()ctψ=,,j,c h gf fψψψ=+|(,)|cd j n=(,)arctan(,)gchd j nd j n∠= ⎪⎝⎭,h hφφ%,h hψψ%()h n()h n%()1h n()1h n%11()()(2)()()(2)()()(2)()()(2)h hnh hnh hnh hnt h n t nt h n t nt h n t nt h n t nφφψφφφψφ=-=-=-=-%%%%%%11()()(2)()()(2)()()(2)()()(2)g gng gng gng gnt g n t nt g n t nt g n t nt g n t nφφψφφφψφ=-=-=-=-%%%%%%axis('off');axis('image');% draw(xx);title('Input (256 x 256)','FontSize',14); drawnow% Do 4 levels of CWT.[Yl,Yh] = dtwavexfm2(x,4,'near_sym_b','qshift_b');% Loop to reconstruct output from coefs at each level in turn.% Starts with the finest level.titl = ['1st';'2nd';'3rd';'4th';'Low'];yy = zeros(size(x) .* [2 3]);yt1 = 1:size(x,1); yt2 = 1:size(x,2);for mlev = 1:5,mask = zeros(6,5);mask(:,mlev) = 1;z = dtwaveifm2(Yl*mask(1,5),Yh,'near_sym_b','qshift_b',mask);figure;draw(z);drawnowyy(yt1,yt2) = z;yt2 = yt2 + size(x,2)/2;end% disp('Press a key ...')% pause% Now do same with DWT.% Do 4 levels of Real DWT using 'antonini' (9,7)-tap filters. [Yl,Yh] = wavexfm2(x,4,'antonini');yt1 = [1:size(x,1)] + size(x,1); yt2 = 1:size(x,2);for mlev = 1:5,mask = zeros(3,5);mask(:,mlev) = 1;z = waveifm2(Yl*mask(1,5),Yh,'antonini',mask);figure;draw(z);drawnowyy(yt1,yt2) = z;yt2 = yt2 + size(x,2)/2;endfigure;setfig(gcf);colormap(gray(256))image(min(max(yy+128,1),256));set(gca,'position',[0.1 0.1 .8 .8]);axis('off');axis('image');hold onplot(128*[[1;1]*[1:4] [0;6]]+1,128*[[0;4]*[1 1 1 1] [2;2]]+1,'-k');hold offtitle('Components of reconstructed ''disc'' images','FontSize',14);text(-0.01*size(yy,2),0.25*size(yy,1),'DT CWT','horiz','r');text(0.02*size(yy,2),1.02*size(yy,1),'wavelets:','horiz','r','vert','t');text(-0.01*size(yy,2),0.75*size(yy,1),'DWT','horiz','r');for k=1:4, text(k*128-63,size(yy,1)*1.02,sprintf('level %d',k),'FontSize',14,'horiz','c','vert','t'); endtext(5*128+1,size(yy,1)*1.02,'level 4 scaling fn.','FontSize',14,'horiz','c','vert','t');drawnow% print -deps circrecq.epsdisp('Press a key to see perfect reconstruction property ...')pause% Accumulate the images from lowband upwards to show perfect reconstruction.sy = size(x,2)/2;for mlev = 4:-1:1,yt2 = [1:sy] + (mlev-1)*sy;yy(:,yt2) = yy(:,yt2) + yy(:,yt2+sy);endfigure;setfig(gcf);colormap(gray(256))image(min(max(yy+128,1),256));set(gca,'position',[0.1 0.1 .8 .8]);axis('off');axis('image');title('Accumulated reconstructions from each level of DT CWT ','FontSize',14);text(size(yy,2)*0.5,size(yy,1)*1.02,'Accumulated reconstructions from each level of DWT ','FontSize',14,'hor','c','vert','t');drawnowreturn(2)function p = drawcirc(r,w,dx,dy,N)% function p = drawcirc(r,w,dx,dy,N)% Generate an image of size N*N pels, containing a circle% radius r pels and centred at dx,dy relative% to the centre of the image. The edge of the circle is a cosine shaped% edge of width w (from 10 to 90% points).x = ones(N,1) * (([1:N] - (N+1)/2 - dx)/r);y = (([1:N]' - (N+1)/2 - dy)/r) * ones(1,N);p = 0.5 + 0.5 * sin(min(max((exp(-0.5 * (x + y )) - exp(-0.5))*(r*3/w), -pi/2), pi/2));return(3)function Z = dtwaveifm2(Yl,Yh,biort,qshift,gain_mask);% Function to perform an n-level dual-tree complex wavelet (DTCWT)% 2-D reconstruction.%% Z = dtwaveifm2(Yl,Yh,biort,qshift,gain_mask);%% Yl -> The real lowpass image from the final level% Yh -> A cell array containing the 6 complex highpass subimages for each level.%% biort -> 'antonini' => Antonini 9,7 tap filters.% 'legall' => LeGall 5,3 tap filters.% 'near_sym_a' => Near-Symmetric 5,7 tap filters.% 'near_sym_b' => Near-Symmetric 13,19 tap filters.%% qshift -> 'qshift_06' => Quarter Sample Shift Orthogonal (Q-Shift) 10,10 tap filters,% (only 6,6 non-zero taps).% 'qshift_a' => Q-shift 10,10 tap filters,% (with 10,10 non-zero taps, unlike qshift_06).% 'qshift_b' => Q-Shift 14,14 tap filters.% 'qshift_c' => Q-Shift 16,16 tap filters.% 'qshift_d' => Q-Shift 18,18 tap filters.%% gain_mask -> Gain to be applied to each subband.% gain_mask(d,l) is gain for subband with direction d at level l.% If gain_mask(d,l) == 0, no computation is performed for band (d,l).% Default gain_mask = ones(6,length(Yh)).%% Z -> Reconstructed real image matrix%%% For example: Z = dtwaveifm2(Yl,Yh,'near_sym_b','qshift_b');% performs a 3-level reconstruction from Yl,Yh using the 13,19-tap filters% for level 1 and the Q-shift 14-tap filters for levels >= 2.%% Nick Kingsbury and Cian Shaffrey% Cambridge University, May 2002a = length(Yh); % No of levels.if nargin < 5, gain_mask = ones(6,a); end % Default gain_mask.if isstr(biort) & isstr(qshift) %Check if the inputs are stringsbiort_exist = exist([biort '.mat']);qshift_exist = exist([qshift '.mat']);if biort_exist == 2 & qshift_exist == 2; %Check to see if the inputs exist as .mat files load (biort);load (qshift);elseerror('Please enter the correct names of the Biorthogonal or Q-Shift Filters, see help DTW A VEIFM2 for details.');endelseerror('Please enter the names of the Biorthogonal or Q-Shift Filters as shown in help DTW A VEIFM2.');endcurrent_level = a;Z = Yl;while current_level >= 2; ; %this ensures that for level -1 we never do the following lh = c2q(Yh{current_level}(:,:,[1 6]),gain_mask([1 6],current_level));hl = c2q(Yh{current_level}(:,:,[3 4]),gain_mask([3 4],current_level));hh = c2q(Yh{current_level}(:,:,[2 5]),gain_mask([2 5],current_level));% Do even Qshift filters on columns.y1 = colifilt(Z,g0b,g0a) + colifilt(lh,g1b,g1a);y2 = colifilt(hl,g0b,g0a) + colifilt(hh,g1b,g1a);% Do even Qshift filters on rows.Z = (colifilt(y1.',g0b,g0a) + colifilt(y2.',g1b,g1a)).';% Check size of Z and crop as required[row_size col_size] = size(Z);S = 2*size(Yh{current_level-1});if row_size ~= S(1) %check to see if this result needs to be cropped for the rows Z = Z(2:row_size-1,:);endif col_size ~= S(2) %check to see if this result needs to be cropped for the cols Z = Z(:,2:col_size-1);endif any(size(Z) ~= S(1:2)),error('Sizes of subbands are not valid for DTW A VEIFM2');endcurrent_level = current_level - 1;endif current_level == 1;lh = c2q(Yh{current_level}(:,:,[1 6]),gain_mask([1 6],current_level));hl = c2q(Yh{current_level}(:,:,[3 4]),gain_mask([3 4],current_level));hh = c2q(Yh{current_level}(:,:,[2 5]),gain_mask([2 5],current_level));% Do odd top-level filters on columns.y1 = colfilter(Z,g0o) + colfilter(lh,g1o);y2 = colfilter(hl,g0o) + colfilter(hh,g1o);% Do odd top-level filters on rows.Z = (colfilter(y1.',g0o) + colfilter(y2.',g1o)).';endreturn%==================================================================== ======================% ********** INTERNAL FUNCTION **********%==================================================================== ======================function x = c2q(w,gain)% function z = c2q(w,gain)% Scale by gain and convert from complex w(:,:,1:2) to real quad-numbers in z. %% Arrange pixels from the real and imag parts of the 2 subbands% into 4 separate subimages .% A----B Re Im of w(:,:,1)% | |% | |% C----D Re Im of w(:,:,2)sw = size(w);x = zeros(2*sw(1:2));if any(w(:)) & any(gain)sc = sqrt(0.5) * gain;P = w(:,:,1)*sc(1) + w(:,:,2)*sc(2);Q = w(:,:,1)*sc(1) - w(:,:,2)*sc(2);t1 = 1:2:size(x,1);t2 = 1:2:size(x,2);% Recover each of the 4 corners of the quads.x(t1,t2) = real(P); % a = (A+C)*sc;x(t1,t2+1) = imag(P); % b = (B+D)*sc;x(t1+1,t2) = imag(Q); % c = (B-D)*sc;x(t1+1,t2+1) = -real(Q); % d = (C-A)*sc;endreturn(3)function [Yl,Yh,Yscale] = dtwavexfm2(X,nlevels,biort,qshift);% Function to perform a n-level DTCWT-2D decompostion on a 2D matrix X %% [Yl,Yh,Yscale] = dtwavexfm2(X,nlevels,biort,qshift);%% X -> 2D real matrix/Image%% nlevels -> No. of levels of wavelet decomposition%% biort -> 'antonini' => Antonini 9,7 tap filters.% 'legall' => LeGall 5,3 tap filters.% 'near_sym_a' => Near-Symmetric 5,7 tap filters.% 'near_sym_b' => Near-Symmetric 13,19 tap filters.%% qshift -> 'qshift_06' => Quarter Sample Shift Orthogonal (Q-Shift) 10,10 tap filters,% (only 6,6 non-zero taps).% 'qshift_a' => Q-shift 10,10 tap filters,% (with 10,10 non-zero taps, unlike qshift_06).% 'qshift_b' => Q-Shift 14,14 tap filters.% 'qshift_c' => Q-Shift 16,16 tap filters.% 'qshift_d' => Q-Shift 18,18 tap filters.%%% Yl -> The real lowpass image from the final level% Yh -> A cell array containing the 6 complex highpass subimages for each level.% Yscale -> This is an OPTIONAL output argument, that is a cell array containing% real lowpass coefficients for every scale.%%% Example: [Yl,Yh] = dtwavexfm2(X,3,'near_sym_b','qshift_b');% performs a 3-level transform on the real image X using the 13,19-tap filters% for level 1 and the Q-shift 14-tap filters for levels >= 2.%% Nick Kingsbury and Cian Shaffrey% Cambridge University, Sept 2001if isstr(biort) & isstr(qshift) %Check if the inputs are stringsbiort_exist = exist([biort '.mat']);qshift_exist = exist([qshift '.mat']);if biort_exist == 2 & qshift_exist == 2; %Check to see if the inputs exist as .mat filesload (biort);load (qshift);elseerror('Please enter the correct names of the Biorthogonal or Q-Shift Filters, see help DTW A VEXFM2 for details.');endelseerror('Please enter the names of the Biorthogonal or Q-Shift Filters as shown in help DTW A VEXFM2.');endorginal_size = size(X);if ndims(X) >= 3;error(sprintf('The entered image is %dx%dx%d, please enter each image sliceseparately.',orginal_size(1),orginal_size(2),orginal_size(3)));end% The next few lines of code check to see if the image is odd in size, if so an extra ...% row/column will be added to the bottom/right of the imageinitial_row_extend = 0; %initialiseinitial_col_extend = 0;if any(rem(orginal_size(1),2)), %if sx(1) is not divisable by 2 then we need to extend X by adding a row at the bottomX = [X; X(end,:)]; %Any further extension will be done in due course.initial_row_extend = 1;endif any(rem(orginal_size(2),2)), %if sx(2) is not divisable by 2 then we need to extend X by adding a col to the leftX = [X X(:,end)]; %Any further extension will be done in due course.initial_col_extend = 1;endextended_size = size(X);if nlevels == 0, return; end%initialiseYh=cell(nlevels,1);if nargout == 3Yscale=cell(nlevels,1); %this is only required if the user specifies a third output component.endS = [];sx = size(X);if nlevels >= 1,% Do odd top-level filters on cols.Lo = colfilter(X,h0o).';Hi = colfilter(X,h1o).';% Do odd top-level filters on rows.LoLo = colfilter(Lo,h0o).'; % LoLoYh{1} = zeros([size(LoLo)/2 6]);Yh{1}(:,:,[1 6]) = q2c(colfilter(Hi,h0o).'); % Horizontal pairYh{1}(:,:,[3 4]) = q2c(colfilter(Lo,h1o).'); % Vertical pairYh{1}(:,:,[2 5]) = q2c(colfilter(Hi,h1o).'); % Diagonal pairS = [ size(LoLo) ;S];if nargout == 3Yscale{1} = LoLo;endendif nlevels >= 2;for level = 2:nlevels;[row_size col_size] = size(LoLo);if any(rem(row_size,4)), % Extend by 2 rows if no. of rows of LoLo are divisable by 4;LoLo = [LoLo(1,:); LoLo; LoLo(end,:)];endif any(rem(col_size,4)), % Extend by 2 cols if no. of cols of LoLo are divisable by 4;LoLo = [LoLo(:,1) LoLo LoLo(:,end)];end% Do even Qshift filters on rows.Lo = coldfilt(LoLo,h0b,h0a).';Hi = coldfilt(LoLo,h1b,h1a).';% Do even Qshift filters on columns.LoLo = coldfilt(Lo,h0b,h0a).'; %LoLoYh{level} = zeros([size(LoLo)/2 6]);Yh{level}(:,:,[1 6]) = q2c(coldfilt(Hi,h0b,h0a).'); % HorizontalYh{level}(:,:,[3 4]) = q2c(coldfilt(Lo,h1b,h1a).'); % VerticalYh{level}(:,:,[2 5]) = q2c(coldfilt(Hi,h1b,h1a).'); % DiagonalS = [ size(LoLo) ;S];if nargout == 3Yscale{level} = LoLo;endendendYl = LoLo;if initial_row_extend == 1 & initial_col_extend == 1;warning(sprintf(' \r\r The image entered is now a %dx%d NOT a %dx%d \r The bottom row and rightmost column have been duplicated, prior to decomposition. \r\r ',...extended_size(1),extended_size(2),orginal_size(1),orginal_size(2)));endif initial_row_extend == 1 ;warning(sprintf(' \r\r The image entered is now a %dx%d NOT a %dx%d \r Row number %d has been duplicated, and added to the bottom of the image, prior to decomposition. \r\r',...extended_size(1),extended_size(2),orginal_size(1),orginal_size(2),orginal_size(1)));endif initial_col_extend == 1;warning(sprintf(' \r\r The image entered is now a %dx%d NOT a %dx%d \r Col number %d has been duplicated, and added to the right of the image, prior to decomposition. \r\r',...extended_size(1),extended_size(2),orginal_size(1),orginal_size(2),orginal_size(2)));endreturn%==================================================================== ======================% ********** INTERNAL FUNCTION **********%==================================================================== ======================function z = q2c(y)% function z = q2c(y)% Convert from quads in y to complex numbers in z.sy = size(y);t1 = 1:2:sy(1); t2 = 1:2:sy(2);j2 = sqrt([0.5 -0.5]);% Arrange pixels from the corners of the quads into% 2 subimages of alternate real and imag pixels.% a----b% | |% | |% c----d% Combine (a,b) and (d,c) to form two complex subimages.p = y(t1,t2)*j2(1) + y(t1,t2+1)*j2(2); % p = (a + jb) / sqrt(2)q = y(t1+1,t2+1)*j2(1) - y(t1+1,t2)*j2(2); % q = (d - jc) / sqrt(2)% Form the 2 subbands in z.z = cat(3,p-q,p+q);return(4)function Z = dtwaveifm2(Yl,Yh,biort,qshift,gain_mask);% Function to perform an n-level dual-tree complex wavelet (DTCWT)% 2-D reconstruction.%% Z = dtwaveifm2(Yl,Yh,biort,qshift,gain_mask);%% Yl -> The real lowpass image from the final level% Yh -> A cell array containing the 6 complex highpass subimages for each level.%% biort -> 'antonini' => Antonini 9,7 tap filters.% 'legall' => LeGall 5,3 tap filters.% 'near_sym_a' => Near-Symmetric 5,7 tap filters.% 'near_sym_b' => Near-Symmetric 13,19 tap filters.%% qshift -> 'qshift_06' => Quarter Sample Shift Orthogonal (Q-Shift) 10,10 tap filters, % (only 6,6 non-zero taps).% 'qshift_a' => Q-shift 10,10 tap filters,% (with 10,10 non-zero taps, unlike qshift_06).% 'qshift_b' => Q-Shift 14,14 tap filters.% 'qshift_c' => Q-Shift 16,16 tap filters.% 'qshift_d' => Q-Shift 18,18 tap filters.%% gain_mask -> Gain to be applied to each subband.% gain_mask(d,l) is gain for subband with direction d at level l.% If gain_mask(d,l) == 0, no computation is performed for band (d,l). % Default gain_mask = ones(6,length(Yh)).%% Z -> Reconstructed real image matrix%%% For example: Z = dtwaveifm2(Yl,Yh,'near_sym_b','qshift_b');% performs a 3-level reconstruction from Yl,Yh using the 13,19-tap filters% for level 1 and the Q-shift 14-tap filters for levels >= 2.%% Nick Kingsbury and Cian Shaffrey% Cambridge University, May 2002a = length(Yh); % No of levels.if nargin < 5, gain_mask = ones(6,a); end % Default gain_mask.if isstr(biort) & isstr(qshift) %Check if the inputs are stringsbiort_exist = exist([biort '.mat']);qshift_exist = exist([qshift '.mat']);if biort_exist == 2 & qshift_exist == 2; %Check to see if the inputs exist as .mat files load (biort);load (qshift);elseerror('Please enter the correct names of the Biorthogonal or Q-Shift Filters, see help DTW A VEIFM2 for details.');endelseerror('Please enter the names of the Biorthogonal or Q-Shift Filters as shown in help DTW A VEIFM2.');endcurrent_level = a;Z = Yl;while current_level >= 2; ; %this ensures that for level -1 we never do the following lh = c2q(Yh{current_level}(:,:,[1 6]),gain_mask([1 6],current_level));hl = c2q(Yh{current_level}(:,:,[3 4]),gain_mask([3 4],current_level));hh = c2q(Yh{current_level}(:,:,[2 5]),gain_mask([2 5],current_level));% Do even Qshift filters on columns.y1 = colifilt(Z,g0b,g0a) + colifilt(lh,g1b,g1a);y2 = colifilt(hl,g0b,g0a) + colifilt(hh,g1b,g1a);% Do even Qshift filters on rows.Z = (colifilt(y1.',g0b,g0a) + colifilt(y2.',g1b,g1a)).';% Check size of Z and crop as required[row_size col_size] = size(Z);S = 2*size(Yh{current_level-1});if row_size ~= S(1) %check to see if this result needs to be cropped for the rows Z = Z(2:row_size-1,:);endif col_size ~= S(2) %check to see if this result needs to be cropped for the cols Z = Z(:,2:col_size-1);endif any(size(Z) ~= S(1:2)),error('Sizes of subbands are not valid for DTW A VEIFM2');endcurrent_level = current_level - 1;endif current_level == 1;lh = c2q(Yh{current_level}(:,:,[1 6]),gain_mask([1 6],current_level));hl = c2q(Yh{current_level}(:,:,[3 4]),gain_mask([3 4],current_level));hh = c2q(Yh{current_level}(:,:,[2 5]),gain_mask([2 5],current_level));% Do odd top-level filters on columns.y1 = colfilter(Z,g0o) + colfilter(lh,g1o);y2 = colfilter(hl,g0o) + colfilter(hh,g1o);% Do odd top-level filters on rows.Z = (colfilter(y1.',g0o) + colfilter(y2.',g1o)).';endreturn%==================================================================== ======================% ********** INTERNAL FUNCTION **********%==================================================================== ======================function x = c2q(w,gain)% function z = c2q(w,gain)% Scale by gain and convert from complex w(:,:,1:2) to real quad-numbers in z.%% Arrange pixels from the real and imag parts of the 2 subbands% into 4 separate subimages .% A----B Re Im of w(:,:,1)% | |% | |% C----D Re Im of w(:,:,2)sw = size(w);x = zeros(2*sw(1:2));if any(w(:)) & any(gain)sc = sqrt(0.5) * gain;P = w(:,:,1)*sc(1) + w(:,:,2)*sc(2);Q = w(:,:,1)*sc(1) - w(:,:,2)*sc(2);t1 = 1:2:size(x,1);t2 = 1:2:size(x,2);% Recover each of the 4 corners of the quads.x(t1,t2) = real(P); % a = (A+C)*sc;x(t1,t2+1) = imag(P); % b = (B+D)*sc;x(t1+1,t2) = imag(Q); % c = (B-D)*sc;x(t1+1,t2+1) = -real(Q); % d = (C-A)*sc;endreturn(5)function [Yl,Yh,Yscale] = wavexfm2(X,nlevels,biort);% Function to perform a n-level DWT-2D decompostion on a 2-D matrix X.%% [Yl,Yh,Yscale] = dtwavexfm2(X,nlevels,biort);%% X -> real 1-D signal column vector (or matrix of vectors)%% nlevels -> No. of levels of wavelet decomposition%% biort -> 'antonini' => Antonini 9,7 tap filters.% 'legall' => LeGall 5,3 tap filters.% 'near_sym_a' => Near-Symmetric 5,7 tap filters.% 'near_sym_b' => Near-Symmetric 13,19 tap filters.%% Yl -> The lowpass subband from the final level.% Yh -> A cell array containing the highpass subband for each level.% Yscale -> This is an OPTIONAL output argument, that is a cell array containing% the lowpass coefficients at every scale.%%% Example: [Yl,Yh] = wavexfm2(X,4,'near_sym_b');% performs a 4-level 2-D DWT on the real image X using the 13,19-tap filters.%% Nick Kingsbury, Cambridge University, May 2002if isstr(biort) % Check if the biort input is a stringbiort_exist = exist([biort '.mat']);if biort_exist == 2, % Check to see if the filter exists as a .mat fileload (biort);elseerror('Please enter the correct name of the Biorthogonal Filter, see help W A VEXFM2 for details.');endelseerror('Please enter the name of the Biorthogonal Filter as shown in help W A VEXFM2.');endL = size(X);if any(rem(L,2)), % ensure that X is an even length, thus enabling it to be extended if needs be.error('Size of X must be a multiple of 2');end%initialiseYh=cell(nlevels,1);if nargout == 3Yscale=cell(nlevels,1); % This is only required if the user specifies a third output component.endLoLo = X;for level = 1:nlevels;if rem(size(LoLo,1),4), % Check to see if height of LoLo is divisable by 4, if not extend.LoLo = [LoLo(1,:); LoLo; LoLo(end,:)];endif rem(size(LoLo,2),4), % Check to see if height of LoLo is divisable by 4, if not extend.LoLo = [LoLo(:,1) LoLo LoLo(:,end)];end% Do filters on rows.Lo = coldwtfilt(LoLo,h0o,0).';Hi = coldwtfilt(LoLo,h1o,1).';% Do filters on columns.LoLo = coldwtfilt(Lo,h0o,0).'; %LoLoYh{level} = zeros([size(LoLo) 3]);Yh{level}(:,:,1) = coldwtfilt(Hi,h0o,0).'; % HorizontalYh{level}(:,:,3) = coldwtfilt(Lo,h1o,1).'; % VerticalYh{level}(:,:,2) = coldwtfilt(Hi,h1o,1).'; % Diagonalif nargout == 3Yscale{level} = LoLo;endendYl = LoLo;return(6)function Z = waveifm2(Yl,Yh,biort,gain_mask);% Function to perform an n-level DWT 2-D reconstruction.%% Z = waveifm2(Yl,Yh,biort,gain_mask);%% Yl -> The real lowpass subband from the final level% Yh -> A cell array containing the complex highpass subband for each level.%% biort -> 'antonini' => Antonini 9,7 tap filters.% 'legall' => LeGall 5,3 tap filters.% 'near_sym_a' => Near-Symmetric 5,7 tap filters.% 'near_sym_b' => Near-Symmetric 13,19 tap filters.%% gain_mask -> Gain to be applied to each subband.% gain_mask(l) is gain for wavelet subband at level l.% If gain_mask(l) == 0, no computation is performed for band (l).% Default gain_mask = ones(1,length(Yh)).%% Z -> Reconstructed real signal vector (or matrix).%%% For example: Z = waveifm2(Yl,Yh,'near_sym_b');% performs a reconstruction from Yl,Yh using the 13,19-tap filters.%% Nick Kingsbury, Cambridge University, May 2002nlevels = length(Yh); % No of levels.if nargin < 4, gain_mask = ones(3,nlevels); end % Default gain_mask.if isstr(biort) % Check if the biort input is a stringbiort_exist = exist([biort '.mat']);if biort_exist == 2, % Check to see if the filter exists as a .mat fileload (biort);elseerror('Please enter the correct name of the Biorthogonal Filter, see help W A VEIFM2 for details.');endelseerror('Please enter the name of the Biorthogonal Filter as shown in help W A VEIFM2.');endLoLo = Yl;for level = nlevels:-1:1, % Reconstruct levels in reverse order.if size(LoLo,1) ~= size(Yh{level},1) % If LoLo is not the same height as the next Yh => t1 was extended.LoLo = LoLo(2:size(LoLo,1)-1,:); % Therefore we have to clip LoLo so it is the same height as the next Yh.endif size(LoLo,2) ~= size(Yh{level},2) % If LoLo is not the same width as the next Yh => t1was extended.LoLo = LoLo(:,2:size(LoLo,2)-1); % Therefore we have to clip LoLo so it is the same width as the next Yh.endif any([size(LoLo) 3] ~= size(Yh{level})),error('Yh sizes are not valid for WA VEIFM2');endlh = Yh{level}(:,:,1) * gain_mask(1,level);hl = Yh{level}(:,:,3) * gain_mask(3,level);hh = Yh{level}(:,:,2) * gain_mask(2,level);% Do even Qshift filters on columns.y1 = coliwtfilt(LoLo,2*g0o,0) + coliwtfilt(lh,2*g1o,1);y2 = coliwtfilt(hl,2*g0o,0) + coliwtfilt(hh,2*g1o,1);% Do even Qshift filters on rows.LoLo = (coliwtfilt(y1.',2*g0o,0) + coliwtfilt(y2.',2*g1o,1)).';endZ = LoLo;return(7)function setfig(f)% function setfig(f)% Set figure dimensions for correct display of text to agree with% print -deps.figure(f)set(gcf,'position',[220 40 790 526],'DefaultTextFontSize',14);return六、运行结果:七、结果分析:。

相关文档
最新文档