ZeroDivisionError: division by zero when running demo
jvence opened this issue · 1 comments
On Mac OS with python 3.7:
rohart.jpg
path: /Users/me/tmp/Fourier/FourierImages/rohart.jpg
[Application of the Fourier Transform.] Window has been created.
Traceback (most recent call last):
File "main.py", line 37, in
fourier()
File "/Users/me/tmp/Fourier/fourier_drawing/fourier.py", line 156, in call
self.events()
File "/Users/me/tmp/Fourier/fourier_drawing/fourier.py", line 170, in events
self.setMode((self.mode + 1) % 3)
File "/Users/me/tmp/Fourier/fourier_drawing/fourier.py", line 319, in setMode
self.setConstructionMode()
File "/Users/me/tmp/Fourier/fourier_drawing/fourier.py", line 334, in setConstructionMode
self.coefficients = Fourier.transform(self.sample, self.coefficients_number)
File "/Users/me/tmp/Fourier/fourier_drawing/fourier.py", line 34, in transform
cn /= npts
ZeroDivisionError: division by zero
Yes it can happen when no points has been selected in the construction mode. You have to select some points on your image by clicking on it. I could add a little warning but i just forgot to treat this case. I might fix it in future versions.