Issue when the nodes of the graph are set manually
Hi, I'm working with some periocular images and I did a customized way to define graph.
I know that you can do that setting the keyword argument nodes
in bob.ip.gabor.Graph(nodes=nodes)
.
My script is failing with the exception IndexError: tuple index out of range
, which is weird.
I created a simple script that reproduces the problem.
import bob.ip.gabor
import bob.io.base
import bob.io.image
import bob.ip.color
import numpy
import math
image = bob.ip.color.rgb_to_gray(bob.io.base.load("landmark.png"))
# create Gabor wavelet transform class
gwt = bob.ip.gabor.Transform(
number_of_scales = 5,
number_of_directions = 8,
sigma = 2. * math.pi,
k_max = math.pi / 2.,
k_fac = math.sqrt(.5),
power_of_k = 0,
dc_free = True)
for i in range(2):
trafo_image = numpy.ndarray((gwt.number_of_wavelets, image.shape[0], image.shape[1]),
numpy.complex128)
nodes = [(10,10),(10,20),(10,30),
(20,10),(20,20),(20,30)]
graph = bob.ip.gabor.Graph(nodes=nodes)
#graph = bob.ip.gabor.Graph(first=(10,10), last=(100,100), step=(10,10))
# perform Gabor wavelet transform
gwt.transform(image, trafo_image)
jets = graph.extract(trafo_image)
print len(jets)
Here we have the exception raised:
Traceback (most recent call last):
File "error_gabor.py", line 20, in <module>
for i in range(2):
IndexError: tuple index out of range
When I try to debug with ipdb, the exception is not raised. I suspect that we have a memory issue.
We don't have this issue when we I set the grid automatically.
Follow attached the image