[Numpy-discussion] Bilateral filter

Zachary Pincus zachary.pincus at yale.edu
Sat Feb 28 17:37:25 EST 2009


Well, the latest cython doesn't help -- both errors still appear as  
below. (Also, the latest cython can't run the numpy tests either.) I'm  
befuddled.

Zach

On Feb 28, 2009, at 5:18 PM, Zachary Pincus wrote:

> Hi all,
>
> So, I re-grabbed the latest bilateral code from the repository, and
> did the following:
>
> [axlotl:~/Developer/Python/stefanv-bilateral] zpincus% python setup.py
> build_ext -i
> [axlotl:~/Developer/Python/stefanv-bilateral] zpincus% ipython
> In [1]: import numpy
> In [2]: import bilateral
> In [3]: bilateral.bilateral(numpy.ones((10,10)), 4, 4)
> ---------------------------------------------------------------------------
> NameError                                 Traceback (most recent call
> last)
>
> /Users/zpincus/Developer/Python/stefanv-bilateral/<ipython console> in
> <module>()
>
> /Users/zpincus/Developer/Python/stefanv-bilateral/bilateral/
> bilateral.pyc in bilateral(mat, xy_sig, z_sig, filter_size, mode)
>      36     '''
>      37
> ---> 38     filter_fcn = _BB.Bilat_fcn(xy_sig, z_sig, filter_size)
>      39     size = filter_fcn.xy_size
>      40     return generic_filter(mat, filter_fcn.cfilter, size=size,
> mode=mode)
>
> /Users/zpincus/Developer/Python/stefanv-bilateral/bilateral/
> bilateral_base.so in bilateral.bilateral_base.Bilat_fcn.__init__
> (bilateral/bilateral_base.c:590)()
>
> NameError: np
>
> In [4]: print numpy.version.version
> 1.3.0.dev6359
> In [5]: import Cython.Compiler.Version
> In [6]: print Cython.Compiler.Version.version
> 0.10.3
>
> I'm using Python 2.5.2 on OS X 10.5.6. Oddly, when I run the cython
> tests, numpy_test fails to even compile because it can't find 'numpy/
> arrayobject.h' -- I assume this is some problem with their test
> harness. However, I noticed that the numpy_test.pyx file does both:
> 'cimport numpy as np'
> and
> 'import numpy as np'
>
> so I added the second line to the bilateral_base.pyx file... re-
> running the above then gets a bit farther, but things choke again,
> with an "AttributeError: 'numpy.ndarray' object has no attribute
> 'dimensions'", which comes from bilateral_base.c:1060, i.e.
> bilateral_base.pyx line 73.
>
> This is perplexing. I wonder if the problem is using a dev numpy
> version, but a few-months-old cython. (Unfortunately, I don't have
> mercurial installed, so I can't easily grab the dev cython -- there's
> no simple way to download a mercurial repository over HTTP with wget
> or whatnot, which is annoying.)
>
> Any thoughts? In the mean time, I guess I'll install mercurial so I
> can try the latest cython.
>
> Zach
>
>
> On Feb 28, 2009, at 1:53 PM, Nadav Horesh wrote:
>
>> I could not reproduce your error. I am using latest official
>> releases of numpy and cython on a linux box (do you use Mac?).  I am
>> attaching the package I have on my PC, for the small chance it would
>> help.
>>
>> Nadav.
>>
>>
>> -----הודעה מקורית-----
>> מאת: numpy-discussion-bounces at scipy.org בשם Zachary Pincus
>> נשלח: ו 27-פברואר-09 22:26
>> אל: Discussion of Numerical Python
>> נושא: Re: [Numpy-discussion] Bilateral filter
>>
>> Hi all,
>>
>> I just grabbed the latest bilateral filter from St?fan's repository,
>> but I can't get it to work! I'm using a recent numpy SVN and the
>> latest release of cython...
>>
>> In [10]: bl = bilateral.bilateral(image, 2, 150)
>> ---------------------------------------------------------------------------
>> NameError                                 Traceback (most recent call
>> last)
>>
>> /Users/zpincus/Documents/Research/Slack Lab/Experimental Data/Big
>> Data/
>> 2009-2-17/<ipython console> in <module>()
>>
>> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
>> packages/bilateral/bilateral.pyc in bilateral(mat, xy_sig, z_sig,
>> filter_size, mode)
>>     36     '''
>>     37
>> ---> 38     filter_fcn = _BB.Bilat_fcn(xy_sig, z_sig, filter_size)
>>     39     size = filter_fcn.xy_size
>>     40     return generic_filter(mat, filter_fcn.cfilter, size=size,
>> mode=mode)
>>
>> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
>> packages/bilateral/bilateral_base.so in
>> bilateral.bilateral_base.Bilat_fcn.__init__ (bilateral/
>> bilateral_base.c:590)()
>>
>> NameError: np
>>
>> I know very little about the internals of cython, so I can't figure
>> this error out... it seems to be a problem with the 'cimport numpy as
>> np' line in the pyx file, but beyond that I'm lost.
>>
>>
>> Let me know if I can provide any additional information,
>>
>> Zach
>>
>>
>>
>>
>> On Feb 14, 2009, at 1:29 PM, St?fan van der Walt wrote:
>>
>>> Hi Nadav
>>>
>>> 2009/2/13 Nadav Horesh <nadavh at visionsense.com>:
>>>> I tried the installer and it did not copy bilateral.py. I tried to
>>>> improve it and the result is in the attached file.  I hope it would
>>>> pass the mail filter, if not contact me directly to the email
>>>> address below.
>>>
>>> Thanks!  I applied your changes and modified the setup.py to support
>>> in-place building.  Again available here:
>>>
>>> http://github.com/stefanv/bilateral/tree/master
>>>
>>> Cheers
>>> St?fan
>>> _______________________________________________
>>> Numpy-discussion mailing list
>>> Numpy-discussion at scipy.org
>>> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>>
>> _______________________________________________
>> Numpy-discussion mailing list
>> Numpy-discussion at scipy.org
>> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>>
>>
>> <winmail.dat>_______________________________________________
>> Numpy-discussion mailing list
>> Numpy-discussion at scipy.org
>> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion




More information about the NumPy-Discussion mailing list