Posted by
Michael Schmid on
Jan 13, 2015; 9:53pm
URL: http://imagej.273.s1.nabble.com/Re-Enhance-Contrast-Question-tp5011209.html
Hi Fatima,
if you have the lowest and highest pixel value of the range to display between black and white (c and d in your case, I call them 'min' and 'max' here:
In a Macro use
setMinAndMax(min, max);
and in Java
ip.setMinAndMax(min, max);
where ip is the ImageProcessor. You can get it for the current image via
ImagePlus imp = WindowManager.getCurrentImage();
ImageProcessor ip = imp.getProcessor();
Michael
________________________________________________________________
On Jan 13, 2015, at 21:54, fmerchant wrote:
> Using the site below the description for Contrast Stretching in the Enhance
> Contrast menu item is as follows
>
>
http://homepages.inf.ed.ac.uk/rbf/HIPR2/stretch.htm>
> For example for 8-bit graylevel images the lower and upper limits might be 0
> and 255. Call the lower and the upper limits a and b respectively.
>
> The simplest sort of normalization then scans the image to find the lowest
> and highest pixel values currently present in the image. Call these c and d.
> Then each pixel P is scaled using the following function:
>
> Pout = (Pin - c) (b-a/d-c) + a
>
> Values below 0 are set to 0 and values about 255 are set to 255.
>
> How do I call Enhance Contrast, with user-defined values for c and d in the
> formula above?
>
> Thanks,
> Fatima
>
>
>
>
> --
> View this message in context:
http://imagej.1557.x6.nabble.com/Enhance-Contrast-Question-tp5011207.html> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html