Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 1beb281d authored by Emmanuel Roubin's avatar Emmanuel Roubin
Browse files

Generalize covariance function to any image shapes

parent dac97218
Pipeline #51811 passed with stages
in 25 minutes and 12 seconds
......@@ -63,3 +63,6 @@ ttkvenv
# latex
*.aux
*.log
# code OSS
.vscode
......@@ -84,7 +84,7 @@ def covarianceAlongAxis(im, d, mask=None, axis=[0, 1, 2]):
print('spam.measurements.covariance.covarianceAlongAxis: d={}. Should be a list of integers.'.format(type(d[0])))
print('exit function.')
return -1
if max(d) >= im.shape[0] or max(d) >= im.shape[1] or max(d) >= im.shape[2]:
if any([max(d) >= im.shape[i] for i in axis]):
print('spam.measurements.covariance.covarianceAlongAxis: max(d)={}. Should be smaller than the image.'.format(max(d)))
print('exit function.')
return -1
......@@ -115,8 +115,7 @@ def covarianceAlongAxis(im, d, mask=None, axis=[0, 1, 2]):
im_multi = numpy.multiply(im_multi, mask_eff, dtype=numpy.float32)
else:
# Step 2.1: Compute the pairs of numbers
size = im.shape[a]
n = (size - x) * size**2
n = (im.shape[a] - x) * numpy.prod([s for i, s in enumerate(im.shape) if i != a]) #
# Step 2.2: Multiply the image
im_multi = numpy.multiply(im, spam.helpers.singleShift(im, x, a, sub=0), dtype=numpy.float32)
# n_multi = numpy.sum(im_multi)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment