Three methods of color transfer implemented in Python.
Input image | Reference image | Mean std transfer | Lab mean transfer | Pdf transfer + Regrain |
---|---|---|---|---|
效果不佳,舍弃 | ||||
Let input image be
-
Mean std transfer
$$O = (I - mean(I)) / std(I) * std(R) + mean(R).$$ -
Lab mean transfer1
$$I' = rgb2lab(I)$$ $$R' = rgb2lab(R)$$ $$O' = (I' - mean(I')) / std(I') * std(R') + mean(R')$$ $$O = lab2rgb(O')$$ -
Pdf transfer2
$O = t(I)$ , where$t: R^3\rightarrow R^3$ is a continous mapping so that$f{t(I)}(r, g, b) = f{R}(r, g, b)$ .
pip install python-color-transfer
git clone https://github.com/Uric369/color-transfer.git
cd python-color-transfer
pip install -r requirements.txt
- mode: “cover” / “output”
- method: “lt” / “mt”
- target: “leaf” / “trunk”
- (only “cover” mode)covered_image
- src_img_folder & src_names
- ref_img_folder & ref_names
- out_img_folder & out_names
Footnotes
-
Lab mean transfer: Color Transfer between Images by Erik Reinhard, Michael Ashikhmin, Bruce Gooch and Peter Shirley.
Open source's python implementation ↩ -
Pdf transfer: Automated colour grading using colour distribution transfer by F. Pitie , A. Kokaram and R. Dahyot.
Author's matlab implementation ↩