小程序开发基础: 从零开始打造自己的小程序
952
2022-11-12
matlab图像去雾技术GUI界面-全局平衡直方图
1、内容简介
略 431-可以交流、咨询、答疑
2、内容说明
略
3、仿真分析
function varargout = main(varargin)% MAIN MATLAB code for main.fig% MAIN, by itself, creates a new MAIN or raises the existing% singleton*.%% H = MAIN returns the handle to a new MAIN or the handle to% the existing singleton*.%% MAIN('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in MAIN.M with the given input arguments.%% MAIN('Property','Value',...) creates a new MAIN or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before main_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to main_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 main% Last Modified by GUIDE v2.5 14-Apr-2019 17:22:46% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @main_OpeningFcn, ... 'gui_OutputFcn', @main_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []);if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1});endif 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 main is made visible.function main_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 main (see VARARGIN)% Choose default command line output for mainhandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes main wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = main_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 structurevarargout{1} = handles.output;% --- Executes on selection change in popupmenu1.function popupmenu1_Callback(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array% contents{get(hObject,'Value')} returns selected item from popupmenu1global Img2%具体算法实现val=get(handles.popupmenu1,'value');switch val case 1 if isequal(handles.Img1, 0) msgbox('请载入图像!', '提示信息'); return; end Img2 = RemoveFogByGlobalHisteq(handles.Img1, 0); axes(handles.axes2); imshow(Img2, []); case 2 if isequal(handles.Img1, 0) msgbox('请载入图像!', '提示信息'); return; end Img2 = RemoveFogByLocalHisteq(handles.Img1, 0); axes(handles.axes2); imshow(Img2, []); case 3 if isequal(handles.Img1, 0) msgbox('请载入图像!', '提示信息'); return; end Img2 = RemoveFogByRetinex(handles.Img1, 0); axes(handles.axes2); imshow(Img2, []);end% --- Executes during object creation, after setting all properties.function popupmenu1_CreateFcn(hObject, eventdata, handles)% hObject handle to popupmenu1 (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 pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% 打开warning off all;% 载入图像[FileName,PathName] = uigetfile({'*.jpg;*.tif;*.png;*.gif', ... '所有图像文件';... '*.*','所有文件' },'载入图像',... '.\images\\sweden_input.jpg');if isequal(FileName, 0) || isequal(PathName, 0) return;endImg1 = imread(fullfile(PathName, FileName));axes(handles.axes1);imshow(Img1, []);handles.Img1 = Img1;handles.Img2 = 0;guidata(hObject, handles);% --- Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global Img1 Img2%直方图figure('Name', '直方图对比', 'NumberTitle', 'Off', ... 'Units', 'Normalized', 'Position', [0.1 0.1 0.5 0.5]);one = rgb2gray(handles.Img1);two = rgb2gray(Img2);subplot(2, 2, 1); imshow(handles.Img1); title('原图','FontWeight', 'Bold');subplot(2, 2, 2); imshow(Img2, []); title('处理后的图','FontWeight', 'Bold');subplot(2, 2, 3); imhist(one,64); title('原灰度直方图', 'FontWeight', 'Bold');subplot(2, 2, 4); imhist(two,64); title('处理后的灰度直方图', 'FontWeight', 'Bold');one = rgb2gray(handles.Img1);axes(handles.axes3);imhist(one,64);axes(handles.axes4); imhist(two,64);% --- Executes on button press in pushbutton3.function pushbutton3_Callback(hObject, eventdata, handles)% hObject handle to pushbutton3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% 截图保存SnapImage();% --- Executes on button press in pushbutton4.function pushbutton4_Callback(hObject, eventdata, ~)% hObject handle to pushbutton4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)%退出close();
4、参考论文
略
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~