Message Boards Message Boards

1
|
20714 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Check if an image is saturated?

Posted 8 years ago

Hello,

I have an image (format: tiff). It is a 16 bit image. I am not an expert but I think that means I can have a dynamic range of 2^16=65.536. In other words, if my image is saturated, the values of these pixels must be this high. Basically, all I want to know is, if my image is saturated or not. Actually it is not just one image, it is a list of images. What would be a quick way to check this?

I tried different thinks, like Histogram, ImageData, ImageValuePositions, but I am not sure if I am on the right track.

Here is one of theses images.

enter image description here

I have tried quite many thinks. Here are just some examples:

Name= Import["C:\\Desktop\\image.tif"] 
Histogram[Flatten[ImageData@Name]]
ImageType[Name]
Histogram[Flatten[ImageData@Name]]
ImageHistogram[Name]
ImageData[Name]
PixelValue[Name, {1, 1}]
PixelValue[Name, {1, 1}, "Byte"]
PixelValue[Name, {138, 136}, "Byte"]

As I sad, it is quite randomly what I did. I am not really sure which parameter I actually have to check in order to see of the image is saturated or not.

I hope you can help me with this.

Cheers,

Peter

Attachments:
POSTED BY: Peter Parker
2 Replies

Thank you very much. I guess I can consider this problem as solved.

Cheers,

Peter

POSTED BY: Peter Parker

Peter,

With a 16 bit image, the possible range of pixel values is from 0 to 65535. One can not store a pixel value higher than 65535. Attaining this value in an image does not necessarily mean that the image i saturated. For example, after you run res = ImageAdjust[img], the pixel values in res will range from 0 to 65535 --- as a result of stretching the histogram of img.

If in your application you are sure that a 16bit image is saturated iff at least one pixel value is 65535, then you can check for saturation as follows: imageSaturatedQ[image_ /; ImageChannels@image == 1] := ImageMeasurements[image, "Max"] == 1

Note that I am using 1, not 65535 since ImageMeasurements returns normalized values. The next to highest value would correspond to 65534/65535, which is... not 1

POSTED BY: Matthias Odisio
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract