Repository navigation
Show warnings for input image type in threshold_otsu - #1876
Conversation
54541ed to
10135d8
Compare
|
Hey @OrkoHunter! Small comment: "Grayscale" -> "grayscale". Slightly bigger comment: the message is not quite descriptive enough. I would say something like: You need to be specific because if someone gives a 3D grayscale image that happens to have (3) as the last dimension, the user will be confused. Bigger comment: you should now wrap any test that raises a warning using Finally, I don't think we should convert to grayscale before the computation because iirc that uses the luminance channel after a conversion to Lab colorspace. It would then be meaningless to use that threshold on the original RGB. Thanks! |
|
The idea would be convert to luminance, then return the threshold of the I cannot think of any reason we need to provide per-channel thresholding
|
1cb04cc to
ff03535
Compare
|
@jni All three comments addressed. Any other test using |
ff03535 to
a2d75de
Compare
|
Had to replace |
|
We've got to keep 2.6 until 0.12 is tagged and released - soon, but not yet
|
Show warnings for input image type in threshold_otsu
|
@OrkoHunter great, thanks! @JDWarner yes, per-channel can be done manually, which is what I do now. But automatically converting to luminance is, imho, dangerous, because the user will not have the luminance image, and they might try to apply the threshold directly to the RGB image (as per our many examples). It's magical behaviour that quite plausibly would cause errors. |
Address #1867
The
threshold_otsufunction only supports grayscale image as input and results in unexpected behavior when used with an RGB image.This PR tries to improve the documentation of the function and raise a temporary warning for the usage with an RGB image.
Question : Should we convert the image into grayscale as @JDWarner suggested by using
rgb2grayand return the result for it? Or should we let the user use the faulty output? If we go withrgb2graysolution, we can probably add a line about it in the warning.