当前位置:网站首页>【 图像去雾】基于暗通道和非均值滤波实现图像去雾附matlab代码
【 图像去雾】基于暗通道和非均值滤波实现图像去雾附matlab代码
2022-07-28 01:30:00 【matlab_dingdang】
1 内容介绍
雾实际上是由悬浮颗粒在大气中的微小液滴构成的气溶胶,常呈现乳白色,其底部位于地球表面,所以也可以看作是接近地面的云。霭其实跟雾区别不大,它的一种解释是轻雾,多呈现灰白色,与雾的颜色十分接近。广义的雾包括雾、霾、沙尘、烟等一切导致视觉效果受限的物理现象。由于雾的存在,户外图像质量降低,如果不处理,往往满足不了相关研究、应用的要求。在雾的影响下,经过物体表面的光被大气中的颗粒物吸收和反射,导致获取的图像质量差,细节模糊、色彩暗淡。


2 仿真代码
function varargout = txrh(varargin)% TXRH MATLAB code for txrh.fig% TXRH, by itself, creates a new TXRH or raises the existing% singleton*.%% H = TXRH returns the handle to a new TXRH or the handle to% the existing singleton*.%% TXRH('CALLBACK',hObject,eventData,handles,...) calls the local% function named CALLBACK in TXRH.M with the given input arguments.%% TXRH('Property','Value',...) creates a new TXRH or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before txrh_OpeningFcn gets called. An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to txrh_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 txrh% Last Modified by GUIDE v2.5 22-Apr-2019 21:49:06% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @txrh_OpeningFcn, ...'gui_OutputFcn', @txrh_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{:});elsegui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before txrh is made visible.function txrh_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 txrh (see VARARGIN)% Choose default command line output for txrhhandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes txrh wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = txrh_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 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)global I[filename,pathname]=uigetfile({'*.bmp;*.tif;*.png','(*.bmp;*.jpg;*.gif;*.tif)';'*.bmp','(*.bmp)';'*.jpg','(*.tif)';'*.gif','(*.tif)';},'打开图片');if isequal(filename,0)||isequal(pathname,0)%§ìreturn;elseI=imread([pathname,filename]);end% [m,n,l]=size(I1);%读取图片1显示% if l==3% I1=rgb2gray(I1);% endaxes(handles.axes1)imshow(I)title('原图')% --- Executes on button press in pushbutton2.% --- 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)global I ;% %matlab 2014a% clc;% clear all;% [filename,pathname]=uigetfile({'*.jpg;*.bmp;*.tif;*.png;*.gif','All Image Files';'*.*','All Files'});% I = imread([pathname,filename]);%读入图像%% figure;% set(gcf,'outerposition',get(0,'screensize'));% imshow(I);xlabel('原始图像');[h,w,s]=size(I);min_I=zeros(h,w);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%获得暗通道图像for i=1:hfor j=1:wdark_I(i,j)=min(I(i,j,:));endendfigure;imshow(dark_I);xlabel('暗通道图像');%imwrite(dark_I,'dark_I.jpg');Max_dark_channel=double(max(max(dark_I))) %天空亮度dark_channel=double(0.9*dark_I);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%非局部均值滤波%参数T=5;h=6.5;t=3;f=1;for t=1:TI0=NLmeans(dark_channel,t,f,h);endfigure; imshow(uint8(I0));xlabel('非均值滤波后图像')%function edit10_Callback(hObject, eventdata, handles)% hObject handle to edit10 (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 edit10 as text% str2double(get(hObject,'String')) returns contents of edit10 as a double% --- Executes during object creation, after setting all properties.function edit10_CreateFcn(hObject, eventdata, handles)% hObject handle to edit10 (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
3 运行结果


4 参考文献
[1]戢凯, 王晓峰. 融合暗通道和颜色衰减先验的图像去雾算法[J]. 现代计算机, 2018, No.622(22):36-41.
[2]王洪玉等. "基于暗通道与非局部先验的图像去雾方法及系统.", 2019.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
边栏推荐
- 2022.7.8 supplement of empty Luna
- This operation may not be worth money, but it is worth learning | [batch cutting of pictures]
- Newline required at end of file but not found.
- Three core issues of concurrent programming (glory Collection Edition)
- [Yugong series] July 2022 go teaching course 019 - for circular structure
- [hcip] routing strategy, strategic routing
- LeetCode 热题 HOT 100 -> 1.两数之和
- AWS elastic three swordsman
- Digital empowerment and innovation in the future: hese eredi appears at the 5th Digital China Construction Summit
- MySQL's way to solve deadlock - lock analysis of common SQL statements
猜你喜欢

Unity saves pictures to albums and rights management

「冒死上传」Proe/Creo产品结构设计-止口与扣位

mysql 如图所示,现有表a,表b,需求为 通过projectcode关联a、b表,查出address不同的 idcardnum。

Three core issues of concurrent programming (glory Collection Edition)

Understand the "next big trend" in the encryption industry - ventures Dao

The virtual host website cannot access the self-test method

Explore flex basis

Wechat campus maintenance and repair applet graduation design finished product of applet completion work (4) opening report

TypeScript(零) —— 简介、环境搭建、第一个实例

JS event loop synchronous task, asynchronous task (micro task, macro task) problem analysis
随机推荐
实际工作中,我是如何使用 Postman 做接口测试?
Which users are suitable for applying for rapidssl certificate
What can you say to comfort your girlfriend or daughter-in-law
unordered_map的hash function及hash bucket存储方式探索
Feign calls get and post records
0动态规划中等 LeetCode873. 最长的斐波那契子序列的长度
【自我成长网站收集】
Design of edit memory path of edit box in Gui
Sword finger offer special assault edition day 12
Get the difference data of two sets
[advanced ROS chapter] Lecture 10 gadf integrated simulation process and examples based on gazebo
Use of Day6 functions and modules
"Risking your life to upload" proe/creo product structure design - seam and buckle
作业7.27 IO进程
[in depth study of 4g/5g/6g topic -42]: urllc-14 - in depth interpretation of 3GPP urllc related protocols, specifications and technical principles -8-low delay technology-2-slot based scheduling and
Say yes, I will love you, and I will love you well
重要安排-DX12引擎开发课程后续直播将在B站进行
[understanding of opportunity -53]: Yang Mou stands up and plots to defend himself
初识C语言 -- 操作符和关键字,#define,指针
初识C语言 -- 结构体,分支和循环语句