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

haar_like_feature generates Nan's #5449

Closed
MrAnisotropy opened this issue Jun 30, 2021 · 2 comments
Closed

haar_like_feature generates Nan's #5449

MrAnisotropy opened this issue Jun 30, 2021 · 2 comments

Comments

@MrAnisotropy
Copy link

MrAnisotropy commented Jun 30, 2021

haar_like_feature generates Nan's

I am using haar_like_feature in skimage and I am getting nan values for certain features. I have tested using various shape sizes, transposing the image, normalizing, making the dimensions odd and even but the problem remains.

For the minimal test below with a small test data of 17x9 I get 123 nan's. Checking the documentation and codes suggests that there is not a limitation of array shapes and I think the inputs are all correct.

If you can take a look I would be grateful. Thanks

Minimal Example

import numpy as np
import skimage.transform,skimage.feature

np.random.seed(0)
image         = np.random.random( (17,9) )

integralImage = skimage.transform.integral_image(image)

test          = skimage.feature.haar_like_feature(integralImage,0,0,\
                                                  integralImage.shape[0],integralImage.shape[1],\
                                                  feature_type=['type-3-x','type-3-y'])
print (np.sum(np.isnan(test)))

Version information

This was tested on Windows 7 and 10.

# Paste the output of the following python commands
from __future__ import print_function
import sys; print(sys.version)
import platform; print(platform.platform())
import skimage; print("scikit-image version: {}".format(skimage.__version__))
import numpy; print("numpy version: {}".format(numpy.__version__))
3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)]

Windows-10-10.0.18362-SP0

scikit-image version: 0.17.2

numpy version: 1.19.2
@MrAnisotropy
Copy link
Author

Turns out I had the width and height parameters flipped ! Closing the issue.

@MrAnisotropy
Copy link
Author

Flipped parameters for width and height. Closing the issue. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant