Questions tagged [python]

Python is a high-level interpreted general programming language. Python has popular numerical and scientific libraries/packages, most notably numpy and scipy. The scipy.signal package is a powerful signal processing software collection. This tag covers the use of numpy, scipy, and other Python packages often used for SP computations.

Filter by
Sorted by
Tagged with
35
votes
7answers
24k views

Finding squares in Image

I need to find the squares in an image using OpenCV (no problem in matlab or any other, generally what i expect are some ideas). Consider the test image below : I need to find those coloured squares ...
31
votes
3answers
38k views

Picking the correct filter for accelerometer data

I am fairly new to DSP, and have done some research on possible filters for smoothing accelerometer data in python. An example of the type of data Ill be experiencing can be seen in the following ...
27
votes
2answers
45k views

Applying filter in scipy.signal: Use lfilter or filtfilt?

I saw in a SO thread a suggestion to use filtfilt which performs backwards/forwards filtering instead of lfilter. What is the ...
24
votes
1answer
57k views

low pass filter and FFT for beginners with Python

I am new to signal processing and especially to FFT, hence I am not sure if I am doing the correct thing here and I am a bit confused with the result. I have a discrete real function (measurement ...
22
votes
2answers
24k views

Improving spectrogram resolution in Python?

I'm using the specgram() function in matplotlib to generate spectrograms of speech wave files in Python, but the output is ...
19
votes
3answers
11k views

What's wrong with this code for tomographic reconstruction by the Fourier method?

I've been playing around with tomographic reconstruction algorithms recently. I already have nice working implementations of FBP, ART, a SIRT/SART-like iterative scheme and even using straight linear ...
18
votes
1answer
24k views

What is the phase and magnitude response of white noise?

I would like to create white noise in the frequency domain, and then transform it to the time domain using python. To understand the problem, I simply generated white noise in the time domain, and ...
17
votes
4answers
11k views

Counting the number of groups of 1s in a boolean map of numpy.array

I am right now dealing with some image processing in Python via PIL (Python Image Library). My main aim is counting the number of colored cells in an immunohistochemistry image. I know that there are ...
17
votes
4answers
17k views

Scipy - Audio Processing

I am looking for good tools for Audio signal processing. e.g Speech & music analysis, automatic language identification, etc. Does the Scipy library provide functions for audio processing? Does ...
16
votes
5answers
54k views

How to write lowpass filter for sampled signal in Python?

I have some signal that sampled each 1 ns (1e-9 sec) and have, let say, 1e4 points. I need to filter high frequencies from this signal. Let say I need to filter frequencies higher than 10 MHz. I want ...
14
votes
2answers
17k views

Discrete Wavelet Transform - Visualizing Relation between Decomposed Detail Coefficients and Signal

I'm trying to directly visualize the relation between discrete wavelet transform (DWT) detail coefficients and the original signal/its reconstruction. The goal is to show their relation in an ...
12
votes
3answers
5k views

Fail to separate sound signals by FastICA on real-world recording

I have written a program to perform FastICA on a stereo WAV file using the code on Python MDP FastICA Example With the audio examples I get very good results. Then I try to do real world recording ...
12
votes
3answers
1k views

Image processing coding

I was wondering which is the best language for image processing? I know MATLAB has a good library and user community for it. I havent checked it out, its there for python as well. What is the most ...
12
votes
3answers
5k views

STFT and DWT (Wavelets)

STFT can be successfully used on sound data (with a .wav soundfile for example) in order to do some frequency-domain modifications (example : noise removal). With ...
10
votes
3answers
2k views

Implementation of Wikipedia Equation for the DFT

I was writing a simple fourier transform implementation and looked at the DFT equation on wikipedia for reference, when I noticed that I was doing something differently, and after thinking about it ...
10
votes
3answers
6k views

Is it correct to subtract a low-pass filtered signal from the original signal and use the result as a "high-pass"?

I am having a hard time trying to find documentation to implement band-pass or high-pass filter with python/scipy/numpy. I can easily create and apply a low-pass filter, though, so I ask: Would it ...
10
votes
4answers
5k views

How to perform a Rubberband-Correction on spectroscopic data?

I basicaly understood how the Rubberband/Baseline-correction works. The given spectrum is divided into (N) ranges. The lowest points in every range are determined. The initial baseline is built out ...
10
votes
1answer
366 views

Recognizing data clustered into shapes

I am working on a project in Python to detect and classify some bird song, and I have found myself in a position where I need to convert a wave file into frequency vs. time data. This hasn't been too ...
9
votes
4answers
45k views

Peak Signal to Noise Ratio (PSNR) in Python for an Image

How do I calculate the maximum signal to noise ratio (PSNR) in Python? Is there any library that can calculate PSNR for Image?
9
votes
3answers
65k views

Apply Low pass Butterworth filter in Python

I want to use a low pass Butterworth filter on my data but on applying the filter I don't get the intended signal. Here is the dummy code: Signal A: ...
9
votes
2answers
10k views

How can I detect buttons in a GUI of an app with pattern detection using python?

I will explain taking as example the GUI of the Calculator app in windows. Given this Calculator application open and focused, I need to find a way of detecting all the buttons.I can only use non-...
9
votes
1answer
2k views

Is it possible to hack camera calibration without having access to the camera?

Many times we have a stream of video to process without access to camera. Having access to camera matrix would be beneficial for various processing techniques. Is it possible to hack camera ...
8
votes
5answers
2k views

Does windowing affect Parseval's theorem?

I have computed Fourier transform from ecg data.It does obey Parseval's theorem, relation $$\sum_{n=0}^{N-1} \Big| x[n] \Big|^2 = \frac{1}{N} \sum_{k=0}^{N-1} \Big| X[k] \Big|^2$$ is fulfiled. ...
8
votes
2answers
14k views

Filtering a digital signal online in real-time using python

I am currently trying to apply a bandpass filter to a signal in real-time. There are samples coming in with a constant sampling rate and i would like to calculate the corresponding bandpass filtered ...
8
votes
1answer
7k views

Calculating the SNR of Audio Signal (Recommended Libraries)

Are there any open source packages or libraries available which can be useful in calculating the SNR(signal to noise ratio) of an audio signal. The input will be just an audio signal and I have to ...
7
votes
3answers
8k views

Looking for Fastest 2D Convolution in Python on a CPU

Convolutions are essential components of many algorithms in neural networks, image processing, computer vision ... but these are also a bottleneck in terms of computations... In the ...
7
votes
2answers
7k views

Filtering - multiplication in frequency domain

I am trying to create a simple low pass filter, but I have got what I consider a surprising result when looking at the frequency response of a simple Butterworth filter. I have copied much of the ...
7
votes
2answers
13k views

How to locally quantify the 'sharpness' of an image?

I am trying to quantify how much sharpness (or acutance) is in a picture which has some bokeh (out of focus background). I am using the Python scikit image for that. Here is my naive approach: ...
7
votes
1answer
109 views

Kalman Filter State Covariance Matrix for Non Constant Process Noise Matrix in PyKalman

I'm experimenting with the pykalman Python library to learn about Kalman Filters. In the code below, I'm generating a random walk where each step is the last step ...
7
votes
3answers
34k views

Calculating values of frequency bins in Python

I have to use FFT to determine the period of waves inside a signal. After applying FFT on a window of 10000 point from a signal, I get something like this: What I don't understand is that FFT is ...
7
votes
1answer
3k views

Failed to implement Goertzel algorithm in Python

After some questioning on stackoverflow, I tried to implement a Goertzel algorithm in Python. But it doesn't work : https://gist.github.com/4128537 ...
7
votes
2answers
34k views

Removing noisy lines from image - opencv - python

I want to process different type of image to extract actual text from noisy image .I am using open cv to do this job it is working fine but the problem is I need to set different lower threshold to ...
7
votes
1answer
1k views

Removing a sinusoidal artifact from a set of movie frames

I am doing some post-hoc analysis of a dataset consisting of a series of movie frames that are contaminated by a strongly periodic artifact. I would like to remove this artifact from my frames. For ...
6
votes
3answers
15k views

Beginner Attempting FFT Signal Filtering With Numpy

I've tried looking around for information on this, but I'm really out of my league here. I'm a guy who likes to fool around with Python, and I wanted to make a program that would filter an audio file. ...
6
votes
4answers
23k views

python; audio; detecting silence in audio signal

I have real-time audio application written in python, and I have question about detecting silence. What's the most efficient way to distinguish silence from non-silence, in an input audio signal? By ...
6
votes
4answers
12k views

Differences between Python and MATLAB filtfilt function

I'm trying to port some MATLAB code to Python and am running into some strange behaviour. I am implementing a 5th order Butterworth bandpass filter. The sampling rate is 30 Hz. Running MATLAB R2012b, ...
6
votes
1answer
11k views

Taking audio frequency and picking out peaks (Peak Detection)

So I have a unique challenge. I want to take an audio file, and pick out the peaks in the samples and plot that onto a graph. Each point based on the amplitude/pitch(?) will be represented as either a ...
6
votes
1answer
40 views

How Are MATLAB's `cpsd()` and SciPy's `csd()` Related?

I am trying to determine an estimate of the H1 transfer function between two acceleration signals in Python. To do this, I am calculating Pyx using ...
6
votes
3answers
21k views

Continuous Wavelet Transform with Scipy.signal: what is parameter "widths" in cwt() function? How do time-frequency?

I search to display a time-frequency signal with an original discrete temporal signal (sampling step = 0.001sec). I use Python and the library Scipy.signal. I use the function ...
6
votes
1answer
5k views

Python: Least Squares Support Vector Machine (LS-SVM)

I'm looking for a Python package for a LS-SVM or a way to tune a normal SVM from scikit-learn to a Least-Squares Support Vector Machine for a classification problem. The goal of a SVM is to maximize ...
6
votes
1answer
480 views

Morphing between two FFTs

I'm a musician and I'm making a script that takes a wave file and snaps each of its frequencies from the fourier transforms to the nearest musical harmonic. Thanks to help from another question I ...
6
votes
1answer
6k views

Signal filtering using Python

I'm trying to create an application using python that is capable of recording an audio signal and detecting short glitches in the signal. For example, I could be recording a 1000Hz sine wave and ...
6
votes
2answers
2k views

How to do FFT fractional time delay (SOLVED)

I am trying to time-shift a signal using the FFT, however I have encountered some strange effects that depend on the size of the time-shift. I need to be able to shift the time by an arbitrary amount -...
6
votes
1answer
1k views

Haar series approximation of a function?

I'm trying to code the Haar wavelet approximation of a function. I'm a complete newbie. Edit Below is a pseudo-code of my algorithm for $f: [0,10] \to \mathbb R$, $f(x)=x$. I picked it here and ...
6
votes
1answer
1k views

Issues with the smoothing operator in coherence estimation using the complex Morlet (Gabor) wavelet

The goal I wish to compute the coherence estimate using the continuous wavelet transform (CWT) of a real-valued signal with the complex Morlet (a.k.a. Gabor) wavelet. I compute the cwt of the signal ...
5
votes
2answers
14k views

python scipy fft on numpy hanning window smears peaks

I have a signal that I have acquired from an experimental instrument, that I wish to examine in the frequency domain. I don't care about phase for this exercise, I only care about magnitude. I ...
5
votes
2answers
15k views

Negative values of the FFT

I try to describe a simple signal in the frequency domain with the use of FFT function: ...
5
votes
2answers
4k views

Simulating analog filter using convolution or converting with fft

My task is simple; I want to simulate analog low-pass filtering of an input signal, using Python. Note that the input signal is an array of values, not an analytical function. My first question is if ...
5
votes
2answers
2k views

Finding Reference Audio Signal in Test Audio Signal and Cropping Accordingly

As seen in the diagram, below I have a reference audio and a test audio. I want to find at what part of the test clip the reference audio be heard. Once, that is found I want to crop the test file ...
5
votes
2answers
153 views

Deconvolution of an Image Acquired by a Square Uniform Detector

So, I acquired some images by scanning a radiation source with a square detector like in the following gif. Where the dashed grid represents reality, the 3x3 square my detector, and the 4x4 my ...

1
2 3 4 5
21