Page 1 of 3
Convert 3D LUT to hald image
Posted: 2012-11-11T04:01:52-07:00
by Albert25
I have stills extracted from Alexa LOG-C material, and would like to apply a 3D (or 1D) LUT to them. ImageMagick can take a hald image and apply that. But how do I make the hald.png image I want?
I can get various LUT file formats from the
Alexa LUT Generator. I don't have any of the proprietary software these LUTs are intended for. Would someone know if any of these tools can export a hald image from the LUT?
- Adobe After Effects
Apple Color
Apple Shake
Assimilate Scratch
Autodesk
Autodesk Lustre
Blackmagic HD-Link
Cine-tal
Codex Digital
Colorfront
DaVinci Resolve
DFT Luther
Digital Vision Nucoda
DVS Clipster
Eyeon Fusion
Filmlight
Foundry Nuke
Iridas
Pandora
Pomfort Silverstack
Quantel
S.two
Sony SRW-1
Also, some (most?) of these formats seem to be really text files. Is there a tool that could convert the text format to a hald image?
Thanks.
Re: Convert 3D LUT to hald image
Posted: 2012-11-11T11:55:27-07:00
by fmw42
I have stills extracted from Alexa LOG-C material, and would like to apply a 3D (or 1D) LUT to them. ImageMagick can take a hald image and apply that. But how do I make the hald.png image I want?
create a new Hald image:
convert hald:8 hald.png
see
http://www.imagemagick.org/Usage/color_mods/#hald-clut
Take the hald.png image to some other GUI systems such as PS or GIMP. Process some image the way you want it. Keep track of the steps. Then repeat it exactly on the hald.png image. Then save that with some other name. Bring it back to IM and use -hald-clut to apply it to any image.
Repeat for any other processing with the starting hald.png image.
Re: Convert 3D LUT to hald image
Posted: 2012-11-20T04:32:51-07:00
by anthony
The HALD image is straight forward 3d sequence. Just look at a hald: image that ImageMagic generated (any image file format, though not JPeg) and you should be able figure out how to convert your 3D color data cube into a HALD image.
Re: Convert 3D LUT to hald image
Posted: 2012-11-20T08:07:20-07:00
by Albert25
Maybe I could convert the hald image to a text representation of RGB values of each pixel? (Can IM do that? Some other tool?) So I could get the hald image in text form, modify the values using my LUT, and convert back to a hald-with-lut.png image?
Re: Convert 3D LUT to hald image
Posted: 2012-11-20T11:05:18-07:00
by fmw42
What tools do you have to process images with your existing LUTs? Can you use them in GIMP or PS or any other tool to apply to an image? If so, use your 3D lut to modify the HALD 3D lut in that tool. Then bring back to IM?
What is the format of your lut? Is it an image or just text? Can you provide an example?
You can write out any image, including the 3D hald lut to txt format. See
http://www.imagemagick.org/Usage/files/#txt or use one of the NetPBM ASCII based image formats.
I think we really need to know more about your luts!
Re: Convert 3D LUT to hald image
Posted: 2012-11-20T15:47:09-07:00
by Albert25
fmw42 wrote:What tools do you have to process images with your existing LUTs?
None. That is my problem. As far as I know, GIMP cannot import a text LUT and apply it to an image. (Or can it?)
fmw42 wrote:What is the format of your lut? Is it an image or just text?
Text files in various formats. For example "After Effects" .cube (listing 32768 (32^3) points):
Code: Select all
# Alexa conversion LUT, logc2video, itu709. Full in/legal out.
# created by alexalutconv (2.07)
LUT_3D_SIZE 32
0.062561 0.062561 0.062561
0.062561 0.062561 0.062561
0.065555 0.062561 0.062583
[...]
0.915093 0.918866 0.918839
0.917384 0.918866 0.918856
0.918866 0.918866 0.918866
0.918866 0.918866 0.918866
Or less fine-grained "Scratch" .3dl (listing 4913 (17^3) points):
Code: Select all
# created by alexalutconv (2.07)
# Alexa conversion LUT, logc2video, itu709. Full in/legal out.
0 64 128 192 256 320 384 448 512 576 640 704 768 832 896 960 1023
256 256 256
256 256 262
256 256 391
[...]
3760 3760 3740
3760 3760 3756
3760 3760 3760
That sounds promising. I wasn't aware that IM could do that. Thank you.
I have now a 230 MB txt file of my 1727x1727 hald.png.
Now I "just" have to figure out how to convert each of these points with my 3D LUT, or how to correctly interpret and interpolate values for the new hald-with-lut.png pixels. When I find the right mathematics for that, applying it will just be a few lines of Perl...
Re: Convert 3D LUT to hald image
Posted: 2012-11-20T17:26:41-07:00
by fmw42
I think you need to understand what the text lut format is and what is is doing? Is there any documentation? Perhaps if we understood more about these text luts we could help further. But right now they are very unintelligible. How are they normally applied --- what software or hardware?
Re: Convert 3D LUT to hald image
Posted: 2012-11-20T17:54:18-07:00
by Albert25
I do understand what the 1D and 3D LUTs do. The
Wikipedia page is a good start. But that page then leads to
trilinear interpolation, which seems to be mathematics quite beyond the level I left school with (or maybe not, but I should have listened more carefully instead of concentrating on the girls...).
(This page explains the basics nicely:
http://www.lightillusion.com/luts.html . And this looks promising for the mathematics part:
http://stackoverflow.com/a/1641529/111036 )
Re: Convert 3D LUT to hald image
Posted: 2012-11-20T18:28:49-07:00
by fmw42
The 3x 1D lut format is just like an IM 1D image with 3 color channels. It can be converted from text into an image by using NetPBM format. At a minimum, you can create 3 1D grayscale images and use -combine to make it an RGB image. Then use -clut to apply the lut. You just need to provide the string of red values to create PGM image. Do that for each channel. Then use -combine. There may also be a more direct conversion to one of the other PBM formats.
see
http://www.imagemagick.org/Usage/color_mods/#color_lut
http://www.imagemagick.org/Usage/color_mods/#clut
http://www.imagemagick.org/Usage/color_mods/#fx_to_lut
see
http://www.imagemagick.org/Usage/formats/#pbmplus
http://netpbm.sourceforge.net/
Your 3D lut may be very similar to the HALD 3D image format. You just need to convert it to the right format. See
http://www.imagemagick.org/Usage/color_mods/#hald-clut. I do not know exactly the function that creates it, but Anthony made a very simple similar type image at
http://www.imagemagick.org/Usage/quantize/#332_colormap. Any way the best resource is the hald page at
http://www.quelsolaar.com/technology/clut.html
In either case you can set the interpolation to many modes using -interpolate. see
http://www.imagemagick.org/script/comma ... nterpolate
What you have not explained is how you normally apply those luts. There must be some software to apply them to an image. If so, use that software to apply the 3D lut to a Hald 3D image. That converts your lut into one that can be used directly by IM.
Re: Convert 3D LUT to hald image
Posted: 2012-11-21T07:35:51-07:00
by snibgo
Albert25 wrote:As far as I know, GIMP cannot import a text LUT and apply it to an image. (Or can it?)
Yes, it can. I do it all the time, though only with 3 x 1D LUT generated by external software in the PPM text format, then applying the LUT with IM's "-clut" operator.
I generally only care about one dimension at a time, generally luminence, although I use the same technique for some colour corrections using a 3-channel LUT.
A 3D hald LUT uses 3 values to look up an entry in the table, and gets three values out. If the examples you have seen have all three values monotonically increasing, they may be equivalent to IM's CLUT files, and thus trivial to convert.
(Linear interpolation is used when the input value falls between two entries in a 1D table. Bilinear interpolation is for 2D tables, and trilinear for 3D.)
Re: Convert 3D LUT to hald image
Posted: 2016-11-29T10:41:04-07:00
by wlange
Hello,
I'd like to repeat the question in the original request:
Is there a tool that could convert the text format to a hald image? (not in Photoshop or GIMP, but via command line!)
What I'd like to achieve is: apply an existing 3D LUT (.3dl or .cube text format) to an identity hald image generated by ImageMagick, to then be able to apply that to a given image using convert. Again, without using Photoshop or GIMP to generate a hald with the LUT in question applied.
Thanks a lot!
Re: Convert 3D LUT to hald image
Posted: 2016-11-29T11:12:29-07:00
by snibgo
wlange wrote:Is there a tool that could convert the text format to a hald image?
Not as far as I know. IM's hald format is well documented (in the code). If the .cube or .3dl format is also documented, then writing a script or C program for the conversion wouldn't be difficult.
Re: Convert 3D LUT to hald image
Posted: 2016-11-29T12:25:52-07:00
by wlange
Shouldn't it be supported by ImageMagick directly? I mean, it makes perfect sense, doesn't it?
Can you (or s.o. else) provide some an example that shows how to do it?
Thanks for your help.
Re: Convert 3D LUT to hald image
Posted: 2016-11-29T13:00:51-07:00
by snibgo
There are probably any number of formats for 3D LUT files, with no common interchange format. The CIF could be simple: many records, each with 6 numbers, representing input RGB and output RGB. This would be like the IM TXT: format, but with (R,G,B) coordinates instead of (X,Y) coordinates.
Re: Convert 3D LUT to hald image
Posted: 2016-11-29T13:14:50-07:00
by wlange
I see. The most common ones seem to be Autodesk .3dl and Adobe .cube. If these don't differ in themselves, that might be a good start.
I'm not an expert in this field. But if ImageMagick was able to utilize most common standards, it might help some folks. Just my $0,02.