12

I have a large amount of RapidEye images (+300 Gb) that I want to use as a basemap for a online application. So far I've managed to serve them as an ImagePyramid in geoserver following the steps shown in a presentation called "Geoserver on steroids". The problem is that I haven't been able to do a proper color balance so when looking at the entire dataset, the mosaic looks very poor but as I zoom in, it gets better (pictures bellow).

My process is:

  1. Convert all images to 8bits, epsg 4326, cubic interpolation using gdal
  2. Generate a gdal virtual raster with all the images (gdalbuildvrt)
  3. Generate the image pyramid (gdal_retile with compression and geotiff tilling) and publish on geoserver (using histogram stretch in the layer style)

Any tips on how to improve the process and get better color balance?

enter image description here enter image description here enter image description here

3 Answers 3

6

I believe I got it.

I forced a mean +-2 Standard Deviation histogram stretch in each RapidEye image during the conversion to 8bit.

I used a python script to identify the image min, max, average and SD. I then set the value of mean - 2SD (or image min, whichever was higher) to 2 and mean + 2SD (or max) to 254. And just to be safe, the original value of zero in the image was set to 1 and 2^16 set to 255. NoData was set to 0.

These are the transfer function vectors:

original image values = [0, mean-2SD, mean+2SD, 65536]
rescaled values = [1 2, 254, 255]

Below are some screen captures. The problems I have to fix now are

  1. Remove theblack border around the imagePyramid
  2. Get a better looking image when zoomed to full extent. It now looks like an old TV tunned to the wrong channel

enter image description here enter image description here enter image description here

Edit
I've now placed the code on GitHub. It's been a while since I used it. The code is a bit messy and so is the repository. But should still work.
https://github.com/dvictori/rapideye_hist2sd

8
  • Bravo, sir. You get 10 out of 10 for this. As for your second concern (better looking when zoomed to full extent), could you simply using lower-grained imagery, such as LandSat, or ASTER? I think the coarser imagery would look better when zoomed out. ..as for your first concern, I'm still trying to crack that nut, myself. I'd love to see a comprehensive write-up for how you did this, including the py script if you're willing to share it. Any chance you plan to present your approach anywhere?
    – elrobis
    Jun 5, 2014 at 16:29
  • I was not planning on presenting this or doing a write-up. But now that you mentioned, who knows. Any suggestions as to an appropriate media for presenting this? As for the py script, you can download it from dropbox.com/s/1hfobfp9ymtku2n/rapideye_hist2sd.py However, be warned. I consider myself a crappy programmer and I'm sure my program could use a lot of improvements.
    – Daniel
    Jun 5, 2014 at 17:48
  • 2
    I changed the download link from the above comment. If you want to look at the python code I used, you are welcome to download it from goo.gl/ePEc7G
    – Daniel
    Jun 6, 2014 at 12:17
  • Thanks @Daniel. I keep a blog where I post how-to's for such stuff. If I stumble onto something that wasn't easy, and for which I couldn't find much help around the web, I'll make a blog post for a couple reasons. First, I assume I'll need to repeat the task sometime, so if I consolidate the steps into a post then I can easily review them later. Second, I figure there's always a chance someone out there wants to do something similar, and they might benefit from the post. What you did here is very blog-worthy, even if it's your only post for awhile. :)
    – elrobis
    Jun 6, 2014 at 18:21
  • This is an amazing idea, and I'm trying to adapt it for a smaller frame, 3 band camera going from 8 bit to 8 bit, but I'm having some trouble implementing it. How should I direct the directory of input images to this script? Where are they being called from? I guess this must all be running through geoserver, but can I break this out and run it standalone?
    – Wes
    Aug 13, 2015 at 11:21
4

Daniel, are these images from very different seasons? Or times of day? If they are different seasons, then getting good color balance may be pretty tough. But if they are different times of day, then applying a correction for sun angle may help noticably. A good first order approximation for sun angle is to multiply the pixels times 1.0/cos(angle_of_sun_off_directly_above). So no adjustment if the sun is directly above, increasing to ... well infinity as you approach dawn/dusk.

I've had bad results in the past using histogram matching between scenes on overlapping regions to assemble large mosaics because you get strange drifting effects across the mosaic. I think a more useful approach might be some sort of histogram matching against a base color target image (perhaps an attractive landsat mosaic of the area). I'm also interested in how to resolve this problem. Charlie Loyd at MapBox might also have thoughts.

1
  • Frank, the images are mostly from the dry season, when cloud cover is low. But there are images from different months, such as august, november, etc. I'm now trying to split the images into small blocks and do a mosaic for each. Will let you know how it turns out. I also wrote a python script to do a CDF match and it works fine (not great) when I have a small number of images (20) but when I get to a large number, one of the images is bound to have values outside my reference image range and then things stop working. Might have to think of a better way to select the reference image.
    – Daniel
    May 28, 2014 at 1:08
0

I have sometimes used OSSIM Image linker with histogram matching for making colour balanced mosaics. Image linker tutorial gives some example http://download.osgeo.org/ossim/docs/pdfs/ImageLinker_Tutorial.pdf However, Image linker is not actively maintained and I do not know if it works any longer. Ossim geocell is the current program but there is not much user documents about that. I remember that for achieving a good result I preprocessed my Landsat scenes first one by one with OpenEV by applying some LUT stretch for making the images to have visually about the same appearance. Then it was easier for OSSIM to make the final matching. The end product looked about as good as the one I made with ER Mapper mosaic utility.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.