Substituting colors in earth image, with reference image
Posted: 2013-12-10T05:44:40-07:00
Hi all, I'm a long-time incompetent user of Imagemagick for simple operations, but first-time poster here on the forum as I'm trying something a bit complex manipulating satellite images to change their colors.
If anyone can describe the details of a credible approach to tackle what I want (using the right names for imagemagick operations), then I can have a go at figuring out the corresponding command line. Equally, if experts looking at the images reckon it's impossible to separate these colors sensibly, then I'll know to give up.
The project is to generate nice daily images of the earth from computer-generated globes rendered from geostationary satellites. The problem is that the pseudo-colors in the source images are a bit unnatural compared to people's expectations of maps (e.g. the sea is black, some of the clouds are a kind of light-blue). I need to be able to get the sea blue, and the clouds white, without visibly destroying any of the major continents! The colors of the land areas seem fine, and I'd like to preserve these. These will be printed fairly small for the project - which shows 5 years of globes, so the finished version will be forgiving of small errors.
You can see examples of the source images available at...
http://www.sat.dundee.ac.uk/geobrowse/g ... &slot=1200
I'm working with the 'Small' 'Colour' images available there.
I'm having trouble identifying what operations are available within Imagemagick to do this work effectively, and it's made more complex by a kind of differential reflection of light across the globe depending on the angle of incidence of the sun (e.g. the ocean in the centre of the globe is fairly reflective of the sun behind the satellite, whilst the edges of the globe are experiencing dawn or dusk and therefore brightness of the surface trails off).
I've had reasonable success using a Gimp select-by-color, then a color map operation, with the first being a color selection with a threshold by value (detecting the dark black pixels of the sea) then color mapping these selected areas to sea-blue, and the second being a color selection with a threshold by hue (detecting the light blue color), then color mapping these selected areas to cloud-white. You can see the results of the GIMP operations at http://cefn.com/gis/globe/
At the present time, something a bit like...
convert 2008_12_10_1200_MSG2_16_S4.png -fuzz 10% -fill blue -opaque "#030706" -fuzz 32% -fill white -opaque "#7cfffa" -fuzz 10% -fill '#BBBBBB' -opaque "#7d8091" out.png
...is close to the preferred result but there are areas (such as the direct reflection of the sun below the satellite) which are consistently incorrect and I can't figure out how to separate them using imagemagick operations. You can see this issue withing the images manipulated manually with GIMP too ( http://cefn.com/gis/globe/ ) at the centre of the globe, there's always a mid-grey blob, and towards the edges, there is also an increasing greyness. Changing the values to eliminate the central grey blob tends to also remove the Balkans and other countries towards the edge of the globe which are similar in light level.
I've attempted to understand some of Fred's scripts like those referenced at viewtopic.php?t=24052 but I'm having trouble figuring out how to do some operations within hue (picking out the blue clouds), and others within saturation (e.g. continents are colored, sea is black). There's something fundamental I'm missing about how these operations should be chained to create "greyscale" masks and then recombined. It may be that no correct series of operations is possible so I'll be led by people's suggestions on this.
Thanks for any ideas.
If anyone can describe the details of a credible approach to tackle what I want (using the right names for imagemagick operations), then I can have a go at figuring out the corresponding command line. Equally, if experts looking at the images reckon it's impossible to separate these colors sensibly, then I'll know to give up.
The project is to generate nice daily images of the earth from computer-generated globes rendered from geostationary satellites. The problem is that the pseudo-colors in the source images are a bit unnatural compared to people's expectations of maps (e.g. the sea is black, some of the clouds are a kind of light-blue). I need to be able to get the sea blue, and the clouds white, without visibly destroying any of the major continents! The colors of the land areas seem fine, and I'd like to preserve these. These will be printed fairly small for the project - which shows 5 years of globes, so the finished version will be forgiving of small errors.
You can see examples of the source images available at...
http://www.sat.dundee.ac.uk/geobrowse/g ... &slot=1200
I'm working with the 'Small' 'Colour' images available there.
I'm having trouble identifying what operations are available within Imagemagick to do this work effectively, and it's made more complex by a kind of differential reflection of light across the globe depending on the angle of incidence of the sun (e.g. the ocean in the centre of the globe is fairly reflective of the sun behind the satellite, whilst the edges of the globe are experiencing dawn or dusk and therefore brightness of the surface trails off).
I've had reasonable success using a Gimp select-by-color, then a color map operation, with the first being a color selection with a threshold by value (detecting the dark black pixels of the sea) then color mapping these selected areas to sea-blue, and the second being a color selection with a threshold by hue (detecting the light blue color), then color mapping these selected areas to cloud-white. You can see the results of the GIMP operations at http://cefn.com/gis/globe/
At the present time, something a bit like...
convert 2008_12_10_1200_MSG2_16_S4.png -fuzz 10% -fill blue -opaque "#030706" -fuzz 32% -fill white -opaque "#7cfffa" -fuzz 10% -fill '#BBBBBB' -opaque "#7d8091" out.png
...is close to the preferred result but there are areas (such as the direct reflection of the sun below the satellite) which are consistently incorrect and I can't figure out how to separate them using imagemagick operations. You can see this issue withing the images manipulated manually with GIMP too ( http://cefn.com/gis/globe/ ) at the centre of the globe, there's always a mid-grey blob, and towards the edges, there is also an increasing greyness. Changing the values to eliminate the central grey blob tends to also remove the Balkans and other countries towards the edge of the globe which are similar in light level.
I've attempted to understand some of Fred's scripts like those referenced at viewtopic.php?t=24052 but I'm having trouble figuring out how to do some operations within hue (picking out the blue clouds), and others within saturation (e.g. continents are colored, sea is black). There's something fundamental I'm missing about how these operations should be chained to create "greyscale" masks and then recombined. It may be that no correct series of operations is possible so I'll be led by people's suggestions on this.
Thanks for any ideas.