码迷,mamicode.com
首页 > 其他好文 > 详细

【图像去噪】基于matlab GUI小波+中值+维纳及频域滤波【含Matlab源码 506期】

时间:2021-06-28 20:33:26      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:描述   let   his   com   output   orm   sch   turned   完整   

一、简介

基于matlab GUI小波、中值、维纳及频域上的滤波

二、源代码

function varargout = dsp1_2(varargin)
% DSP1_2 MATLAB code for dsp1_2.fig
%      DSP1_2, by itself, creates a new DSP1_2 or raises the existing
%      singleton*.
%
%      H = DSP1_2 returns the handle to a new DSP1_2 or the handle to
%      the existing singleton*.
%
%      DSP1_2(‘CALLBACK‘,hObject,eventData,handles,...) calls the local
%      function named CALLBACK in DSP1_2.M with the given input arguments.
%
%      DSP1_2(‘Property‘,‘Value‘,...) creates a new DSP1_2 or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before dsp1_2_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to dsp1_2_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE‘s Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help dsp1_2

% Last Modified by GUIDE v2.5 27-Mar-2014 13:11:02

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name‘,       mfilename, ...
                   ‘gui_Singleton‘,  gui_Singleton, ...
                   ‘gui_OpeningFcn‘, @dsp1_2_OpeningFcn, ...
                   ‘gui_OutputFcn‘,  @dsp1_2_OutputFcn, ...
                   ‘gui_LayoutFcn‘,  [] , ...
                   ‘gui_Callback‘,   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before dsp1_2 is made visible.
function dsp1_2_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to dsp1_2 (see VARARGIN)


h_figure1=findobj(‘Tag‘,‘figure1‘);%获取figure1的句柄,实现界面间的信息传递
h_figure1=guihandles(h_figure1);%类似编程语言中的向上转型,得到handles结构
setappdata(handles.figure2,‘h_figure1‘,h_figure1);
% Choose default command line output for dsp1_2
axes(handles.axes4);
%h_figure1=getappdata(handles.figure2,‘h_figure1‘);

img3=getappdata(h_figure1.figure1,‘img3‘);
img1=getappdata(h_figure1.figure1,‘img1‘);
setappdata(handles.figure2, ‘img1‘, img1);
setappdata(handles.figure2, ‘img4_prime‘, img3);
setappdata(handles.figure2, ‘img4‘, img3);
setappdata(handles.figure2, ‘img5‘, 0);%压缩后图像
setappdata(handles.figure2, ‘cr‘, 0);%压缩比
%img4_prime = getappdata(handles.figure2, ‘img4_prime‘);
imshow(img3);
set(handles.menuitem_save, ‘Enable‘, ‘off‘);

handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes dsp1_2 wait for user response (see UIRESUME)
% uiwait(handles.figure2);


% --- Outputs from this function are returned to the command line.
function varargout = dsp1_2_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on selection change in popupmenu4.
function popupmenu4_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,‘String‘)) returns popupmenu4 contents as cell array
%        contents{get(hObject,‘Value‘)} returns selected item from popupmenu4


% --- Executes during object creation, after setting all properties.
function popupmenu4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,‘BackgroundColor‘), get(0,‘defaultUicontrolBackgroundColor‘))
    set(hObject,‘BackgroundColor‘,‘white‘);
end






% --- Executes on selection change in popupmenu_yasuo.
function popupmenu_yasuo_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu_yasuo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,‘String‘)) returns popupmenu_yasuo contents as cell array
%        contents{get(hObject,‘Value‘)} returns selected item from popupmenu_yasuo
val = get(hObject,‘Value‘);
str = get(hObject, ‘String‘);
switch str{val};
    case ‘PCA‘ % 选项框的隐藏与再现
      set(handles.uipanel_cheng, ‘Visible‘, ‘off‘);
      set(handles.uipanel_jpeg, ‘Visible‘, ‘off‘);
      set(handles.uipanel_cheng2, ‘Visible‘, ‘off‘);
      set(handles.uipanel_yasuobi, ‘Visible‘, ‘on‘);
      set(handles.pushbutton_yasuo, ‘Enable‘, ‘on‘);

    case ‘Transform(DCT)‘ % 
       set(handles.uipanel_cheng, ‘Visible‘, ‘off‘);
       set(handles.uipanel_jpeg, ‘Visible‘, ‘off‘);
       set(handles.uipanel_cheng2, ‘Visible‘, ‘off‘);
       set(handles.uipanel_yasuobi, ‘Visible‘, ‘on‘);
       set(handles.pushbutton_yasuo, ‘Enable‘, ‘on‘);
       img4 = getappdata(handles.figure2, ‘img1‘);
       axes(handles.axes4)
       %img4 = im2double(img4);
       imshow(img4, []);

    case ‘Transform(FFT)‘ % 
        set(handles.uipanel_cheng, ‘Visible‘, ‘off‘);
        set(handles.uipanel_jpeg, ‘Visible‘, ‘off‘);
        set(handles.uipanel_cheng2, ‘Visible‘, ‘off‘);
        set(handles.uipanel_yasuobi, ‘Visible‘, ‘on‘);
        set(handles.pushbutton_yasuo, ‘Enable‘, ‘on‘);
        img4 = getappdata(handles.figure2, ‘img1‘);
        axes(handles.axes4)
        %img4 = im2double(img4);
        imshow(img4, []);

    case ‘位平面行程编码(无损)‘
        set(handles.uipanel_yasuobi, ‘Visible‘, ‘off‘);
        set(handles.uipanel_jpeg, ‘Visible‘, ‘off‘);
        set(handles.uipanel_cheng2, ‘Visible‘, ‘off‘);
        set(handles.uipanel_cheng, ‘Visible‘, ‘on‘);
        set(handles.pushbutton_yasuo, ‘Enable‘, ‘on‘);
        
    case ‘位平面行程编码(有损)‘
      set(handles.uipanel_yasuobi, ‘Visible‘, ‘off‘);
      set(handles.uipanel_jpeg, ‘Visible‘, ‘off‘);
      set(handles.uipanel_cheng, ‘Visible‘, ‘off‘);
      set(handles.uipanel_cheng2, ‘Visible‘, ‘on‘);
      set(handles.pushbutton_yasuo, ‘Enable‘, ‘on‘);
      
    case ‘JPEG‘
        set(handles.uipanel_yasuobi, ‘Visible‘, ‘off‘);
        set(handles.uipanel_cheng, ‘Visible‘, ‘off‘);
        set(handles.uipanel_cheng2, ‘Visible‘, ‘off‘);
        set(handles.uipanel_jpeg, ‘Visible‘, ‘on‘);
        set(handles.pushbutton_yasuo, ‘Enable‘, ‘on‘);

end


% --- Executes during object creation, after setting all properties.
function popupmenu_yasuo_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu_yasuo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,‘BackgroundColor‘), get(0,‘defaultUicontrolBackgroundColor‘))
    set(hObject,‘BackgroundColor‘,‘white‘);
end



function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,‘String‘) returns contents of edit1 as text
%        str2double(get(hObject,‘String‘)) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,‘BackgroundColor‘), get(0,‘defaultUicontrolBackgroundColor‘))
    set(hObject,‘BackgroundColor‘,‘white‘);
end




% --- Executes on button press in pushbutton_yasuo.
function pushbutton_yasuo_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton_yasuo (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
val = get(handles.popupmenu_yasuo,‘Value‘);
str = get(handles.popupmenu_yasuo, ‘String‘);
switch str{val};
	
    case ‘PCA‘ % 进行PCA压缩
        h=waitbar(0,‘正在压缩中,请耐心等待...‘);%进度条
        for playtime = 1:300
            waitbar(playtime/1000);
        end

三、运行结果

技术图片
技术图片
技术图片
技术图片
技术图片

四、备注

版本:2014a

完整代码或代写加1564658423

【图像去噪】基于matlab GUI小波+中值+维纳及频域滤波【含Matlab源码 506期】

标签:描述   let   his   com   output   orm   sch   turned   完整   

原文地址:https://www.cnblogs.com/homeofmatlab/p/14942704.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!