How to simulate weather conditions over a group of images

I'm working on a machine vision project and work with a sequence of recorded stock images to test my algorithms with. They are city images that were recorded in relatively good weather conditions. Now I would like to be able to simulate some alternative weather conditions using these same pictures. I'm thinking of rain, fog, maybe even snow.

I was wondering if I could apply a filter as it is explained on https://www.lifewire.com/produce-fake-rain-in-gimp-1701711 to 1000s of the stock images I'm using?

• Hi cerr, well explained, the question is? – Danielillo Aug 26 '18 at 22:00
• @Danielillo Hoops ;) sorry & fixed :) – stdcerr Aug 26 '18 at 22:20
• Better, but you should include the tags with the programs in which the possible answers should be made. The only clue about an application is a link at the question with a Gimp tutorial. I just add the Gimp tag. – Danielillo Aug 26 '18 at 22:35
• @Danielillo It doesn't need to be GIMP, it may also be in any other program, I'm not so fix, hence no GIMP tag, but I've added the open-source tag instead – stdcerr Aug 27 '18 at 0:09

An almost complete set of effects is provided with the G'Mic filters that come as a plugin for Gimp, and as a Web-Version.

Amongst the many filters there also is a rain & snow filter in the degradation setting where we can add various parameters as shown here in a web-preview:

There also is a command line interface for gmic which would allow batch processing of many input files.

To have an image processed with the values from the example above issue

 gmic input.png -fx_rain "65,10,50,0.1,1,1" -blend alpha,0.5 -output output.png


A preview will be displayed if -output output.png is omitted. Mutiple files should be processed with a script.

Forget it as long as you haven't any numerical measures for the effect in the image. Rain simulating software for photo editors won't tell to you anything in weather science terms. You cannot get any performance degradation measures if you haven't the variables. After it you can use artificial rain filters but as well you can add overlays in a multilayer photo editing software.

In the following image (a Windows sample photo) there's added partially transparent grey layers.

The image wide horizontal stripe which fills the lowest 1/4 is solid light grey with reduced opacity and the others are artistically filtered light grey from where all black is selected with color range selection and deleted. You can create, even paint manually your own overlays or make them with a rain filter. Insert them with a script to multiple images. Unfortunately I am weak in programming and thus cannot give such script.

Natural rain and snow live all the time, it's possible to filter them partially out if one has several images with the same content under interest. That of course can be possible only at short enough distances where the holes between the drops can be detected.

• I'm interested in degrading my pictures to some degree, to see how my algorithms would perform. I'm well aware that I can't "simulate" the exact conditions but this is also not what i'm looking for. – stdcerr Aug 27 '18 at 0:12
• @cerr I added more – user287001 Aug 27 '18 at 8:24

For fog, reduce the contrast (there is also Filters>Render>Clouds>Fog... but this for "close range" fog.

For rain/snow use the noise filters (Filter>Noise>RGB) on a new layers, and threshold (or strongly increase contrast) to transform that into spots.