whitphx / lear-gist-python

A python wrapper for Lear's GIST implementation working with numpy
MIT License
55 stars 14 forks source link

There is someting wrong in readme.md #10

Closed qingmm closed 6 years ago

qingmm commented 6 years ago

It occurs Segmentationfault (core dumped)' when I follow the instructions in the Usage section, maybe it should be as following:

import gist
import numpy as np
from PIL import Image
from skimage import transform
fp = '/home/user/name.jpg'
pilimg = Image.open(fp)
img = np.asarray(pilimg)
# img_resized = transform.resize(img, (256, 256), preserve_range=True).astype(np.uint8) # this will zoom the img
desc = gist.extract(img)

The code above is from your file in sample/feature_extraction, it works well. Thank you for your code, it helps me a lot.

whitphx commented 6 years ago

@qingmm Thank you for reporting!

Please let me confirm that this is the code with which you faced the segmentation fault error, right?

import gist
import numpy as np

img = ... # numpy array containing an image
descriptor = gist.extract(img)

I found the error occurs when img is None. Can you please check whether it is in your case?

Anyway, this is a bug and I will fix it.

qingmm commented 6 years ago

@tuttieee Thank you for replying! Yes, it is, but I find I have misunderstanding your code before carelessly, I pass a imagepath to "img", so, your code is right, just not clear enough.

whitphx commented 6 years ago

mmm, I have added a comment like below:

img = ... # numpy array containing an image

Isn't it clear?

Anyway, I updated the code and it now throws TypeError unless the argument is of np.ndarray.