项目作者: mapbox

项目描述 :
Histogram matching plugin for rasterio
高级语言: Python
项目地址: git://github.com/mapbox/rio-hist.git
创建时间: 2016-05-10T12:49:15Z
项目社区:https://github.com/mapbox/rio-hist

开源协议:

下载


Build Status
Coverage Status

rio-hist

Histogram matching plugin for rasterio.

Provides a CLI and python module for adjusting colors based on histogram matching in a variety of colorspaces.

Example

We have a source image that we want to alter.
We have a reference image with a histogram that we like.
The goal is to adjust the values of the source image so that its histogram matches that of the reference.

The matching directly in the default RGB colorspace does not always give the best results. So for this example, we’ll adjust based on the Lightness and Chroma in LCH colorspace.

  1. $ rio hist -c LCH -b 1,2 --plot source.tif reference.tif output.tif

This will give us a new output.tif that matches the histogram of reference. And the --plot option
also allows us to see some diagnostic plots to inspect the results and the cumulative distribution functions of the matching process.

CLI docs

  1. $ rio hist --help
  2. Usage: rio hist [OPTIONS] SRC_PATH REF_PATH DST_PATH
  3. Color correction by histogram matching
  4. Options:
  5. -c, --color-space [RGB|LCH|LAB|Lab|LUV|XYZ]
  6. Colorspace
  7. -b, --bands TEXT comma-separated list of bands to match
  8. (default 1,2,3)
  9. -m, --match-proportion FLOAT Interpolate values between source and
  10. reference histogram. 1.0 (default) is full
  11. match, 0.0 is no match
  12. --plot create a <basename>_plot.png with diagnostic
  13. plots
  14. -v, --verbose
  15. --co NAME=VALUE Driver specific creation options.See the
  16. documentation for the selected output driver
  17. for more information.
  18. --help Show this message and exit.

Python docs

rio_hist.match.histogram_match is the main entry point and operates on a single band.

rio_hist.utils has some interesting functions that may be useful in other contexts.