Code Monkey home page Code Monkey logo

python's Issues

Error

TypeError: 'numpy.ndarray' object is not callable

Consider using `filtfilt` instead of `lfilter` for `interp`

I found that in your implementation of interp (in the multirate module), if you use filtfilt instead of lfilter, and don't cut off the results (ie. with [r*l+1:-1]) the result is much closer to that produced by MATLAB's interp. In particular, it's closer to meeting the constraint that existing points are preserved.

Issue with fftconvolve when running SSIM

Hi,
when I run your ssim.py example, I get the following error message:

/usr/bin/python2.7 /home/<user>/PycharmProjects/python-ssim/signal_processing/sp/ssim.py
Traceback (most recent call last):
  File "/home/<user>/PycharmProjects/python-ssim/signal_processing/sp/ssim.py", line 110, in <module>
    sys.exit(main())
  File "/home/<user>/PycharmProjects/python-ssim/signal_processing/sp/ssim.py", line 92, in main
    ssim_map = ssim(img1, img2)
  File "/home/<user>/PycharmProjects/python-ssim/signal_processing/sp/ssim.py", line 34, in ssim
    mu1 = signal.fftconvolve(window, img1, mode='valid')
  File "/usr/lib/python2.7/dist-packages/scipy/signal/signaltools.py", line 345, in fftconvolve
    raise ValueError("in1 and in2 should have the same dimensionality")
ValueError: in1 and in2 should have the same dimensionality

Inside the ssim() method, you are passing the image and a window to the fftconvolve function:

mu1 = signal.fftconvolve(window, img1 mode='valid')

It looks like that img1 and window is swapped, because the 1st param is to be expected to be of the same dimension, or of larger size, accoring to the fftconvolve-docs:

in1 : array_like
First input.
in2 : array_like
Second input. Should have the same number of dimensions as in1; if sizes of in1 and in2 are not
equal then in1 has to be the larger array.

But when I try to exchange the window and img params, the ssim() method returns a huge matric (just a bit smaller than the image, due to the VALID padding). I think it should return a scalar representing the metric index, right?

resample return is shifted by one sample

nice library
testing resample with short inputs and checking sample alignment, the output is shifted by one sample.

one fix is: offset = numpy.floor((l+nz_pre)/q) - 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.