I have a RGB image. I want to compute the Optical Density of 开发者_StackOverflow社区a region of that image.
I have converted the Image to grayscale and I know the formula for Optical Density is log(1/illumination).
My procedure is to use roiploy to specify the ROI. But however this is not working and I never get a uniform answer.
What is the best way to do this? Should I use a mask? Will correlation be of any help between the mask and the original image?
What you get from roipoly is a mask - you need to apply that to your image with:
masked_image = image .* mask
Then each pixel of the masked image has a value corresponding to its illumination, assuming it came from a CCD camera.
As an aside, I'm a bit dubious about that formula for optical density - what happens when the illumination is zero?
精彩评论