Page 1 of 1

Invert LUT and Equilize Histogram

Posted: 2016-03-08T10:12:11-07:00
by bhim.rathor
Hi,

Could some one please help in applying following to an 16 bit grayscal(or RGB).

1. Invert LUT
2. Enhance Contrast ( Equalize Histogram)

I have uploaded the steps that i took to do same in ImageJ and the sample input image. Please help in doing exact same thing in Image Magick.

https://drive.google.com/folderview?id= ... sp=sharing


Thanks
Rathor

Re: Invert LUT and Equilize Histogram

Posted: 2016-03-08T12:24:55-07:00
by snibgo
To equalise with IM, just use the "-equalize" operator.

IM doesn't contain operators for specialist processing of histograms (aka cluts) so I wrote some, as process modules. See my "Process modules" page. For example, to invert a clut, "-process invclut".

"[Adaptive] Contrast-limited equalisation" may also be of interest.

Re: Invert LUT and Equilize Histogram

Posted: 2016-03-08T12:51:03-07:00
by fmw42
Why do you need to invert the lut? I am not sure what your end goal is? What does a LUT have to do with histogram equalization? Are you doing two separate steps? 1) apply some LUT via -clut, then 2) -equalize.

Convert your LUT to an image if necessary. Then -negate the lut image, then use -clut to apply it. Then do -equalize.

(unix syntax)

Code: Select all

convert image \( lutimage -negate \) -clut -equalize resultimage
(windows syntax)

Code: Select all

convert image ( lutimage -negate ) -clut -equalize resultimage

Re: Invert LUT and Equilize Histogram

Posted: 2016-03-08T14:12:59-07:00
by bhim.rathor
Hi,

Frankly i do no know what an Invert LUT does, but doing this gives me the image i want to see( A Brighter , metallic effect image).

These are 2 separate steps. I will apply your command shortly and update you about the result.

Thanks for your help

Rathor

Re: Invert LUT and Equilize Histogram

Posted: 2016-03-08T15:52:05-07:00
by fmw42
If you cannot tell us what and inverted LUT is supposed to do, how can we know what to tell you to reproduce it in imagemagick?

Re: Invert LUT and Equilize Histogram

Posted: 2016-03-09T19:48:32-07:00
by bhim.rathor
Fred,

As per ImageJ , Invert LUT Inverts the current lookup table. For 8-bit images, the value (v) of each entry in the table is replaced by 255 − v. With inverted LUTs, pixels with a value of zero are white and pixels with a value 255 are black. Unlike the Edit▷Invert ↑ command, pixels values are not altered, only the way the image is displayed on the screen.

Full definition including equalize is available at http://rsbweb.nih.gov/ij/docs/guide/146-29.html

Please have a look and suggest something.

Thanks
Rathor

Re: Invert LUT and Equilize Histogram

Posted: 2016-03-09T19:52:50-07:00
by fmw42
My command above should do what you want. Repeated below:

Unix:

Code: Select all

convert image \( lutimage -negate \) -clut -equalize resultimage
Window:

Code: Select all

convert image ( lutimage -negate ) -clut -equalize resultimage
Doing the above is no different from but probably slightly faster than

Code: Select all

convert image -negate lutimage -clut -equalize resultimage
or

Code: Select all

convert image lutimage -clut -negate -equalize resultimage
The above assumes you have a LUT in image form. If you only have LUT values as a string or as a txt file, let us know and we can show you how to convert that into a LUT image.

Perhaps you should upload your image and lut to some free hosting service and put the URL here, so we can retrieve it and test with it.