Creating a LUT out of a difference between two images

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Post Reply
krko
Posts: 1
Joined: 2015-09-25T10:54:38-07:00
Authentication code: 1151

Creating a LUT out of a difference between two images

Post by krko »

Hello,

I was wondering if ImageMagick can do the following...
Lets say I have two identical images. On one of the two I do some color editing.
I'd like ImageMagick to compare these two images (before and after the colors edit) and out of the color difference between them create a 3D LUT so basically now I can apply the same color edit to some other image via a 3d LUT. Or even a video.
I'd apply the 3D LUT to some other image via a different software, what I'd like to know is can ImageMagick create the LUT out of a comparison between the images.

One software that can do so is Light Illusion's MatchLight IMS, however it's darn expensive.

Thank you,
krko
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Creating a LUT out of a difference between two images

Post by fmw42 »

You can create a Hald 3D lut image and process it the same way you process your image. Then the new hald image can be used with -hald-clut to process any other image. You can even create the hald image, take it to GIMP or PS and process it the same way you process your image there, save it (without compression, so no JPG) and bring it back to IM and then use it with -hald-clut.

I do not know that IM can create the hald lut image by comparing two images.

However, I do have a script, histmatch at the link below (for unix systems), that can take one image and process a second image so that the histograms match. This would not be as good as using the HALD approach, but it does not required an external lut.

see
http://www.imagemagick.org/Usage/color_mods/#color_lut (especially the HALD sections)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Creating a LUT out of a difference between two images

Post by snibgo »

krko wrote:I'd like ImageMagick to compare these two images (before and after the colors edit) and out of the color difference between them create a 3D LUT ...
I don't think any IM command can do this, aside from something really complex and horrible and clumsy.

It could be written in C:

1. Create an empty 3DLUT.

2. Sparsely populate this, using one image as the indexes to the table, the other as the values to put into those indexes.

3. Complete the missing entries by interpolation. This could be by 3D triangulation or some other method. (This is the same problem that IM's "sparse-color:" solves in 2D.)

As Fred says, equalizing histograms (effectively by creating a 1D LUT for each channel) is simpler.
snibgo's IM pages: im.snibgo.com
Post Reply