Skip to content
This repository was archived by the owner on Dec 15, 2020. It is now read-only.
This repository was archived by the owner on Dec 15, 2020. It is now read-only.

downsample does not accept dtype=int #43

@barentsen

Description

@barentsen

It looks like downsample does not accept an array with dtype=int. Given that many images are stored as ints, it would be nice if it did?

In [1]: import numpy as np
In [2]: from imageutils import downsample
In [3]: img = np.array([[1, 2], [3, 4]])
In [4]: downsample(img, 2)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-4-fd13e25e043f> in <module>()
----> 1 downsample(img, 2)

/home/gb/bin/anaconda/lib/python2.7/site-packages/imageutils-0.0.dev110-py2.7-linux-x86_64.egg/imageutils/sampling.so in imageutils.sampling.downsample (imageutils/sampling.c:1298)()

ValueError: Buffer dtype mismatch, expected 'DTYPE_t' but got 'long'

Of course this works fine:

In [5]: downsample(img.astype(np.double), 2)
Out[5]: array([[ 10.]])

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions