Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing clipping of dtype limits in is_low_contrast function #6774

Open
jo-fra opened this issue Mar 3, 2023 · 2 comments
Open

Missing clipping of dtype limits in is_low_contrast function #6774

jo-fra opened this issue Mar 3, 2023 · 2 comments
Labels

Comments

@jo-fra
Copy link

jo-fra commented Mar 3, 2023

When using the skimage.exposure.is_low_contrast function I observe different results if

a. passing a grayscale image of type uint8 with pixel range [0, 255] that I converted beforehand

versus:

b. passing an RGB image and let it be converted within is_low_contrast by line:

image = rgb2gray(image)

The reason is that after conversion by rgb2gray the image is of type float64 and the pixel range [0.0, 1.0].
However, in the following line dtype_limits is called with clip_negative=False:

dlimits = dtype_limits(image, clip_negative=False)

Which results in dlimits=(-1,1) and an unexpected value of the calculated ratio.

I expect dtype_limits should be called with clip_negative=True to receive the expected ratio.

@stefanv
Copy link
Member

stefanv commented Mar 3, 2023

Yeah, yikes, this is a bug, but also a subtle one because technically float dtypes do support negative numbers. @jni until skimage 2.0, would it make sense to change that range to (0, 1) everywhere instead of (-1, 1)?

@github-actions
Copy link

Hey, there hasn't been any activity on this issue for more than 180 days. For now, we have marked it as "dormant" until there is some new activity. You are welcome to reach out to people by mentioning them here or on our forum if you need more feedback! If you think that this issue is no longer relevant, you may close it by yourself; otherwise, we may do it at some point (either way, it will be done manually). In any case, thank you for your contributions so far!

@github-actions github-actions bot added the 😴 Dormant no recent activity label Aug 31, 2023
@github-actions github-actions bot removed the 😴 Dormant no recent activity label Sep 8, 2023
@lagru lagru added the 🐛 Bug label Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants