Matlab image processing _ de-fog algorithm

Source: Internet
Author: User


The use of MATLAB image of the fog operation, on-line search, this aspect of a lot of things, seems to have become a direction of research, Daniel!

Here just give a code, can achieve the image of the fog operation, a detailed look at the back there is no time, want to study their own research.

function darktest (filename)% shadow de-fog algorithm%filename------file name or absolute path to file% Usage: darktest (' 7.png ') close allclcw0=0.65;   %0.  The multiplication factor is used to retain some fog, 1 o'clock completely de-fog    t0=0.1;i=imread (filename), Figure;set (GCF, ' outerposition ', get (0, ' screensize ')); Subplot (221) imshow (I); title (' Original image '); [H,w,s]=size (I); Min_i=zeros (h,w);           % get shadow Channel image for I=1:h        for j=1:w dark_i (i,j) =min (i (i,j,:));    Endendsubplot (223) imshow (dark_i); title (' Dark Channnel graph '); Max_dark_channel=double (Max (max (dark_i)))  % Sky Brightness dark_channel=double (dark_i); t=1-w0* (Dark_channel/max_dark_ Channel);   % obtained subplot (224) t=uint8 (t*255), Imshow (t), title (' Graph of transmittance T '); T=max (t,t0);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%i1=double (I); J (:,:, 1) = Uint8 ((I1 (:,:, 1)-(1-T) *max_dark_channel)./t); J (:,:, 2) = Uint8 ((I1 (:,:, 2)-(1-T) *max_dark_channel)./t); J (:,:, 3) =uint8 ((I1 (:,: 3)-(1-T) *max_dark_channel)./t); subplot (222) Imshow (j); title (' Image after Fog '); end

the effect is as follows:

Matlab image processing _ de-fog algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.