• 【角点检测】 基于各向异性高斯方向导数滤波器实现图像角点检测附matlab代码


    1 内容介绍

    为了改进噪声鲁棒性和定位准确性,利用各向异性高斯方向导数滤波器,提出多方向角点检测算法.该算法利用一组各向异性高斯方向导数滤波器对输入图像进行卷积处理得到各个方向的滤波器响应.对于每个像素点,利用它与周围邻近像素点的滤波器响应的相关信息构造局部自相关矩阵,然后根据自相关矩阵归一化特征值及像素点处各方向滤波器响应,作阈值处理和非极大值抑制处理判定像素点是否为角点.实验结果表明,在无噪声和噪声的条件下,提出的检测方法与各向同性高斯核函数的Harris算法相比,配准角点数均提高6.0%左右,具有更好的检测性能.

    2 部分代码

    function varargout = ch3(varargin)

    % CH3 M-file for ch3.fig

    %      CH3, by itself, creates a new CH3 or raises the existing

    %      singleton*.

    %

    %      H = CH3 returns the handle to a new CH3 or the handle to

    %      the existing singleton*.

    %

    %      CH3('CALLBACK',hObject,eventData,handles,...) calls the local

    %      function named CALLBACK in CH3.M with the given input arguments.

    %

    %      CH3('Property','Value',...) creates a new CH3 or raises the

    %      existing singleton*.  Starting from the left, property value pairs are

    %      applied to the GUI before ch3_OpeningFunction gets called.  An

    %      unrecognized property name or invalid value makes property application

    %      stop.  All inputs are passed to ch3_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 ch3

    % Last Modified by GUIDE v2.5 10-Oct-2021 08:46:09

    % Begin initialization code - DO NOT EDIT

    gui_Singleton = 1;

    gui_State = struct('gui_Name',       mfilename, ...

                       'gui_Singleton',  gui_Singleton, ...

                       'gui_OpeningFcn', @ch3_OpeningFcn, ...

                       'gui_OutputFcn',  @ch3_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 ch3 is made visible.

    function ch3_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 ch3 (see VARARGIN)

    % Choose default command line output for ch3

    handles.output = hObject;

    % Update handles structure

    guidata(hObject, handles);

    % UIWAIT makes ch3 wait for user response (see UIRESUME)

    % uiwait(handles.figure1);

    % --- Outputs from this function are returned to the command line.

    function varargout = ch3_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;

    % --------------------------------------------------------------------

    function Files_Callback(hObject, eventdata, handles)

    % hObject    handle to Files (see GCBO)

    % eventdata  reserved - to be defined in a future version of MATLAB

    % handles    structure with handles and user data (see GUIDATA)

    % --------------------------------------------------------------------

    function Open_Callback(hObject, eventdata, handles)

    % hObject    handle to Open (see GCBO)

    % eventdata  reserved - to be defined in a future version of MATLAB

    % handles    structure with handles and user data (see GUIDATA)

    [filename,pathname]=uigetfile({'*.bmp'},'选择图片');

    global str;

    if isequal(filename,0)

        disp('Users Selected Canceled');

    else

    str=[pathname filename];

    handles.str=str;

    guidata(hObject,handles);

    im = imread(str);

    axes(handles.OImageDisplay);

    imshow(im);

    end;

    % --------------------------------------------------------------------

    function det_Callback(hObject, eventdata, handles)

    % hObject    handle to det (see GCBO)

    % eventdata  reserved - to be defined in a future version of MATLAB

    % handles    structure with handles and user data (see GUIDATA)

    % --------------------------------------------------------------------

    function Hardet_Callback(hObject, eventdata, handles)

    % hObject    handle to Untitled_2 (see GCBO)

    % eventdata  reserved - to be defined in a future version of MATLAB

    % handles    structure with handles and user data (see GUIDATA)

    %清屏,所以变量置零

    %记录检测的角点数

    count=0;

    for i1=2:height-1;

      for j1=2:width-1

      % 在3*3窗口范围内寻找局部最大值点作为检测出的角点

      a=[R(i1-1,j1-1) R(i1-1,j1) R(i1-1,j1+1) R(i1,j1-1) R(i1,j1+1) R(i1+1,j1-1) R(i1+1,j1) R(i1+1,j1+1)];

      if R(i1,j1)>0.01*Rmax && R(i1,j1)>max(a)

      Result(i1,j1)=1;

      count=count+1;

      end

      end

    end

    % 纪录角点位置

    [posr,posc]=find(Result==1);

     % 输出角点个数  

    %fprintf('检测到的角点数count=%d\n',count);

    set(handles.text3,'String',num2str(count));

    axes(handles.DetImage);

    imshow(image);   

    hold on;

    %角点处画+

    plot(posc,posr,'r+');

    3 运行结果

    4 参考文献

    [1]周文天 李军民 唐慧娟 李科. 基于高斯差分滤波和形态学滤波的Harris角点检测算法[J]. 西华大学学报:自然科学版, 2014, 33(6):4.

    [2]章为川, 张智, 赵强,等. 基于各向异性高斯方向导数滤波器的角点检测[J]. 西安工程大学学报, 2014, 28(4):5.

    博主简介:擅长智能优化算法神经网络预测信号处理元胞自动机图像处理路径规划无人机雷达通信无线传感器等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

    部分理论引用网络文献,若有侵权联系博主删除。

  • 相关阅读:
    js实现红包雨功能(canvas,react,ts),包括图片不规则旋转、大小、转速、掉落速度控制、屏幕最大红包数量控制等功能
    【踩坑系列】发送微信模板消息返回40165 invalid weapp pagepath
    在STM32F103C8T6上使用RT_Thread Nano移植控制台和Finsh
    【uni-app从入门到实战】环境搭建和配置学习
    SkyWalking快速上手(五)——存放在内存、数据持久化
    Win安装protobuf和IDEA使用protobuf插件
    目标检测论文解读复现之六:基于YOLOv5的遥感图像舰船的检测方法
    使用reposync同步远程yum源镜像仓库到本地和制作本地yum源(以同步EPEL为例)
    PHP - 经典面试题大全,看这一篇就够了
    Tomcat深入浅出——Servlet(二)
  • 原文地址:https://blog.csdn.net/matlab_dingdang/article/details/126904020