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
2
votes
0 answers

Python 2.6 64 bit - scipy.ndimage import error

Using the 64 bit version of python 2.6, I installed the unofficial 64 bit scipy module from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy. I tried running a script that specifically uses the scipy.ndimage module, which leads to this…
dhruv8890
  • 21
  • 2
2
votes
3 answers

microscopy image segmentation: bacteria segmentation with python

I am trying to segment some microscopy bright-field images showing some E. coli bacteria. The picture I am working with resembles this one (even if this one is obtained with phase contrast): my problem is that after running my segmentation function…
JacoSolari
  • 1,226
  • 14
  • 28
2
votes
1 answer

Rotating images in Python - Improving Quality - Scipy

as the title says, I'm trying to rotate an image in Python, using the Scipy package. I receive as an input an image, with an specific size, for example, 512 x 512, and I have to perform some rotations over it and to crop a proportion of it. So,…
pceccon
  • 9,379
  • 26
  • 82
  • 158
2
votes
1 answer

Scipy labels and measuring max pixel in each label

So I want to measure the max pixel and average of pixels in each label(in multiple array) using scipy. for example (img , other is a numpy array of an opened tif) import numpy as np import scipy.ndimage as ndi a = img > 200 labels,nb =…
João Mamede
  • 129
  • 12
1
vote
2 answers

Find all unique neighbor pairs between segments of ndimage labeling in an efficient manner

Below I give an example in 2D, but my real question would be regarding 3D (with or without periodic boundaries). Find all unique neighbors for each segment id using 8 neighbors (2d) or 26 neighbors (3d). Given the following array: INPUT matrix=[ …
1
vote
1 answer

How to generate arbitrary high dimensional connectivity structures for scipy.ndimage.label

I have some high dimensional boolean data, in this example an array with 4 dimensions, but this is arbitrary: X.shape (3, 2, 66, 241) I want to group the dataset into connected regions of True values, which can be done with scipy.ndimage.label,…
JoshD
  • 47
  • 1
  • 10
1
vote
1 answer

Numpy of image> 0

I first binarized an image and then filtered it in python. Now how can I add every pixel> 0 to a numpy array? img = Image.open('native.png').convert('RGB') binarised = img.convert('LA') # binarised.save('binarised.png') filtered =…
user16755372
1
vote
0 answers

how to label a big image using chunks?

I try to label a huge image (69940, 70935) using ndimage.label. Label thus try to allocate a int64 ndarray (37 GiB) which is too big for my computer. import rasterio as rio import ndimage as ndi with rio.open(src) as f: label =…
Pierrick Rambaud
  • 1,726
  • 1
  • 20
  • 47
1
vote
1 answer

how to use scipy.label on a non-binary image

I need to label an already classified img. The problem being, the image is non binary and I need to count separately neighbouring patch of different value. Considering the following dataset : import numpy as np data = np.zeros((6,6),…
Pierrick Rambaud
  • 1,726
  • 1
  • 20
  • 47
1
vote
2 answers

How to accelerate scipy.map_coordinates for multiple interpolations?

I have several values f, g, h that are defined on the same regular grid (x, y, z) that I want to interpolate onto a new grid (x1, y1, z1). i.e., I have f(x, y, z) , g(x, y, z) , h(x, y, z) and I want to calculate f(x1, y1, z1), g(x1, y1, z1), h(x1,…
f. c.
  • 1,095
  • 11
  • 26
1
vote
0 answers

How to determine how many distinct curves are in an image using Python?

I am trying to write an algorithm to systematically determine how many different "curves" are in an image. Example Image. I'm specifically interested in the white lines here, so I've used a color threshold to mask the rest of the image and only get…
1
vote
1 answer

Can someone explain to me how map_coordinates works on n dimensional datasets?

I have a 3D image that I'm trying to transform, with a known coordinate mapping. I'm trying to use map_coordinates but the scipy documentation only talks about mapping to a 1D vector leaving me rather confused. The transformation is vectorized so I…
GreenLlama
  • 123
  • 1
  • 6
1
vote
1 answer

Why aren't my rotated images being saved properly?

I need to rotate around 150 images different amounts so that I can properly annotate my data with bounding boxes. The issue is that for some reason the image files aren't being saved rotated after running through my code and entering some values.…
Dawson
  • 13
  • 4
1
vote
0 answers

How to smooth contour/boundary in binary image?

I have a binary image that has a non-smoothing contour. As prior information, the contour has to be smooth. Could you suggest to me the solution to smooth the contour as the below image in python? Thanks all
John
  • 2,838
  • 7
  • 36
  • 65
1
vote
1 answer

how to write convert yuv array to rgb array?

I have original data which is yuv420p frame data bytes. I want to convert it to rgb data using numpy and scipy. Here is my code: yuv = np.frombuffer(data, dtype='uint8') y = yuv[:1920*1080].reshape(1080, 1920) v =…
nathan wu
  • 67
  • 1
  • 3