Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Description
Problem
If one passes 8-bit RGB values to rgb_to_hsv, the results are nonsensical. rgb_to_hsv indeed explicitly states that inputs should be 0-1 floats, but it is not too difficult to accidentally pass 8-bit values instead (e.g., plt.imread() is inconsistent as to whether it returns one or the other).
Proposed solution
rgb_to_hsv could include some check for that.
- Checking that all values are exactly in [0, 1] may not actually be a good idea, as you could sometimes have values just a slop below 0 or above 1 due to earlier FP errors.
- I would instead suggest checking that the input is of floating point dtype; technically onecould be passing a 0-1 image with integer dtype (where all the values are 0 or 1) but this seems rare and confusion-prone anyways.