【图像修复】图像运动模糊消除(逆滤波)matlab源码

一、简介

基于matlab GUI运动模糊消除(逆滤波)

二、源代码

``` function varargout = motionremove(varargin) % MOTIONREMOVE M-file for motionremove.fig % MOTIONREMOVE, by itself, creates a new MOTIONREMOVE or raises the existing % singleton*. % % H = MOTIONREMOVE returns the handle to a new MOTIONREMOVE or the handle to % the existing singleton*. % % MOTIONREMOVE('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in MOTIONREMOVE.M with the given input arguments. % % MOTIONREMOVE('Property','Value',...) creates a new MOTIONREMOVE or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before motionremoveOpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to motionremove_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 motion_remove

% Last Modified by GUIDE v2.5 27-Apr-2021 17:53:02

% Begin initialization code - DO NOT EDIT guiSingleton = 1; guiState = struct('guiName', mfilename, ... 'guiSingleton', guiSingleton, ... 'guiOpeningFcn', @motionremoveOpeningFcn, ... 'guiOutputFcn', @motionremoveOutputFcn, ... 'guiLayoutFcn', [] , ... 'guiCallback', []); if nargin & isstr(varargin{1}) guiState.gui_Callback = str2func(varargin{1}); end

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

% --- Executes just before motionremove is made visible. function motionremoveOpeningFcn(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 motionremove (see VARARGIN) axes(handles.axes1); img = imread('lena1.bmp'); imshow(img); LEN = 30; THETA = 45; PSF = fspecial('motion',LEN,THETA); MF = imfilter(img,PSF,'circular','conv'); axes(handles.axes2); imshow(MF); INITPSF = fspecial('motion',LEN,THETA); [J,P] = deconvblind(MF,INITPSF,30); axes(handles.axes3); imshow(J); set(handles.lenedit,'string',30); set(handles.thetaedit,'string',45); % Choose default command line output for motion_remove handles.output = hObject;

% Update handles structure guidata(hObject, handles);

% UIWAIT makes motion_remove wait for user response (see UIRESUME) % uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line. function varargout = motionremoveOutputFcn(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 during object creation, after setting all properties. function leneditCreateFcn(hObject, eventdata, handles) % hObject handle to len_edit (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 set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end

function leneditCallback(hObject, eventdata, handles) % hObject handle to len_edit (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 lenedit as text % str2double(get(hObject,'String')) returns contents of lenedit as a double

% --- Executes during object creation, after setting all properties. function thetaeditCreateFcn(hObject, eventdata, handles) % hObject handle to theta_edit (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 set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end

function thetaeditCallback(hObject, eventdata, handles) % hObject handle to theta_edit (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 thetaedit as text % str2double(get(hObject,'String')) returns contents of thetaedit as a double

% --- Executes on button press in applybutton. function applybuttonCallback(hObject, eventdata, handles) % hObject handle to applybutton (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) LEN = str2num(get(handles.lenedit,'string')); THETA = str2num(get(handles.thetaedit,'string')); img = getimage(handles.axes1); PSF = fspecial('motion',LEN,THETA); MF = imfilter(img,PSF,'circular','conv'); axes(handles.axes2); imshow(MF); INITPSF = fspecial('motion',LEN,THETA); [J,P] = deconvblind(MF,INITPSF,30); axes(handles.axes3); imshow(J);

% --- Executes on button press in closebutton. function closebuttonCallback(hObject, eventdata, handles) % hObject handle to closebutton (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close(motion_remove);

% --- Executes during object creation, after setting all properties. function imagepopmenuCreateFcn(hObject, eventdata, handles) % hObject handle to imagepop_menu (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 set(hObject,'BackgroundColor','white'); else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); end

% --- Executes on selection change in imagepopmenu. function imagepopmenuCallback(hObject, eventdata, handles) % hObject handle to imagepopmenu (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) LEN = str2num(get(handles.lenedit,'string')); THETA = str2num(get(handles.theta_edit,'string')); val = get(hObject,'value'); str = get(hObject,'string'); switch str{val} ```

三、运行结果

在这里插入图片描述

四、备注

版本:2014a

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Matlab科研辅导帮

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值