Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81022 > unrolled thread

Re: scipy shape

Started byMRAB <python@mrabarnett.plus.com>
First post2014-11-19 02:52 +0000
Last post2014-11-19 02:52 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: scipy shape MRAB <python@mrabarnett.plus.com> - 2014-11-19 02:52 +0000

#81022 — Re: scipy shape

FromMRAB <python@mrabarnett.plus.com>
Date2014-11-19 02:52 +0000
SubjectRe: scipy shape
Message-ID<mailman.15987.1416365571.18130.python-list@python.org>
On 2014-11-19 02:30, Abdul Abdul wrote:
> I came across an example that starts as follows:
>
> from scipy.ndimage import filters
> img = zeros(im.shape)
>
> What does the second line mean here? Is it setting the image pixels to
> zero? What is "shape" here?
>
It looks like it might be using numpy.

If 'im' is a numpy array representing an image, then its .shape
attribute is giving its 'shape' (a tuple of the sizes of its
dimensions).

numpy.zeros(...) will when return a numpy array of the same shape.

So, it's not setting the image pixels to 0, but creating a new image of
the same shape in which the pixels are 0.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web