djsutherland / vlfeat-ctypes

A ctypes interface to a (very small) subset of vlfeat.
BSD 3-Clause "New" or "Revised" License
21 stars 9 forks source link

can you help me ,error: integer divide by zero #8

Open FireJohnny opened 7 years ago

FireJohnny commented 7 years ago

Traceback (most recent call last): File "C:/Users/FireJohnny/Desktop/PHOW/sift.py", line 22, in vlfeat.vl_phow(img) File "C:\Python27\lib\site-packages\vlfeat__init__.py", line 25, in vl_phow return f(*args, **kwargs) File "C:\Python27\lib\site-packages\vlfeat\phow.py", line 109, in vl_phow smoothed = vl_imsmooth(image, sigma) File "C:\Python27\lib\site-packages\vlfeat\imsmooth.py", line 97, in vl_imsmooth filter, -W, W, step, flags) WindowsError: exception: integer divide by zero

I have this error ,i don't know how to fix it.

georgedeath commented 7 years ago

You need to provide the code you used to get this error for anyone to be able to help you, not just the traceback.

djsutherland commented 7 years ago

This division by zero is apparently happening inside the vlfeat library. I'm not sure what to do about that, though I could try updating the vlfeat binary since I haven't changed it in this package for a while... but as george said, it would be much more helpful if you could provide a minimal piece of code to replicate the error.

FireJohnny commented 7 years ago

here is my code : `#coding:utf-8 author = 'FireJohnny'

from PIL import Image from matplotlib import image import matplotlib.pyplot as plt

import vlfeat import numpy as np from numpy.random import shuffle

img = Image.open("timg.jpg") _image = np.array(image.imread("timg.jpg"))

img.show()

plt.imshow(_image)

plt.show()

img = img.convert("L") img = np.array(img)

img.show()

f,d = vlfeat.vl_dsift(img) kmean = vlfeat.vl_kmeans(f,1000)

sel = np.arange(f.shape(1))

shuffle(sel)

f1 = vlfeat.vl_phow(img)`

I have read your source code, but my knowledge is not enough to fully understand it。 that "timg.jpg" is "lean.jpg"

georgedeath commented 7 years ago

@FireJohnny I downloaded a random image off the internet (here), renamed to timg.jpg and ran your code. It worked fine.

Can you provide the image you are working on to see if we can recreate the error?

FireJohnny commented 7 years ago

@georgedeath This picture is what I uesed for my code. Thanks for your help.

georgedeath commented 7 years ago

I've tried your code with that image and it runs with no errors.

I can only suggest overwriting the vl.dll file in the "C:\Python27\lib\site-packages\vlfeat\" directory with a fresh copy contained in http://www.vlfeat.org/download/vlfeat-0.9.16-bin.tar.gz , in the bin/your_os directory.