Questions tagged [scipy.ndimage]
50 questions
1
vote
2 answers
Why does find_objects give a bunch of Nones and then range of the whole image?
I am trying to find all objects detected in difference of frames, I thougt this would give a list of each area detected in the threshold, but find_objects is giving a bunch of "None"s and a range of the whole…

NoBugs
- 9,310
- 13
- 80
- 146
1
vote
0 answers
Any recommendation to resize 3d image array which consists of only 0 and 1?
I want to resize(downscale) the ground truth 3d images of brain tumor segmentation.
Here are some g.t. + brain images:
G.t. images are 3d numpy array and consist of only 0 and 1 value(only green voxel and black voxel, brain is not included in g.t.…

Crispy13
- 230
- 1
- 3
- 16
1
vote
1 answer
What are the values (coefficients) of a Gaussian Kernel?
A Gaussian filter can be applied to an image using the following commands:
cv.GaussianBlur(src, ksize, sigmaX[, dst[, sigmaY[, borderType=BORDER_DEFAULT]]] )
For Example:
import cv2
import numpy as np
a = np.arange(50,…

Winter 2019
- 93
- 2
- 5
0
votes
1 answer
Convolving a 1D array with Gaussian filtering returns array of all zeros Python
Im trying to take a 1D array of 1's and 0's (mostly zeroes) and convolve it with a gaussian to get a more probablistic representation. When I use scipy.ndimage.gaussian_filter1d I keep getting back arrays that are just full of zeroes.
spike_bins, _…

Julia Gorman
- 13
- 2
0
votes
0 answers
Affine transformation from 2D to 3D using SciPy leads to empty arrays
Using scipy.ndimage.affine_transform, I am trying to apply an affine transformation on a 3D array with one degenerate dimension, e.g. with shape (10, 1, 10), and get a non-degenerate 3D output shape, e.g. (10, 10, 10). The purpose of this operation…

Biblot
- 695
- 3
- 18
0
votes
0 answers
correctly rotate a scipy.ndimage.rotate back
I rotate a image with scipy.ndimage in one direction and do a operation on it and than rotate it backwards.
Is there a way/function/parameters to savegard that
rotate a image by angle x
rotate the rotated image by angle -x
results in the same…

Sebastian H
- 111
- 3
0
votes
0 answers
image labelling and anisotropy
I have a 3d image which I want to label. Typically I use from label from scipy.ndimage. I want to ask how do you handle anisotropy, the z-dimension is cut more coarsely than x and y.
My structuring element is like a ball:
from scipy.ndimage import…

Aenaon
- 3,169
- 4
- 32
- 60
0
votes
0 answers
Can scipy.ndimage's binary_erosion function be used to erode an image from one side?
I have an elevation array from a .tif LiDAR surface. Example array below.
Existing_example_arrayV0 = [[ 0, 0, 1, 0, 0, 0, 0],
[ 0, 1, 1, 1, 0, 0, 0],
[ 0, 1, 1, 1, 1, 0, 0],
…

Patstro
- 69
- 6
0
votes
0 answers
Can scipy ndimage affine_transform increase intensity range?
We were doing some experiment on scipy.ndimage.affine_transform
From our understanding, it is a linear transformation through spline interpolation method. Thus, it could reduce the overall image intensity range if some parts of the image is cut off,…

jongsung park
- 61
- 1
- 8
0
votes
0 answers
Difference between `scipy.ndimage.fourier_gaussian` and own implementation
I am trying to implement myself a 2D gaussian filter (to debug some C++ code, outside the scope of this question). I focus on the first step: multiplication of the image and the Gaussian kernel in the Fourier space.
The input data and its TF:
import…

dagnic
- 137
- 10
0
votes
0 answers
Use scipy ndimage generic_filter to compute set intersection across pixel-neighborhoods
I have raster images reporting the start day and end day of some periods across the globe. For each pixel (read numpy array element) I'd like to get a measure of how much its day-unit period overlap/intersect with that of the neighboring pixels.…

Matteo
- 1
- 1
0
votes
0 answers
Why does the scipy.ndimage.gaussian_filter changes the shape of my masked image?
I would like to apply a Gaussian filter to a masked array, however, this appears to alter the shape of my image. The higher I put sigma, the more of the image disappears. I don't really understand why this happens? I would expect both figures to…

Emma
- 3
- 3
0
votes
0 answers
Why is ndimage.maximum_filter not working a expected
I have a problem where I need to detect the local maximum of an image. I used the ndimage.maximum_filter to detect local maximas.
Here is a sample code:
image = np.array([1,0,6,1,8,9,6,4])
neigh = [1,0,1]
filtered_image =…

Boubaker
- 33
- 4
0
votes
0 answers
C++ Implementation of Gaussian Filter (from scipy.ndimage import gaussian_filter)?
I am trying to replicate the scipy gaussian_filter in C++.
from scipy.ndimage import gaussian_filter
data = np.zeros([120])
gaussian_filter(data, sigma=0.5)
Can any one guide/share similar raw implementation in python.
I can implement the same in…

kskill
- 31
- 3
0
votes
1 answer
How to apply convolution in-place on GPU (in Python)
I need to perform a convolution on an image in-place, and by in-place I mean such that as the structuring element gets applied to different pixels, I want the result of the previous steps to overwrite the image. To put it in context, this is useful…

Blademaster
- 324
- 2
- 15