小波变换如何实现图像去噪——基于MATLAB的实践

        图像去噪是图像处理中的一个重要问题,它不仅影响图像的质量,也影响后续的图像分析和应用。传统的傅里叶变换去噪方法存在一些缺陷,如无法保持信号的时频局部性,无法描述信号的局部特征和频率变化等。为了解决这些问题,本文介绍了一种新的图像去噪方法——小波变换,它可以在不同的尺度上分析信号的时频特性,实现信号的多分辨率分解。本文首先介绍了小波变换的原理和方法,然后介绍了小波变换去噪的步骤和参数选择,最后展示了基于MATLAB的小波变换去噪的实例和效果。

图像去噪的运用

图像去噪的应用是一个具有重要理论和实际价值的研究领域,它不仅能提高图像的质量,也能为后续的图像处理和分析提供更好的基础。图 1 展示的便是图像去噪的部分应用:

图 1 图像去噪部分应用

小波去噪原理

大家都知道,傅里叶变换对于恒定的信号处理,效果是较好的,但是但凡出现了随时间变换而变换的信号,处理起来就会出现各频率的信号,如图 2 :

图 2 傅里叶变换处理随时间变换的信号

        但是如果把时域过程分解成无数等长的小过程,再进行傅里叶变换就知道随着时间变换的准确信号,这种思路就是短时傅里叶变化,但是短时傅里叶变换同样含有缺点,比如截的框太窄会出现频率分辨率太差,太宽会出现时间分辨率差的现象。

        所以小波去噪的由来便是为了解决传统的傅里叶变换去噪方法的问题,即无法保持信号的时域和频域局部性,也就是无法很好地描述信号的局部特征和频率变换。

        小波变换是一种能够在不同的尺度上分析信号的时频特性的方法,它可以通过伸缩和平移一个有限长的基函数来逼近信号,从而实现信号的多分辨率分解。

图 3 小波去噪原理图像

        下面便是连续小波变换的公式,如其名字通过一个小波来对整个信号逐段分析,利用一种有限长且能衰减的基函数,来对信号进行多尺度的分析和重构。小波变换的基函数可以通过伸缩和平移来逼近信号,从而实现信号的时频局部化。

图 4 连续小波变换原理

图 6 基本原理1

图 7 基础原理2

图 8 分解层数及代表部分

        小波变换去噪的参数选择主要包括以下几个:

  • 小波基函数的选择:小波基函数的选择会影响小波变换的性能和效果,不同的小波基函数有不同的特点和适用范围,比如Haar小波、一般来说,小波基函数应该具有良好的时频局部化、正交性和完备性等性质,以便更好地分析信号的特征和去除噪声。
  • 分解层数的选择:分解层数是一个重要的参数,它决定了小波变换的分解程度,从而影响了去噪效果。一般来说,分解层数越高,分解出的子信号就越细致,可以更好地揭示信号的局部特征。但是,分解层数过高也会导致信号的过度分解,使得信号的局部特征被过度强调,从而影响去噪效果。在实际应用中,我们通常需要根据信号的特点和噪声的强度来选择合适的分解层数。
  • 阈值选择方法的选择:阈值的选择是小波阈值去噪的关键,它决定了去噪的效果和性能。阈值的选择方法有很多,比如最小均方误差法。不同的阈值选择方法有不同的优缺点和适用条件,一般来说,阈值选择方法应该能够充分利用信号和噪声的统计特性,以便更好地区分信号和噪声的小波系数。

        对于离散小波变换中,通过小波变换对信号进行分解,分解层数是一个重要的参数,它决定了小波变换的分解程度,从而影响了去噪效果。一般来说,分解层数越高,分解出的子信号就越细致,可以更好地揭示信号的局部特征。但是,分解层数过高也会导致信号的过度分解,使得信号的局部特征被过度强调,从而影响去噪效果。

图 5 小波分解层数图像

        比如上图中,第三层和第四层是,高频分量已经出现了图像主题的边框,对后期处理的照片出现模糊现象。

        下面总结下传统方法和小波去噪:

图 6 传统方法和小波去噪总结

        下面便展示下自己做的GUI以及代码,较为简陋,代码也是比较勉强的:

图 7 GUI界面

小波变换去噪的总结和展望

        本文介绍了一种新的图像去噪方法——小波变换,它可以在不同的尺度上分析信号的时频特性,实现信号的多分辨率分解。本文首先介绍了小波变换的原理和方法,然后介绍了小波变换去噪的步骤和参数选择,最后展示了基于MATLAB的小波变换去噪的实例和效果。小波变换去噪的方法具有一些优点,如能够保持信号的时频局部性,能够描述信号的局部特征和频率变化等。小波变换去噪的方法在图像处理的各个领域都有广泛的应用,如语音、图像、生物医学、雷达等。本文的工作为图像去噪的研究提供了一种新的思路和方法,也为图像处理的其他问题提供了一种新的工具和技术。在未来的工作中,我们还可以进一步优化小波变换去噪的方法,比如选择更合适的小波基函数、阈值选择方法、阈值函数等,以提高图像去噪的效果和性能。

小波变换去噪的代码(APPdesigner

classdef Waveletdenoising < matlab.apps.AppBase

    % Properties that correspond to app components
    properties (Access = public)
        UIFigure             matlab.ui.Figure
        RightPanel           matlab.ui.container.Panel
        quzaotuxiang         matlab.ui.control.Image
        zaoshengtuxiang      matlab.ui.control.Image
        PSNRTextAreaLabel_4  matlab.ui.control.Label
        PSNRTextAreaLabel_3  matlab.ui.control.Label
        PSNRTextAreaLabel_2  matlab.ui.control.Label
        SSIM                 matlab.ui.control.TextArea
        SSIMTextAreaLabel    matlab.ui.control.Label
        PSNR                 matlab.ui.control.TextArea
        PSNRTextAreaLabel    matlab.ui.control.Label
        yuantu               matlab.ui.control.Image
        Image4               matlab.ui.control.Image
        LeftPanel            matlab.ui.container.Panel
        ButtonGroup_4        matlab.ui.container.ButtonGroup
        hunhe                matlab.ui.control.ToggleButton
        maichong             matlab.ui.control.ToggleButton
        jiaoyan              matlab.ui.control.ToggleButton
        gaosi                matlab.ui.control.ToggleButton
        ButtonGroup_2        matlab.ui.container.ButtonGroup
        wu55                 matlab.ui.control.RadioButton
        si                   matlab.ui.control.RadioButton
        san                  matlab.ui.control.RadioButton
        wu                   matlab.ui.control.RadioButton
        Tree                 matlab.ui.container.Tree
        Node                 matlab.ui.container.TreeNode
        Node_2               matlab.ui.container.TreeNode
        haarNode             matlab.ui.container.TreeNode
        dBNode               matlab.ui.container.TreeNode
        dB1                  matlab.ui.container.TreeNode
        dB2                  matlab.ui.container.TreeNode
        dB3                  matlab.ui.container.TreeNode
        dB4                  matlab.ui.container.TreeNode
        dB5                  matlab.ui.container.TreeNode
        symNode              matlab.ui.container.TreeNode
        sym1                 matlab.ui.container.TreeNode
        sym2                 matlab.ui.container.TreeNode
        sym3                 matlab.ui.container.TreeNode
        sym4                 matlab.ui.container.TreeNode
        sym5                 matlab.ui.container.TreeNode
        qingchu              matlab.ui.control.Button
        duqutupian           matlab.ui.control.Button
        ListBox_2            matlab.ui.control.ListBox
        ListBox_2Label       matlab.ui.control.Label
        ListBox              matlab.ui.control.ListBox
        Label                matlab.ui.control.Label
        Image6               matlab.ui.control.Image
    end

    % Callbacks that handle component events
    methods (Access = private)

        % Button pushed function: duqutupian
        function duqutupianPushed(app, event)

            folder = 'C:\Users\小坨坨\Desktop\代码';
            [filename, filepath] = uigetfile({'*.jpg;*.png;*.bmp;*.tif;', 'Image Files'}, 'Select an Image File', folder);
            if filename == 0
                msgbox('No file selected', 'Warning', 'warn');
                return;
            end
            fullname = fullfile(filepath, filename);
            img = imread(fullname);
            img = im2uint8(img);


            % Check if the image is RGB
            if size(img,3) == 3
                % Convert the image to grayscale
                img = rgb2gray(img);
            end
            imwrite(img, 'gray1.png');
            app.yuantu.ImageSource='gray1.png';
        end

        % Image clicked function: yuantu
        function yuantuImageClicked(app, event)
            
        end

        % Selection changed function: ButtonGroup_4
        function ButtonGroup_4SelectionChanged(app, event)
            selectedButton = app.ButtonGroup_4.SelectedObject;
            switch event.NewValue.Text
                 case '混合噪声'
                        img = imread('gray1.png');
                        % 将图像转换为灰度图像
                        img = im2gray(img);
                        % 添加高斯噪声和椒盐噪声
                        img = imnoise(img, 'gaussian', 0, 0.01); % 高斯噪声的均值为0,方差为0.01
                        img = imnoise(img, 'salt & pepper', 0.02); % 椒盐噪声的密度为0.02
                        % 显示处理后的图像
                        imwrite(img, 'hunhe.png');
                        app.zaoshengtuxiang.ImageSource = 'hunhe.png';
                 case '脉冲噪声'
                        img = imread('gray1.png');
                        % 将图像转换为灰度图像
                        img = im2gray(img);
                        % 添加脉冲噪声
                        img = imnoise(img, 'speckle'); % 脉冲噪声的方差为0.04
                        % 显示处理后的图像
                        imwrite(img, 'maichong.png');
                        app.zaoshengtuxiang.ImageSource = 'maichong.png';
                 case '椒盐噪声'
                        img = imread('gray1.png');
                        % 将图像转换为灰度图像
                        img = im2gray(img);
                        % 添加椒盐噪声
                        img = imnoise(img, 'salt & pepper', 0.05); % 椒盐噪声的密度为0.05
                        imwrite(img, 'jiaoyan.jpg');
                        app.zaoshengtuxiang.ImageSource = 'jiaoyan.jpg';
 
                 case'高斯噪声'
                        img = imread('gray1.png');
                        % 将图像转换为灰度图像
                        img = im2gray(img);
                        % 添加高斯白噪声
                        noise = uint8(0.02 * randn(size(img))); % 高斯白噪声的标准差为0.01
                        img = img + noise; % 将噪声与图像相加
                        imwrite(img, 'gaosi.png');
                        app.zaoshengtuxiang.ImageSource = 'gaosi.png';
             end
             
             
        end

        % Button down function: ButtonGroup_4
        function ButtonGroup_4ButtonDown(app, event)

        end

        % Value changed function: ListBox_2
        function ListBox_2ValueChanged(app, event)
            value = app.ListBox_2.Value;
            I = imread(app.zaoshengtuxiang.ImageSource);
            I_filtered = imfilter(I, fspecial('average', [3 3]));
            I_medfilt2 = medfilt2(I);
                switch value
                    case "无"
                    case "傅里叶变换"
                        F1=imread(app.zaoshengtuxiang.ImageSource);
                        F = fft2(F1);
                        % 对傅里叶变换结果进行中心化
                        F = fftshift(F);
                        [M,N] = size(F);
                        D0 = 50; % 截止频率
                        H = zeros(M,N); % 滤波器矩阵
                        for u = 1:M
                            for v = 1:N
                                D = sqrt((u-M/2)^2+(v-N/2)^2); % 计算距离
                                if D <= D0
                                    H(u,v) = 1; % 低频部分保留
                                else
                                    H(u,v) = 0; % 高频部分滤除
                                end
                            end
                        end
                        % 对傅里叶变换结果进行滤波
                        G = H.*F;

                        % 对滤波后的结果进行逆中心化
                        G = ifftshift(G);
                        % 对逆中心化后的结果进行逆傅里叶变换
                        K = uint8(real(ifft2(G)));
                        imwrite(K,'K.png');
                        app.PSNR.Value=string(psnr(K,I));
                        app.SSIM.Value=string(ssim(K,I));
                        app.quzaotuxiang.ImageSource = 'K.png';

                    case "均值滤波"

                        app.PSNR.Value=string(psnr(I_filtered,I));
                        app.SSIM.Value=string(ssim(I_filtered,I));
                        imwrite(I_filtered,'I_filtered.png');
                        app.quzaotuxiang.ImageSource = 'I_filtered.png';
                    case "中值滤波"
                        app.PSNR.Value=string(psnr(I_medfilt2,I));
                        app.SSIM.Value=string(ssim(I_medfilt2,I));
                        imwrite(I_medfilt2,'I_medfilt2.png');
                        app.quzaotuxiang.ImageSource = 'I_medfilt2.png';
            
                end
            
        end

        % Image clicked function: Image6
        function Image6Clicked(app, event)
            
        end

        % Value changed function: ListBox
        function ListBoxValueChanged(app, event)
            value1 = app.ListBox.Value;
            global a;
            global c;
            I = imread(app.zaoshengtuxiang.ImageSource);
            [C,S] = wavedec2(I,a,c);
            sigma = std(C(end-length(S(1,:))^2+1:end)); % 计算噪声方差sigma,使用最细尺度的小波系数
            N = length(I(:)); % 计算图像大小N,使用图像的像素数
            lambda = sigma*sqrt(2*log(N)); % 计算通用阈值lambda,使用公式𝜆=𝜎*sqrt(2ln𝑁)
            NC1 = wthresh(C,'h',lambda); % 对小波系数C进行硬阈值处理,使用阈值lambda,得到新的小波系数NC
            NC2 = wthresh(C,'s',lambda); % 对小波系数C进行硬阈值处理,使用阈值lambda,得到新的小波系数NC
            K11 = waverec2(NC1,S,c); % 对新的小波系数NC进行离散小波重构,使用小波基,得到去噪后的图像K
            K22 = waverec2(NC2,S,c); % 对新的小波系数NC进行离散小波重构,使用小波基,得到去噪后的图像K
            K11=uint8(K11);
            K22=uint8(K22);
            gthresh = @(x,lambda) (abs(x)<=lambda).*0 + (lambda<abs(x) & abs(x)<=2*lambda).*(x.^2-lambda^2)./(2*x) + (abs(x)>2*lambda).*(x-lambda.*sign(x));
            NC3 = gthresh(C,lambda); % 对小波系数C进行改进的阈值处理,使用阈值lambda,得到新的小波系数NC
            K33 = waverec2(NC3,S,c); 
            K33 = uint8(K33);
            switch value1
                case "无"
                case "硬阈值小波去噪"
                    app.PSNR.Value=string(psnr(uint8(K11),I));
                    app.SSIM.Value=string(ssim(uint8(K11),I));
                    imwrite(K11,'ying.png');
                    app.quzaotuxiang.ImageSource = 'ying.png';

                case "软阈值小波去噪"
                    app.PSNR.Value=string(psnr(uint8(K22),I));
                    app.SSIM.Value=string(ssim(uint8(K22),I));
                    imwrite(K22,'ruan.png');
                    app.quzaotuxiang.ImageSource = 'ruan.png';

                case "CALE阈值法"
                    app.PSNR.Value=string(psnr(uint8(K33),I));
                    app.SSIM.Value=string(ssim(uint8(K33),I));
                    imwrite(K33,'cale.png');
                    app.quzaotuxiang.ImageSource = 'cale.png';
            end

        end

        % Selection changed function: Tree
        function TreeSelectionChanged(app, event)
            selectedNode = app.Tree.SelectedNodes;
            global c;
            if ~isempty(selectedNode) && ~isempty(selectedNode.Parent)
                data = selectedNode.NodeData;
                wavelet = app.Tree.SelectedNodes.Text;
                switch wavelet
                    case 'haar'
                        c= 'haar';
                    case 'dB3'
                        c= 'db3';
                    case 'dB4'
                        c= 'db4';
                    case 'dB5'
                        c= 'db5';
                    case 'sym3'
                        c= 'sym3';
                    case 'sym4'
                        c= 'sym4';
                    case ' sym5'
                        c= 'sym5';
                end
            end

        end

        % Selection changed function: ButtonGroup_2
        function ButtonGroup_2SelectionChanged(app, event)
            global a;
            selectedButton = app.ButtonGroup_2.SelectedObject;
            switch event.NewValue.Text
                case "无"
                case "3"
                    a=3;
                case "4"
                    a=4;
                case "5"
                    a=5;
            end
        end

        % Button pushed function: qingchu
        function qingchuButtonPushed(app, event)
            app.yuantu.ImageSource='{9713E7DA-E9F4-4965-9C27-2249BC21BCB9}.png';
            app.PSNR.Value='';
            app.SSIM.Value='';
            app.quzaotuxiang.ImageSource = '{9713E7DA-E9F4-4965-9C27-2249BC21BCB9}.png';
            app.zaoshengtuxiang.ImageSource = '{9713E7DA-E9F4-4965-9C27-2249BC21BCB9}.png';
        end
    end

    % Component initialization
    methods (Access = private)

        % Create UIFigure and components
        function createComponents(app)

            % Get the file path for locating images
            pathToMLAPP = fileparts(mfilename('fullpath'));

            % Create UIFigure and hide until all components are created
            app.UIFigure = uifigure('Visible', 'off');
            app.UIFigure.Color = [1 1 1];
            app.UIFigure.Position = [100 100 886 683];
            app.UIFigure.Name = 'MATLAB App';

            % Create LeftPanel
            app.LeftPanel = uipanel(app.UIFigure);
            app.LeftPanel.Position = [1 0 394 684];

            % Create Image6
            app.Image6 = uiimage(app.LeftPanel);
            app.Image6.ScaleMethod = 'fill';
            app.Image6.ImageClickedFcn = createCallbackFcn(app, @Image6Clicked, true);
            app.Image6.Position = [1 1 393 682];
            app.Image6.ImageSource = fullfile(pathToMLAPP, '{1E6BC41D-7D8B-465a-896F-8261190F5FF4}.png');

            % Create Label
            app.Label = uilabel(app.LeftPanel);
            app.Label.HorizontalAlignment = 'right';
            app.Label.Position = [52 313 53 22];
            app.Label.Text = '小波去噪';

            % Create ListBox
            app.ListBox = uilistbox(app.LeftPanel);
            app.ListBox.Items = {'无', '硬阈值小波去噪', '软阈值小波去噪', 'CALE阈值法'};
            app.ListBox.ValueChangedFcn = createCallbackFcn(app, @ListBoxValueChanged, true);
            app.ListBox.Position = [119 220 170 117];
            app.ListBox.Value = '无';

            % Create ListBox_2Label
            app.ListBox_2Label = uilabel(app.LeftPanel);
            app.ListBox_2Label.HorizontalAlignment = 'right';
            app.ListBox_2Label.Position = [52 425 53 22];
            app.ListBox_2Label.Text = '传统去噪';

            % Create ListBox_2
            app.ListBox_2 = uilistbox(app.LeftPanel);
            app.ListBox_2.Items = {'无', '傅里叶变换', '均值滤波', '中值滤波'};
            app.ListBox_2.ValueChangedFcn = createCallbackFcn(app, @ListBox_2ValueChanged, true);
            app.ListBox_2.Position = [119 355 170 89];
            app.ListBox_2.Value = '傅里叶变换';

            % Create duqutupian
            app.duqutupian = uibutton(app.LeftPanel, 'push');
            app.duqutupian.ButtonPushedFcn = createCallbackFcn(app, @duqutupianPushed, true);
            app.duqutupian.Position = [120 610 168 51];
            app.duqutupian.Text = '读取图片';

            % Create qingchu
            app.qingchu = uibutton(app.LeftPanel, 'push');
            app.qingchu.ButtonPushedFcn = createCallbackFcn(app, @qingchuButtonPushed, true);
            app.qingchu.Position = [180 22 68 41];
            app.qingchu.Text = '清除';

            % Create Tree
            app.Tree = uitree(app.LeftPanel);
            app.Tree.SelectionChangedFcn = createCallbackFcn(app, @TreeSelectionChanged, true);
            app.Tree.BackgroundColor = [0.9412 0.9412 0.9412];
            app.Tree.Position = [52 87 150 123];

            % Create Node
            app.Node = uitreenode(app.Tree);
            app.Node.Text = '小波基';

            % Create Node_2
            app.Node_2 = uitreenode(app.Node);
            app.Node_2.Text = '无';

            % Create haarNode
            app.haarNode = uitreenode(app.Node);
            app.haarNode.Text = 'haar';

            % Create dBNode
            app.dBNode = uitreenode(app.Node);
            app.dBNode.Text = 'dB';

            % Create dB1
            app.dB1 = uitreenode(app.dBNode);
            app.dB1.Text = 'dB1';

            % Create dB2
            app.dB2 = uitreenode(app.dBNode);
            app.dB2.Text = 'dB2';

            % Create dB3
            app.dB3 = uitreenode(app.dBNode);
            app.dB3.Text = 'dB3';

            % Create dB4
            app.dB4 = uitreenode(app.dBNode);
            app.dB4.Text = 'dB4';

            % Create dB5
            app.dB5 = uitreenode(app.dBNode);
            app.dB5.Text = 'dB5';

            % Create symNode
            app.symNode = uitreenode(app.Node);
            app.symNode.Text = 'sym';

            % Create sym1
            app.sym1 = uitreenode(app.symNode);
            app.sym1.Text = 'sym1';

            % Create sym2
            app.sym2 = uitreenode(app.symNode);
            app.sym2.Text = 'sym2';

            % Create sym3
            app.sym3 = uitreenode(app.symNode);
            app.sym3.Text = 'sym3';

            % Create sym4
            app.sym4 = uitreenode(app.symNode);
            app.sym4.Text = 'sym4';

            % Create sym5
            app.sym5 = uitreenode(app.symNode);
            app.sym5.Text = 'sym5';

            % Create ButtonGroup_2
            app.ButtonGroup_2 = uibuttongroup(app.LeftPanel);
            app.ButtonGroup_2.SelectionChangedFcn = createCallbackFcn(app, @ButtonGroup_2SelectionChanged, true);
            app.ButtonGroup_2.Title = '分解层数';
            app.ButtonGroup_2.Position = [224 87 135 123];

            % Create wu
            app.wu = uiradiobutton(app.ButtonGroup_2);
            app.wu.Text = '无';
            app.wu.Position = [11 73 58 22];
            app.wu.Value = true;

            % Create san
            app.san = uiradiobutton(app.ButtonGroup_2);
            app.san.Text = '3';
            app.san.Position = [11 51 65 22];

            % Create si
            app.si = uiradiobutton(app.ButtonGroup_2);
            app.si.Text = '4';
            app.si.Position = [11 29 65 22];

            % Create wu55
            app.wu55 = uiradiobutton(app.ButtonGroup_2);
            app.wu55.Text = '5';
            app.wu55.Position = [11 7 65 22];

            % Create ButtonGroup_4
            app.ButtonGroup_4 = uibuttongroup(app.LeftPanel);
            app.ButtonGroup_4.SelectionChangedFcn = createCallbackFcn(app, @ButtonGroup_4SelectionChanged, true);
            app.ButtonGroup_4.TitlePosition = 'centertop';
            app.ButtonGroup_4.Title = '添加噪声';
            app.ButtonGroup_4.ButtonDownFcn = createCallbackFcn(app, @ButtonGroup_4ButtonDown, true);
            app.ButtonGroup_4.Position = [119 457 170 126];

            % Create gaosi
            app.gaosi = uitogglebutton(app.ButtonGroup_4);
            app.gaosi.Text = '高斯噪声';
            app.gaosi.Position = [12 72 143 23];
            app.gaosi.Value = true;

            % Create jiaoyan
            app.jiaoyan = uitogglebutton(app.ButtonGroup_4);
            app.jiaoyan.Text = '椒盐噪声';
            app.jiaoyan.Position = [12 51 143 23];

            % Create maichong
            app.maichong = uitogglebutton(app.ButtonGroup_4);
            app.maichong.Text = '脉冲噪声';
            app.maichong.Position = [12 30 143 23];

            % Create hunhe
            app.hunhe = uitogglebutton(app.ButtonGroup_4);
            app.hunhe.Text = '混合噪声';
            app.hunhe.Position = [12 8 143 23];

            % Create RightPanel
            app.RightPanel = uipanel(app.UIFigure);
            app.RightPanel.Position = [394 0 493 684];

            % Create Image4
            app.Image4 = uiimage(app.RightPanel);
            app.Image4.ScaleMethod = 'fill';
            app.Image4.Position = [0 1 492 683];
            app.Image4.ImageSource = fullfile(pathToMLAPP, '{1E6BC41D-7D8B-465a-896F-8261190F5FF4}.png');

            % Create yuantu
            app.yuantu = uiimage(app.RightPanel);
            app.yuantu.ImageClickedFcn = createCallbackFcn(app, @yuantuImageClicked, true);
            app.yuantu.BackgroundColor = [1 1 1];
            app.yuantu.Position = [155 387 182 180];
            app.yuantu.ImageSource = fullfile(pathToMLAPP, '4f9d968ae460dcc76dab517c34cfc9fa.jpg');

            % Create PSNRTextAreaLabel
            app.PSNRTextAreaLabel = uilabel(app.RightPanel);
            app.PSNRTextAreaLabel.HorizontalAlignment = 'right';
            app.PSNRTextAreaLabel.Position = [29 39 39 22];
            app.PSNRTextAreaLabel.Text = 'PSNR';

            % Create PSNR
            app.PSNR = uitextarea(app.RightPanel);
            app.PSNR.Position = [83 39 111 24];

            % Create SSIMTextAreaLabel
            app.SSIMTextAreaLabel = uilabel(app.RightPanel);
            app.SSIMTextAreaLabel.HorizontalAlignment = 'right';
            app.SSIMTextAreaLabel.Position = [260 38 35 22];
            app.SSIMTextAreaLabel.Text = 'SSIM';

            % Create SSIM
            app.SSIM = uitextarea(app.RightPanel);
            app.SSIM.Position = [310 38 111 24];

            % Create PSNRTextAreaLabel_2
            app.PSNRTextAreaLabel_2 = uilabel(app.RightPanel);
            app.PSNRTextAreaLabel_2.HorizontalAlignment = 'right';
            app.PSNRTextAreaLabel_2.FontSize = 20;
            app.PSNRTextAreaLabel_2.Position = [72 131 85 26];
            app.PSNRTextAreaLabel_2.Text = '噪声图片';

            % Create PSNRTextAreaLabel_3
            app.PSNRTextAreaLabel_3 = uilabel(app.RightPanel);
            app.PSNRTextAreaLabel_3.HorizontalAlignment = 'right';
            app.PSNRTextAreaLabel_3.FontSize = 20;
            app.PSNRTextAreaLabel_3.Position = [324 131 85 26];
            app.PSNRTextAreaLabel_3.Text = '去噪图片';

            % Create PSNRTextAreaLabel_4
            app.PSNRTextAreaLabel_4 = uilabel(app.RightPanel);
            app.PSNRTextAreaLabel_4.HorizontalAlignment = 'right';
            app.PSNRTextAreaLabel_4.FontSize = 20;
            app.PSNRTextAreaLabel_4.Position = [216 585 45 26];
            app.PSNRTextAreaLabel_4.Text = '原图';

            % Create zaoshengtuxiang
            app.zaoshengtuxiang = uiimage(app.RightPanel);
            app.zaoshengtuxiang.BackgroundColor = [1 1 1];
            app.zaoshengtuxiang.Position = [29 175 182 180];
            app.zaoshengtuxiang.ImageSource = fullfile(pathToMLAPP, '4f9d968ae460dcc76dab517c34cfc9fa.jpg');

            % Create quzaotuxiang
            app.quzaotuxiang = uiimage(app.RightPanel);
            app.quzaotuxiang.BackgroundColor = [1 1 1];
            app.quzaotuxiang.Position = [275 175 182 180];
            app.quzaotuxiang.ImageSource = fullfile(pathToMLAPP, '4f9d968ae460dcc76dab517c34cfc9fa.jpg');

            % Show the figure after all components are created
            app.UIFigure.Visible = 'on';
        end
    end

    % App creation and deletion
    methods (Access = public)

        % Construct app
        function app = Waveletdenoising

            % Create UIFigure and components
            createComponents(app)

            % Register the app with App Designer
            registerApp(app, app.UIFigure)

            if nargout == 0
                clear app
            end
        end

        % Code that executes before app deletion
        function delete(app)

            % Delete UIFigure when app is deleted
            delete(app.UIFigure)
        end
    end
end

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值