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


Groups > comp.lang.python > #81022

Re: scipy shape

Date 2014-11-19 02:52 +0000
From MRAB <python@mrabarnett.plus.com>
Subject Re: scipy shape
References <CAA+hu4VH+VqmeVnFhEVdDSLuj0xXH41OCxt5WgOFJ2ZnUycoOA@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.15987.1416365571.18130.python-list@python.org> (permalink)

Show all headers | View raw


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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web