【影象檢測】基於matlab GUI比值+歸一化+相關係數遙感影象【含Matlab原始碼 737期】

語言: CN / TW / HK

一、簡介

遙感影象模型和特徵\ 在這裡插入圖片描述\ 1 遙感影象模型\ 瞭解畫素值的含義\ 遙感影象模型考慮的是遙感影象中畫素值的 物理意義\ 對地觀測的遙感分為三部分:大氣遙感、水色遙感、陸地遙感\ 遙感影象中畫素值的物理意義:電磁波能量分佈的一種表達\ 在這裡插入圖片描述\ 1.1 陸地遙感的影象模型\ 在這裡插入圖片描述\ 在可見光遙感中,遙感影象中的能量和地物目標的反射率是成正比的\ 入射能量I是太陽輻射,這個基本上可以看成是常數\ 夜晚中,右側為0,L=左項 ,左側可以通過紅外的方式來獲取,獲取的是目標發射的能量(溫度)\ 在這裡插入圖片描述\ 在陸地遙感中,將水體當成一種資源、土地利用的型別,不考慮水體內部的差異,把水體當成一個整體來考慮。

1.1.2 水色遙感影象模型\ 水色遙感:考慮的是水體內部的物質組成的遙感的推斷或者是遙感的繁衍\ 在這裡插入圖片描述\ 首先看到的是表面的波,水下不是很清楚\ 在這裡插入圖片描述\ 能量來自於太陽輻射\ 感測器接收的能量有三種:大氣中顆粒物等散射過來的光,經過水體表面反射過來的光,穿過水體離開水體反射過來的光\ 在這裡插入圖片描述\ 感測器接收的能量=水面的離水輻亮度+水面反射+大氣散射\ 離水輻亮度=f(離水輻射)=水底發射+水中散射\ 在這裡插入圖片描述\ 對地物的觀測時垂直觀測,水色的觀測時有一定角度的,因為需要避開水面的耀斑。\ 光學活性物質:對光學本身(入射的電磁波)具有反映的物質。\ (如 懸浮顆粒物、浮游植物等)

陸地遙感與水色遙感的差異\ 在這裡插入圖片描述\ 1.3 大氣遙感影象模型\ 在這裡插入圖片描述\ 如果大氣足夠的厚,地面能量為0.用大氣遙感來推測大氣中的物質成分或者濃度。\ 在這裡插入圖片描述\ 在做遙感研究的時候,首先要明確我們的遙感觀測物件是什麼,確定我們的遙感影象模型,確定合適的校正、處理和資訊提取方法。遙感影象模型是所有工作的核心。

2 影象統計\ 影象統計的結果我們稱為統計特徵\ 在這裡插入圖片描述\ 遙感影象本身是沒有顏色的,所有的顏色都是合成的結果。\ 在這裡插入圖片描述\ 影象本身是由多波段所構成的。\ 2.1 基本的統計特徵\ 基本統計量\ 在這裡插入圖片描述\ 變差=max-min

2.2 直方圖\ 在這裡插入圖片描述\ 在這裡插入圖片描述\ 直方圖的簡單應用: 判斷對比度\ 在這裡插入圖片描述\ 灰度級越大,越亮

2.3 多波段統計特徵\ 在這裡插入圖片描述\ 協方差和相關係數\ 在這裡插入圖片描述\ 在這裡插入圖片描述

二、原始碼

```c 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

「其他文章」