Given color components outside [0,1], currently we have the following:
- ImageShow/IJulia: clamp
- ImageView: uses minimum and maximum value as black and white
- Plots: errors
It would be nice to handle this consistently. I prefer the ImageView.jl behavior, since it generally lets you see as much data as possible. However, I will also suggest the following algorithm:
- Let
lo, hi = extrema(image)
- Black =
0 <= lo <= 1 ? 0 : lo
- White =
0 <= hi <= 1 ? 1 : hi
The intuition is as follows:
- If all values are between 0 and 1, just use them directly as intensities.
- If the values are all over the place, use the min and max as black and white (what ImageView does now).
- If values are generally in [0,1] but some go outside the range in one direction, rescale around 0 or 1 to bring those values back into range.
The advantage of this is that when some values overflow or underflow a bit, 0.5 still looks "grayish" just like it would if you clamped the values, but without losing information.
Given color components outside [0,1], currently we have the following:
It would be nice to handle this consistently. I prefer the ImageView.jl behavior, since it generally lets you see as much data as possible. However, I will also suggest the following algorithm:
lo, hi = extrema(image)0 <= lo <= 1 ? 0 : lo0 <= hi <= 1 ? 1 : hiThe intuition is as follows:
The advantage of this is that when some values overflow or underflow a bit, 0.5 still looks "grayish" just like it would if you clamped the values, but without losing information.