车辆识别基于matlab GUI小波和盒维数车型识别含Matlab源码 727期

Posted 紫极神光

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了车辆识别基于matlab GUI小波和盒维数车型识别含Matlab源码 727期相关的知识,希望对你有一定的参考价值。

一、简介

差分盒维数(differential box-counting,DBC),可以作为图像表面纹理粗糙程度的度量,因为它有很好的精确性和适用性,而且能满足计算效率和动态特性的要求。

1 处理流程:
对于一个MM大小的图像,在三维空间中,(x,y)代表空间的位置,z代表其对应点的灰度值gray(x,y)。
1.1 图像分块,s
s,r = s/M
1.2 在每一个ss的分块中,都有一个盒子柱ss*s’。如果最大灰度值为G,通常为256,则G/s’ = M/s。
1.3 计算每个分块的最大灰度值和最小灰度值,它们分别落在盒子k和l中,则
nr = k-l+1
1.4 Nr = sum(nr), d = log(Nr) / log(1/r)
1.5 对图像进行不同的分块,将最后结果进行最小二乘拟合。

2 QUESTION
2.1 s’怎么理解?
s’表示需要多少个盒子覆盖整个灰度曲面。
2.2 怎么理解灰度最大值和最小值落在盒子k和l中?
对图像进行分块,可能看成是对其按一定比例缩小的过程,对于灰度也要按照相同的比例缩小。比如分块大小为22,图像大小为256256,则k = maxgray/(256/2),同样,l = mingray /(256/2)。

二、源代码

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



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

% Last Modified by GUIDE v2.5 29-Apr-2014 11:42:42

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(\'gui_Name\',       mfilename, ...
                   \'gui_Singleton\',  gui_Singleton, ...
                   \'gui_OpeningFcn\', @Carcheck_OpeningFcn, ...
                   \'gui_OutputFcn\',  @Carcheck_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 Carcheck is made visible.
function Carcheck_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 Carcheck (see VARARGIN)

% Choose default command line output for Carcheck
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes Carcheck wait for user response (see UIRESUME)
% uiwait(handles.carcheck);


% --- Outputs from this function are returned to the command line.
function varargout = Carcheck_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 list.
function list_Callback(hObject, eventdata, handles)
% hObject    handle to list (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 list contents as cell array
%        contents{get(hObject,\'Value\')} returns selected item from list
car_pic = get(handles.carorigin, \'UserData\');

set(handles.list,\'UserData\',car_pic{get(handles.list,\'Value\')});
disp([\'--> 选择汽车原图: \', car_pic{get(handles.list,\'Value\')}]);

% --- Executes during object creation, after setting all properties.
function list_CreateFcn(hObject, eventdata, handles)
% hObject    handle to list (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 button press in backgroup.
function backgroup_Callback(hObject, eventdata, handles)
% hObject    handle to backgroup (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[fname, pname] = uigetfile(...
       {\'*.jpg\',\'jpg-files (*.jpg)\'; ...
        \'*.png\',\'png-files (*.png)\'; ...
        \'*.*\',  \'All Files (*.*)\'}, ...
        \'选择一个图片文件\', ...
        \'MultiSelect\', \'off\');
    
if isequal(fname,0) || isequal(pname,0)
  return;
else
   backgroup_pic = fullfile(pname, fname);
   
   bg = imread(backgroup_pic);
   axes(handles.axesorigin); 
   imshow(bg);  
   
   set(handles.backgroup,\'UserData\',backgroup_pic);
   set(handles.capinon, \'String\', [\'背景图片: \', backgroup_pic]);
   disp([\'--> 背景图片: \', backgroup_pic]);
end


% --- Executes on button press in carorigin.
function carorigin_Callback(hObject, eventdata, handles)
% hObject    handle to carorigin (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[fname, pname] = uigetfile(...
       {\'*.jpg\',\'jpg-files (*.jpg)\'; ...
        \'*.png\',\'png-files (*.png)\'; ...
        \'*.*\',  \'All Files (*.*)\'}, ...
        \'选择一个或多个图片文件\', ...
        \'MultiSelect\', \'on\');
    
if isequal(fname,0) || isequal(pname,0)
  return;
else
    if ischar(fname)
        fname = {fname};
    end
    car_pic = cell(1,length(fname));
    for k = 1:length(fname);
        car_pic{k} = fullfile(pname, fname{k});
    end
    
	set(handles.capinon, \'String\', [\'汽车原图目录: \', pname]);
	set(handles.list,\'String\', fname, \'Value\', 1, \'UserData\',car_pic{k});
	set(handles.carorigin,\'UserData\',car_pic);
  
	disp([\'--> 汽车原图目录: \', pname]);
end

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

% S1: 调入图片文件
backgroup_pic = get(handles.backgroup,\'UserData\');  % 背景图片的地址
car_pic = get(handles.list,\'UserData\');             % 汽车图片的地址

if isempty(backgroup_pic)
    helpdlg(\'请单击[背景图片]按钮,导入背景图片\',\'提示\');
    return;
end

if isempty(car_pic)
    helpdlg(\'请单击[汽车原图]按钮,导入汽车原图\',\'提示\');
    return;
end

cla(handles.axescarpic);    % 清除图像
cla(handles.capinon);
cla(handles.axesgnomon); 
set(handles.axesgnomon,\'XTick\',[],\'YTick\',[]);
cla(handles.axeswave); 
set(handles.axeswave,\'XTick\',[],\'YTick\',[]);


bg = imread(backgroup_pic); % 调入背景图片
bc = imread(car_pic);       % 调入汽车图片

if size(bg,1) ~= size(bc,1) || size(bg,2) ~= size(bc,2)
        errordlg(\'汽车图片与背景图片大小不一致!\',\'警告\');
    return;
end

三、运行结果

在这里插入图片描述

四、备注

版本:2014a
需要完整代码或代写加QQ 1564658423

以上是关于车辆识别基于matlab GUI小波和盒维数车型识别含Matlab源码 727期的主要内容,如果未能解决你的问题,请参考以下文章

基于Matlab的车型识别(GUI界面)

基于Matlab的车型识别(GUI界面)

图像识别基于模板匹配算法识别人脸matlab源码含GUI

车辆检测基于matlab yolo v2车辆检测识别含Matlab源码 581期

图像识别基于yolo v2深度学习检测识别车辆matlab源码

yolov3识别的类别_车型识别相关技术