Questions tagged [ndimage]

Multi-dimensional image processing module within Scipy.

Scipy contains modules for a variety of scientific computing tasks.

ndimage is used for multi-dimensional image processing and contains the following submodules,

  • Filters scipy.ndimage.filters
  • Fourier filters scipy.ndimage.fourier
  • Interpolation scipy.ndimage.interpolation
  • Measurements scipy.ndimage.measurements
  • Morphology scipy.ndimage.morphology
  • Utility
108 questions
0
votes
1 answer

Set interpolation method in scipy.ndimage.map_coordinates to nearest and bilinear

I want to set the interpolation method of scipy.ndimage.map_coordinates to bilinear and nearest(2 different for different examples). There is nothing mentioned in the documentation about how to change the interpolation method.There is the following…
Beginner
  • 721
  • 11
  • 27
0
votes
1 answer

Apply Boxcar average to geospatial image

Assuming that the following array A is the result of reading a GeoTIFF image, for example with rasterio where nodata values are masked which is the array B. I would like to apply a boxcar average smoothing over a square neighbourhood. The first…
Peterhack
  • 941
  • 4
  • 15
  • 34
0
votes
0 answers

Python image filter working on N spatial and M measurement dimensions

In short: I’m searching for a way to calculate a multidimensional custom image filter on more than one axis of values in python. What I mean is: With scipy’s ndimage, I can use ndimage.generic_filter to apply the custom function myfunc to an…
0
votes
0 answers

extract 2D slice (defined by aribtrary plane) from 3D volume again?

extract 2D slice (defined by arbitrary plane intersection) from 3D volume using either iTK or scipy ndimage and interpolation with SimpleITK. Does anyone have a working example ? I have read several posts here and on the ITK users list but no one…
user1301295
  • 674
  • 1
  • 6
  • 15
0
votes
0 answers

Vertically cut a base64 image in 'python'

I have a base64 image and I want to cut the image into 2 or more parts at given heights. What is the most efficient way of doing it in python ? One way to go is to convert base64 to convert base64->bytes->ndarray->bytes. But I'm facing a problem in…
Uchiha Madara
  • 984
  • 5
  • 16
  • 35
0
votes
1 answer

scipy.ndimage.label: include error margin

After reading an interesting topic on scipy.ndimage.label (Variable area threshold for identifying objects - python), I'd like to include an 'error margin' in the labelling. In the above linked discussion: How can the blue dot on top be included,…
Jules
  • 7
  • 5
0
votes
0 answers

Python, use scipy.ndimage affine_transform to zoom out

I'm currently using affine_transform to zoom in on an image s = 0.005 frame = nd.affine_transform(frame, [1-s,1-s,1],[h*s/2,w*s/2,0], order=1) Now, my question is how to zoom out? I tried scaling using multiplication [h*s*2,w*s*2,0] instead of…
Queef
  • 11
  • 1
0
votes
1 answer

apply a function that takes an argument to an ndimage labeled array

I have an array that I've labeled using scipy.ndimage and I'd like to multiply each element by a factor specific to its corresponding label. I thought I could use ndimage.labeled_comprehension for this, however I can't seem to figure out how to pass…
tomerg
  • 353
  • 2
  • 12
0
votes
0 answers

Determine Coordinates on Gridded Data to Find Lengths of Objects

I'm in the process of identifying objects whose float value is greater than a certain threshold in a 2-D numpy array. I then need to determine the length of the major axis of each object and make sure that the object's major axis length satisfies a…
Helicity
  • 35
  • 2
  • 7
0
votes
1 answer

Improve performance of maximum filter in 2D array by shape

Let say I have a 2D array let img = [[0, 1, 2, 1, 3, 0], [1, 1, 1, 1, 1, 1], [1, 2, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1], [0, 1, 4, 1, 5, 0], ] let shape = [[0,1,0], [1,1,1], …
hoangpx
  • 470
  • 2
  • 16
0
votes
1 answer

Iterating over images in folder blowing up memory

I'm using the following code to iterate over images in a folder and to save them in a dictionary with the filenames as keys, but it's blowing up memory requirements quickly even though the images in the folder should easily fit into memory. Why is…
0
votes
0 answers

Why scipy.ndimage.filters.median_filter runs so slowly

I'm trying to explore 3D image analysis using Python by scipy.ndimage. When I applied median filter ,scipy.ndimage.filters.median_filter to my 3D image with size (874, 1150, 1150), it runs so slowly. The calculation speed apparently highly depends…
Zhou Zhou
  • 1
  • 1
0
votes
1 answer

Reading image from URL with misc.imread returning a flattened array instead of a colour image

I'm trying to read an image from a URL (provided by Google's Static Maps API). The image displays okay in browser. https://maps.googleapis.com/maps/api/staticmap?maptype=satellite¢er=37.530101,38.600062&zoom=14&size=256x278&key=... But when I…
Bill
  • 10,323
  • 10
  • 62
  • 85
0
votes
1 answer

In Python: the center of mass of specific regions of values in a 2D numpy array

I am working with a series of numpy.ndarray made of 101x101 values ranging 0.0 to 1.0. All arrays look like this: array([[ 0.216, 0.24 , 0.244, ..., 0.679, 0.684, 0.707], [ 0.23 , 0.229, 0.238, ..., 0.675, 0.676, 0.695], […
FaCoffee
  • 7,609
  • 28
  • 99
  • 174
0
votes
1 answer

scipy ndimage measurement labeling is not working properly

I am trying to label this image into two regions: And here is my code: from scipy.ndimage import measurements,morphology from PIL import Image from numpy import * im = array(Image.open('two_leds.png').convert('L')) im = 1*(im<200) result =…
Samer
  • 1,923
  • 3
  • 34
  • 54