You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The blob detection functions all use img_as_float internally to convert integer inputs to normalized floats.
However, if the input is already a float, but has not been normalized, computation can take a very long time.
There is also a separate issue for blob_doh only in that float32 or float16 inputs will result in an error when calling a Cython function that expects double precision.
Way to reproduce
To reproduce, try the docstring example for blob_doh, but casting the input to float. It will get stuck running for a very long time:
fromskimageimportdata, featureimg=data.coins().astype(float) # non-normalized float# will get stuck running for a long timefeature.blob_doh(img)
# ValueError: Buffer dtype mismatch, expected 'double_t' but got 'float'feature.blob_doh(img.astype(np.float32))
Version information
scikit-image version: 0.19.0.dev0
Possible Solution
blob_doh should probably just use img_as_float64 internally so that accuracy is good for the integral_image computation and the input to the Cython function will always be float64.
I assume the slow operation is due to something like a poor default setting for thresholds in the case of non-normalized data. Should we add a check for the input range something like the following, or what is the best way to handle this?
ifimage.dtype.kind=='f':
ifimage.max() >1.0orimage.min() <0:
raiseValueError(
"input image with floating point type must have values normalized to ""[0.0, 1.0]")
The text was updated successfully, but these errors were encountered:
I ran up against this a couple weeks ago. I have unit tests that create "corner case" images, weird artifactural things that should never really happen, but I test them to indentify images that my analysis pipeline can't handle.
Anyway, this simple case will cause blob_log to hang (indefinitely?):
Description
The blob detection functions all use
img_as_float
internally to convert integer inputs to normalized floats.However, if the input is already a float, but has not been normalized, computation can take a very long time.
There is also a separate issue for
blob_doh
only in thatfloat32
orfloat16
inputs will result in an error when calling a Cython function that expects double precision.Way to reproduce
To reproduce, try the docstring example for blob_doh, but casting the input to
float
. It will get stuck running for a very long time:Version information
scikit-image version: 0.19.0.dev0
Possible Solution
blob_doh
should probably just useimg_as_float64
internally so that accuracy is good for theintegral_image
computation and the input to the Cython function will always be float64.I assume the slow operation is due to something like a poor default setting for thresholds in the case of non-normalized data. Should we add a check for the input range something like the following, or what is the best way to handle this?
The text was updated successfully, but these errors were encountered: