Hi list
I am struggling to set the brightness and contrast within a selection of an image. This works fine for 24-bit RGB images, but when attempting this on grey-scale images the whole image is windowed, rather than my selection. It is possible to work around this by switching types, but it is inelegant and not much good when working with floats. Is there a particular reason for this? Does anyone know of a trivial solution? Many thanks, Neil |
Neil,
I *think* this is the reason: With a greyscale image, the brightness/contrast adjustment provides the live feedback by adjusting the LUT associated the image. The LUT applies to the whole image and not just the ROI. However, you need only press the "Apply" button on the "Brightness & Contrast" palette for the changes to be applied to the ROI (changing the pixel values within the ROI). The LUT then gets reset and the pixels outside the ROI are thus unaltered. Since RGB images have no LUT, the interactive adjustment of brightness and contrast for RGB images is done by direct manipulation of the pixel data and this is done only to those pixels that lie within the ROI. In short, adjust the brightness and contrast to taste, then click on "Apply" and only the portion of the image in the ROI will be changed. Michael Ellis On 21 Feb 2010, at 14:11, ph73nt wrote: > Hi list > > I am struggling to set the brightness and contrast within a > selection of an > image. This works fine for 24-bit RGB images, but when attempting > this on > grey-scale images the whole image is windowed, rather than my > selection. It > is possible to work around this by switching types, but it is > inelegant and > not much good when working with floats. > > Is there a particular reason for this? Does anyone know of a trivial > solution? > > Many thanks, Neil > -- > View this message in context: http://n2.nabble.com/Brightness-contrast-selection-in-grayscale-images-tp4606825p4606825.html > Sent from the ImageJ mailing list archive at Nabble.com. Michael Ellis Managing Director Digital Scientific UK Ltd. http://www.digitalscientific.co.uk [hidden email] tel: +44(0)1223 329993 fax: +44(0)1223 370040 Sheraton House Castle Park Cambridge CB3 0AX The contents of this e-mail may be privileged and are confidential. It may not be disclosed to or used by anyone other than the addressee(s), nor copied in any way. If received in error, please advise the sender and delete it from your system. |
Hi Michael,
>With a greyscale image, the brightness/contrast adjustment provides >the live feedback by adjusting the LUT associated the image. The LUT >applies to the whole image and not just the ROI. However, you need >only press the "Apply" button on the "Brightness & Contrast" palette >for the changes to be applied to the ROI (changing the pixel values >within the ROI). The LUT then gets reset and the pixels outside the >ROI are thus unaltered. Did you actually try this? This does only work for 8-bit grayscale data, not for the probably more interesting 16 and 32 bit cases. As fas as I can see, this is because in the former case the effect of the modified LUT (which itself is based on only 8 bits) can be exactly duplicated by rewriting the data within the ROI, having to stick with any "rounding errors" caused by it. However, for 16 and higher bit cases it probably should be possible to duplicate the effect by a more complicated calculation without loosing too much of the extra resolution... Hmmmm! Mit freundlichen Grüßen / Best regards Joachim Wesner ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
Joachim Wesner,
Ah I only tried 8-bit grey scale! Any other higher bit depth greyscale gives the message below when you click on the "Apply" button "apply requires and 8-bit greyscale image or RGB stack" I stand corrected! FWIW though, 16 or 32 bit source data can be rendered efficiently with "small" LUTs too. Naturally you don't want to have giant LUTs with 2^32 entries, but you acceptably optimise this where the output domain is 8 bit . I tackled this problem in the past by calculating from the data min and max a suitable bitwise sift that would scale the source data into a 9 bit quantity. These 9 bits are then used to index a 9 bit LUT. This method is a good compromise and a fast brightness and contrast on 16 or 32 bit data can be achieved with a lookup like so: LUT[sample >> mNormRangeBitShift] Much cheaper than the full brightness and contrast arithmetic that you would otherwise use. The extra ninth bit is there to avoid loss of resolution that you would get by using the fast bit shift in place of the slow necessary scale and translate that you would require for mapping with maximum resolution to 8 bits (defeating much of the advantage of using a LUT at all) To the OP, what you attempting to achieve that prevents you converting the data to 8 bit? The Process->Math-> operations work on the ROI. Any use? Michael Ellis On 21 Feb 2010, at 22:49, Joachim Wesner wrote: > Hi Michael, > >> With a greyscale image, the brightness/contrast adjustment provides >> the live feedback by adjusting the LUT associated the image. The LUT >> applies to the whole image and not just the ROI. However, you need >> only press the "Apply" button on the "Brightness & Contrast" palette >> for the changes to be applied to the ROI (changing the pixel values >> within the ROI). The LUT then gets reset and the pixels outside the >> ROI are thus unaltered. > > Did you actually try this? This does only work for 8-bit grayscale > data, > not for the probably more > interesting 16 and 32 bit cases. As fas as I can see, this is > because in > the former case the > effect of the modified LUT (which itself is based on only 8 bits) > can be > exactly duplicated by > rewriting the data within the ROI, having to stick with any "rounding > errors" caused by it. > However, for 16 and higher bit cases it probably should be possible to > duplicate the effect > by a more complicated calculation without loosing too much of the > extra > resolution... Hmmmm! > > Mit freundlichen Grüßen / Best regards > > Joachim Wesner > > > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ Michael Ellis Managing Director Digital Scientific UK Ltd. http://www.digitalscientific.co.uk [hidden email] tel: +44(0)1223 329993 fax: +44(0)1223 370040 Sheraton House Castle Park Cambridge CB3 0AX The contents of this e-mail may be privileged and are confidential. It may not be disclosed to or used by anyone other than the addressee(s), nor copied in any way. If received in error, please advise the sender and delete it from your system. |
Thanks chaps
The "apply" button was overlooked and works as promised - great. As for working with 16/32 bit images, I'll have to work around having to re-window such images by displaying a copy in 8-bit and then any processing can be done (translating the ROIs from the 8-bit image if needed) on the 16/32 bit original without *too* much loss of speed. I'm more concerned about data integrity than loss of speed. Thanks again, Neil. |
Free forum by Nabble | Edit this page |