https://github.com/damianfral/colortransfer
A small tool to try to transfer colors between images.
https://github.com/damianfral/colortransfer
colortransfer haskell hmatrix image-processing juicypixels nix
Last synced: about 1 year ago
JSON representation
A small tool to try to transfer colors between images.
- Host: GitHub
- URL: https://github.com/damianfral/colortransfer
- Owner: damianfral
- License: mit
- Created: 2014-07-20T20:24:15.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2025-04-01T18:29:44.000Z (about 1 year ago)
- Last Synced: 2025-04-01T19:39:59.653Z (about 1 year ago)
- Topics: colortransfer, haskell, hmatrix, image-processing, juicypixels, nix
- Language: Haskell
- Homepage:
- Size: 15.1 MB
- Stars: 11
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# colortransfer
`colortransfer` is a small tool that transfers the color distribution
of one image to another image. It offers two methods of color transfer,
histogram matching and ellipsoid transformation.
## Color Transfer Methods
### Histogram Matching
This method adjusts the mean and standard deviation of the color channels
in the input image to match those of the reference image. It's a simple
and effective approach for many cases, but it may not capture more
complex color relationships.
### Ellipsoid Transformation
The ellipsoid transformation method offers a more advanced approach to
color transfer:
- It models the color distributions of both the input and reference
images as 3D ellipsoids in the color space.
- The method then computes a transformation that maps the input image's
color ellipsoid to match the reference image's color ellipsoid.
- This transformation takes into account not just the mean and standard
deviation, but also the covariance between color channels, allowing for
a more nuanced color transfer.
- The result often preserves the relative relationships between colors
better than simple histogram matching, potentially leading to more
natural-looking results, especially for images with complex color
distributions.
## Run
```shell
nix run github:damianfral/colortransfer -- \
--input my-photo.jpg \
--reference nice-colors.jpg \
--output my-photo-with-nice-colors.jpg \
```
## Options
- `--input`: The image to be used as the color source
- `--reference`: The image we want to transform
- `--output`: The output image
- `--method`: The color transfer method to use (default: 2)
- 1: Histogram matching
- 2: Ellipsoid transformation
## Examples
| Input Image | Reference Image | Histogram Matching | Ellipsoid Transformation
|-------------|-----------------|--------------------|--------------------------
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 
|  |  |  | 