So, here it is : Command transfer_pca
is now available in the G’MIC stdlib
available after a $ gmic update
as usual (assuming you run G’MIC 2.8.0+).
Here is the command help :
gmic -h transfer_pca
gmic: GREYC's Magic for Image Computing: command-line interface
(https://gmic.eu)
Version 2.8.2 (pre-release #200110)
Copyright (c) 2008-2020, David Tschumperle / GREYC / CNRS.
(https://www.greyc.fr)
transfer_pca:
[reference_image],_color_channels
Transfer mean and covariance matrix of specified vector-valued reference image to selected images.
Argument 'color channels' is the same as with command 'apply_channels'.
Default value: 'color_channels=all'.
Example: [#1] sample lena,earth +transfer_pca[0] [1]
Good things with the G’MIC version of the pca-transfer implementation:
- It works for 3D volumetric images.
- It works for an arbitrary number of channels.
- It is parallelized.
- For a color image, you can specify which color channels are considered for the transfer.
So, if I do a similar thing to what is described in the article from Gatys, linked by @luluxXX, I can do it in two steps :
$ gmic sample zelda,earth +transfer_pca[0] [1],ycbcr_y transfer_pca[-1] [1],ycbcr_cbcr
which gives:
That’s all for tonight.
I’ve used some cool tricks to code this command, so I’m planning to do similar things in command transfer_histogram
to make it slightly faster.
After that, I’ll add this new PCA-transfer option to the style transfer algorithm of G’MIC, to see what happens…
Until then, good night, and have a great week-end