A list,

Based on MATLAB high pass + low pass + band pass + directional filter image filtering

Ii. Source code

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

% Last Modified by GUIDE v2. 5 15-Jun- 2021. 17:04:53

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @ImageFilter_OpeningFcn, ...
                   'gui_OutputFcn',  @ImageFilter_OutputFcn, ...
                   'gui_LayoutFcn', [],...'gui_Callback'[]);if nargin & isstr(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 ImageFilter is made visible.
function ImageFilter_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 ImageFilter (see VARARGIN)
global bIsFileOpen RImage
% Choose default command line output for ImageFilter
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes ImageFilter wait for user response (see UIRESUME)
% uiwait(handles.figure1);
bIsFileOpen = false;
RImage = 0;

% --- Outputs from this function are returned to the command line.
function varargout = ImageFilter_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 button press in pushbutton_refresh.
function pushbutton_refresh_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton_refresh (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)Global bIsFileOpen Image RImage % Whether the file is open, global variables, Image arrayif(~bIsFileOpen)
    return;
end
popup_sel_index = get(handles.popupmenu_sel, 'Value');
scale = get(handles.slider1,'Value');

switch popup_sel_index
    case 1
        PQ = paddedsize(size(Image));
        D0 = scale*PQ(1);
        H = hpfilter('gaussian',PQ(1),PQ(2),D0);
        H1 = ifftshift(H);
        RImage = dftfilt(Image,H);
        RImage = im2uint8(mat2gray(RImage));
        axes(handles.axes_outputImage);
        imshow(RImage);
        axes(handles.axes_filter);
        imshow(H1);
    case 2
        PQ = paddedsize(size(Image));
        D0 = scale*PQ(2);
        H = lpfilter('gaussian',PQ(1),PQ(2),D0);
        H1 = ifftshift(H);
        RImage = dftfilt(Image,H);
        RImage = im2uint8(mat2gray(RImage));
        axes(handles.axes_outputImage);
        imshow(RImage);
        axes(handles.axes_filter);
        imshow(H1);
    case 3
        scale1 = str2double(get(handles.edit_FilterPara2,'String')); PQ = paddedsize(size(Image)); D1 = scale*PQ(1);
        D2 = scale1*PQ(1);
        H = bandfilter(PQ(1),PQ(2),D1,D2);
        H1 = ifftshift(H);
        RImage = dftfilt(Image,H);
        RImage = im2uint8(mat2gray(RImage));
        axes(handles.axes_outputImage);
        imshow(RImage);
        axes(handles.axes_filter);
        imshow(H1); 
    case 4
        scale1 = - 90. + str2double(get(handles.edit_FilterPara2,'String')); PQ = paddedsize(size(Image)); D1 =floor(2*scale*PQ(1));
        D2 = scale1;
        H = tapefilter(PQ(1),PQ(2),D1,D2);
        H1 = fftshift(H);
        RImage = dftfilt(Image,H1);
        RImage = im2uint8(mat2gray(RImage));
        axes(handles.axes_outputImage);
        imshow(RImage);
        axes(handles.axes_filter);
        imshow(H); 
end
FImage = log(1+abs(fft2(Image)));
FUImage =  fftshift(im2uint8(mat2gray(FImage)));
axes(handles.axes_inputFreq);
imshow(FUImage);

FRImage = log(1+abs(fft2(RImage)));
FURImage =  fftshift(im2uint8(mat2gray(FRImage)));
axes(handles.axes_OutputFreq);
imshow(FURImage);
difImage = im2uint8(double(RImage)-double(Image));
axes(handles.axes_diffImage);
imshow(difImage);
% --- Executes during object creation, after setting all properties.
function popupmenu_sel_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu_sel (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 popupmenu_sel.
function popupmenu_sel_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu_sel (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns popupmenu_sel contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu_sel
popup_sel_index = get(handles.popupmenu_sel, 'Value');
switch(popup_sel_index)
    case 1
        set(handles.edit_FilterPara2,'String'.'0');
        set(handles.edit_FilterPara2,'Enable'.'off');
        set(handles.text_para1,'string'.'Filter circle radius');
        set(handles.text_para2,'string'."); case 2 set(handles.edit_FilterPara2,'String'.'0');
        set(handles.edit_FilterPara2,'Enable'.'off');
        set(handles.text_para1,'string'.'Filter circle radius');
        set(handles.text_para2,'string'."); case 3 set(handles.edit_FilterPara2,'Enable'.'on');
        set(handles.text_para1,'string'.'Filter circle 1 radius');
        set(handles.text_para2,'string'.'Filter circle 2 radius');
        scale = get(handles.slider1,'Value');
        set(handles.edit_FilterPara2,'String',scale+0.1);
    case 4
        set(handles.edit_FilterPara2,'String'.90);
        set(handles.edit_FilterPara2,'Enable'.'on');
        set(handles.text_para1,'string'.'Filter width');
        set(handles.text_para2,'string'.'Rotation Angle');
end


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

% Hint: slider controls usually have a light gray background, change
%       'usewhitebg' to 0 to use default.  See ISPC and COMPUTER.
usewhitebg = 1;
if usewhitebg
    set(hObject,'BackgroundColor'[9. 9. 9.]);
else
    set(hObject,'BackgroundColor',get(0.'defaultUicontrolBackgroundColor'));
end


% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject    handle to slider1 (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,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
set(  handles.edit_FilterPara,'String',num2str( get(hObject,'Value')));
set(  handles.edit_FilterPara2,'String',num2str( get(hObject,'Value') +0.1 )  )

% --- Executes on button press in pushbutton_Input.
function pushbutton_Input_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton_Input (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)Global bIsFileOpen Image Scale % Whether the file is open, global variable, Image array [filename, pathName]= uigetfile( ...
{'*.bmp; *.jpg; *.jpeg; '.'Image file (*.bmp; *.jpg; *.jpeg)';
    '*.bmp'.'Bitmap files (*.bmp)'; .'*.jpg'.'JPEG image file (*.jpg)'; .'*.jpeg'.'JPEG image file (*.jpeg)'; . },'Select a file'); % file open dialog boxif ~isequal(filename, 0) % FileFullname= existsstrcat(pathname,filename); Image = imRead (FileFullname); % read the image,Image
    if(size(Image,3) ~ =1)
        errordlg('Currently only supports 256 color images! ');
        bIsFileOpen = false; % file openreturn;
    end
    bIsFileOpen = true; Axes (handles. Axes_inputImage); %axes_InputImage
    imshow(Image); % shows the left image in axes_Imageset(handles.slider1,'Value'.0.1);
    set(handles.edit_FilterPara,'String'.0.1);
    set(handles.edit_FilterPara2,'String'.0.2);
end


% --- Executes on button press in pushbutton_Output.
function pushbutton_Output_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton_Output (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global RImage
if(size(RImage)==1)
    return
end
Copy the code

Third, the operation result

Fourth, note

Version: 2014 a