【图像检测】基于matlab GUI比值+归一化+相关系数遥感图像【含Matlab源码 737期】

一、简介

遥感图像模型和特征
在这里插入图片描述
1 遥感图像模型
了解像素值的含义
遥感图像模型考虑的是遥感图像中像素值的 物理意义
对地观测的遥感分为三部分:大气遥感、水色遥感、陆地遥感
遥感图像中像素值的物理意义:电磁波能量分布的一种表达
在这里插入图片描述
1.1 陆地遥感的图像模型
在这里插入图片描述
在可见光遥感中,遥感图像中的能量和地物目标的反射率是成正比的
入射能量I是太阳辐射,这个基本上可以看成是常数
夜晚中,右侧为0,L=左项 ,左侧可以通过红外的方式来获取,获取的是目标发射的能量(温度)
在这里插入图片描述
在陆地遥感中,将水体当成一种资源、土地利用的类型,不考虑水体内部的差异,把水体当成一个整体来考虑。

1.1.2 水色遥感图像模型
水色遥感:考虑的是水体内部的物质组成的遥感的推断或者是遥感的繁衍
在这里插入图片描述
首先看到的是表面的波,水下不是很清楚
在这里插入图片描述
能量来自于太阳辐射
传感器接收的能量有三种:大气中颗粒物等散射过来的光,经过水体表面反射过来的光,穿过水体离开水体反射过来的光
在这里插入图片描述
传感器接收的能量=水面的离水辐亮度+水面反射+大气散射
离水辐亮度=f(离水辐射)=水底发射+水中散射
在这里插入图片描述
对地物的观测时垂直观测,水色的观测时有一定角度的,因为需要避开水面的耀斑。
光学活性物质:对光学本身(入射的电磁波)具有反映的物质。
(如 悬浮颗粒物、浮游植物等)

陆地遥感与水色遥感的差异
在这里插入图片描述
1.3 大气遥感图像模型
在这里插入图片描述
如果大气足够的厚,地面能量为0.用大气遥感来推测大气中的物质成分或者浓度。
在这里插入图片描述
在做遥感研究的时候,首先要明确我们的遥感观测对象是什么,确定我们的遥感图像模型,确定合适的校正、处理和信息提取方法。遥感图像模型是所有工作的核心。

2 图像统计
图像统计的结果我们称为统计特征
在这里插入图片描述
遥感图像本身是没有颜色的,所有的颜色都是合成的结果。
在这里插入图片描述
图像本身是由多波段所构成的。
2.1 基本的统计特征
基本统计量
在这里插入图片描述
变差=max-min

2.2 直方图
在这里插入图片描述
在这里插入图片描述
直方图的简单应用: 判断对比度
在这里插入图片描述
灰度级越大,越亮

2.3 多波段统计特征
在这里插入图片描述
协方差和相关系数
在这里插入图片描述
在这里插入图片描述

二、源代码

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

% Last Modified by GUIDE v2.5 03-Dec-2014 19:30:18

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

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

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes ImgChangeDetect wait for user response (see UIRESUME)
% uiwait(handles.figure_main);


% --- Outputs from this function are returned to the command line.
function varargout = ImgChangeDetect_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_open1.
function pushbutton_open1_Callback(hObject, eventdata, handles)
%图像文件的打开
[fname, pname] = uigetfile({ '*.bmp';'*.tif';'*.jpg'}, '选择图片');
if isequal(fname,0)||isequal(pname,0)
    return;
else
    srcFile = [pname fname];
    img1 = imread(srcFile);
    axes(handles.axes_src1);
    imshow(img1);
    title('变化前图像');
    % 保存图像1
    handles.img_src1 = img1;
    guidata(hObject,handles);
end
    
% --- Executes on button press in pushbutton_open2.
function pushbutton_open2_Callback(hObject, eventdata, handles)
%图像文件的打开
[fname, pname] = uigetfile({ '*.bmp';'*.tif';'*.jpg'}, '选择图片');
if isequal(fname,0)||isequal(pname,0)
    return;
else
    srcFile = [pname fname];
    img2 = imread(srcFile);
    axes(handles.axes_src2);
    imshow(img2);
    title('变化后图像');
    % 保存图像2
    handles.img_src2 = img2;
    guidata(hObject,handles);
end

% --- Executes on button press in pushbutton_save.
function pushbutton_save_Callback(hObject, eventdata, handles)
% 保存结果图像
[fname, pname] = uiputfile({'*.bmp';'*.tif';'*.jpg' }, '保存图片为');
if isequal(fname,0)||isequal(pname,0)
    return;
else
    fpath = fullfile(pname,fname);% 获取全路径
end
img_res = handles.img_res;
imwrite(img_res,fpath);

% --- Executes on button press in pushbutton_exit.
function pushbutton_exit_Callback(hObject, eventdata, handles)
% 程序退出
close(handles.figure_main);


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


% --- Executes during object creation, after setting all properties.
function edit_nChange_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_nChange (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



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


% --- Executes during object creation, after setting all properties.
function edit_pChange_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_pChange (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
复制代码

三、运行结果

在这里插入图片描述
在这里插入图片描述

四、备注

版本:2014a

猜你喜欢

转载自juejin.im/post/6979929364553007118