Color balance and publish large amount of high resolution imagery in geoserver
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
- Remove theblack border around the imagePyramid
- Get a better looking image when zoomed to full extent. It now looks like an old TV tunned to the wrong channel
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
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.