Open hgrecco opened 12 years ago
I also get segfault when the sampler is Nearest, Bilinear or Spline
To my surprise, the problem was in np.gradient. Everything got fixed when I changed to float32. Maybe the images are too big (1024, 1344)?
diff --git a/imreg/metrics/metric.py b/imreg/metrics/metric.py index b1fd29b..f141853 100644 --- a/imreg/metrics/metric.py +++ b/imreg/metrics/metric.py @@ -104,7 +104,7 @@ class Residual(Metric): | p = number of parameters. """
grad = np.gradient(np.asarray(warpedImage, dtype=np.float32))
dIx = grad[1].flatten()
dIy = grad[0].flatten()
I have a working script in my 32 bit python that fails when running in a 64 bit python with segmentation fault. The function that fails is:
def _shift(image, template):
Form the affine registration instance.
In addition to this: should I use https://github.com/pyimreg/imreg or https://github.com/pyimreg/python-register
Thanks