当前位置:网站首页>【 图像去雾】基于暗通道和非均值滤波实现图像去雾附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代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
边栏推荐
- What is eplato cast by Plato farm on elephant swap?
- Canvas 从入门到劝朋友放弃(图解版)
- 正则表达式
- Product axure9 English version, using repeater repeater repeater to realize multi-choice and single choice
- Important arrangements - the follow-up live broadcast of dx12 engine development course will be held at station B
- 网络必知题目
- ERD online 4.0.0 free private deployment scheme
- windbg
- 第三章 队列
- [Yugong series] July 2022 go teaching course 019 - for circular structure
猜你喜欢

并发编程的三大核心问题(荣耀典藏版)
![[hcip] routing strategy, strategic routing](/img/3d/9389fb441cdd3591595ed2918d928b.png)
[hcip] routing strategy, strategic routing

使用BigDecimal类型应该避免哪些问题?(荣耀典藏版)

新基建助力智能化道路交通领域的转型发展

retainface使用报错:ModuleNotFoundError: No module named 'rcnn.cython.bbox'

Ceresdao: the world's first decentralized digital asset management protocol based on Dao enabled Web3.0

OBS键盘插件自定义diy

小程序毕设作品之微信校园浴室预约小程序毕业设计成品(1)开发概要

When iPhone copies photos to the computer, the device connection often fails and the transmission is interrupted. Here's the way

Three core issues of concurrent programming (glory Collection Edition)
随机推荐
别人发你的jar包你如何使用(如何使用别人发您的jar包)
小程序毕设作品之微信校园维修报修小程序毕业设计成品(4)开题报告
windbg
mysql: error while loading shared libraries: libtinfo.so. 5 solutions
基于stm32的恒功率无线充电
Ceresdao: the world's first decentralized digital asset management protocol based on Dao enabled Web3.0
Red hat official announced the new president and CEO! Paul Cormier, a key figure in transformation, is "retiring"
MySQL 中的 INSERT 是怎么加锁的?(荣耀典藏版)
使用BigDecimal类型应该避免哪些问题?(荣耀典藏版)
Leetcode hot topic Hot 100 - > 2. Add two numbers
MySQL数据库InnoDB存储引擎中的锁机制(荣耀典藏版)
Today in history: the father of database passed away; Apple buys cups code; IBM chip Alliance
LETV responded that employees live an immortal life without internal problems and bosses; Apple refuses to store user icloud data in Russia; Dapr 1.8.0 release | geek headlines
【自我成长网站收集】
Read Plato & nbsp; Eplato of farm and the reasons for its high premium
feign调用get和post记录
Please, don't use the command line to configure MySQL master-slave replication. Isn't it fragrant to deploy with urlos interface?
0 dynamic programming medium leetcode873. Length of the longest Fibonacci subsequence
Interviewer: what is the factory method mode?
pytorch优化器设置