Open cosmin opened 3 years ago
This should be fixed by #7 — could you please have a look? I'm simply discarding the outer 1 px border of the gradient magnitude before calculating the standard deviation.
Indeed the sobel
function doesn't allow changing the behavior. One could implement it with lower-level functions (convolve
) but I suppose this amounts to the same.
LGTM. I think discarding the outer 1px is probably best solution, unless someone adds valid
option to scipy.ndimage.sobel
ITU-T Rec P.910 in Annex A, section A.1 defines the Sobel filter should be performed without border extension.
However scipy.ndimage.sobel uses a default mode of reflect. From the documentation there doesn't appear to be a mode for computing on only the valid range without border extension, therefore a mask should probably be applied to the output to discard the outer 1 pixel border from the results.
This has a minor impact on the resulting numerical values for SI, but it's probably a good idea to correct this nonetheless for consistency.