Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to add fog to a image by Matlab

Status
Not open for further replies.

baij

Newbie level 3
Joined
Dec 8, 2007
Messages
3
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,298
How to add the fog to a image or make the image like covered by fog (Matlab) ?. Please help me and send me the code. Thanks a lot.
 

do u want to blure ur image?if yes then just do low pass filtering with image,other wise some noise functions are available in matlab see their documentation
 

Are you talking about distance fog, like this?
https://en.wikipedia.org/wiki/Image:CGfog.jpg

Fog is basically a decrease in contrast or linear blending with a solid color such as blue-gray, but the amount of blending varies according to the distance to the objects in the scene. That's not something you can easily do without depth info.
 

Thanks. Here my code
Code:
function im=FogEffect(i)

a = imadjust(i,[0.1 0.1 0.1; 1 1 1],[0 0 0; 1 1 1]);

[m,n,d] = size(i);
for w = 1:3
 for u = 1:m
    for v = 1:n
        if mod(v+u,2) == 0
            a(u,v,w) = 225;
        end
    end
 end
end

h = fspecial('gaussian',10,1);
im = imfilter(a,h);
end

and result

**broken link removed**
After
**broken link removed**

But it's not really real fog. Some one can help me develop this code. Thanks for your help.
 

What effect you are trying to achieve?
 

In some case, when the objects are near or far. My code can not make the real fog in the image.
 
A JPEG image doesn't contain any depth information.
MATLAB can't guess the object distances.
Maybe you could manually paint fog onto the image by using something like Photoshop.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top