A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

# 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.

656 questions
Filter by
Sorted by
Tagged with
73 views

### How do I detect the sharp edges in the following image?

I am looking to count the sharp pointy triangular things in the image. However I was unable to do so. One approach I did try was take a convex hull of the contour and then find convex defects but it ...
33 views

### Spectrogram using SciPy - bad scaling of the timeline [duplicate]

I have a real value signal which has 197 samples (every 1 second). I made its spectrogram using the SciPy library: ...
67 views

### Sparse Bayesian Learning Algorithm in Python - MSE vs. SNR

I am implementing SBL in python. I have plotted a graph between MSE (mean squared error) and SNR (Signal to Noise ratio) The graph must be decreasing, but mine is decreasing till the SNR is negative. ...
110 views

### How to find frequency and corresponding time for an audio signal?

I want to read in a sound file and get the frequency at each time interval of the signal. I thought that the best way to approach this is by applying FFT to small chunks of the signal. Because FFT ...
97 views

### Using different algorithms/formulas to create spectrograms

On the internet, I have seen people use Matplotlib/Python and short-time fourier transformations to create spectrograms. Are their other formula/algorithms to create spectrograms? And are they ...
222 views

### What are some alternatives to Spectrogram charts? [closed]

Spectrogram renders of audio are limited in their representation of audio. For example, one could not use a Spectrogram to re-render the original audio. What are some alternatives to Spectrogram ...
512 views

### Comparison of results own implementation and python signal.welch

I am trying to replicate the output of Python's signal.welch function to make an estimate of the PSD from an FFT calculation. I don't want to use the built-in function to understand better what is ...
68 views

### Understanding the magnitude of frequency response filterbank based on elliptic filters

I've implemented a 10-channels filterbank with octave-scaled second-order elliptic filters using the Python's library scipy.signal. Here is the magnitude of the frequency response: Can someone ...
61 views

### Python FFT outptut

I have a (real) array of data and am trying to analyze its frequency components. I've been using NumPy's FFT routines, but I realized there is something I don't quite understand: why does the output ...
169 views

### How to normalize PSD to get the same magnitude as FFT peak

I am trying to use FFT and power spectra density estimation with python (np.fft.fftand scipy.signal.periodogram). And trying to ...
264 views

### Splitting an audio signal into multiple audio signals based on frequency range in Librosa

Using the Librosa package in Python, how may I separate an audio signal into multiple audio signals based on frequency range? I have a file music.mp3. I used HPSS ...
524 views

### inverse discrete fourier transform with plain python

I am trying to calculate inverse discrete fourier transform for an array of signals. I am using the following formula: $$x[n] = \tfrac1N \sum\limits_{k=0}^{N-1} X[k] \, e^{j 2 \pi k n/N}$$ And my ...
110 views

### Why resampling change this FFT output?

I have been studying the following code but still unable to explain its output. I really hope someone could shed some light. Let me begin with the baseline. Suppose I have a 20 seconds sinusoid with ...
331 views

### Spectrogram of a single tone complex signal has two dark lines?

I am trying to plot the spectrogram of a complex signal I generated. I have written code to generate this signal and plot the spectrogram. It works. However I see that there are two dark lines present ...
551 views

### OpenCV warpPerspective implementation

I've implemented the least squares method to find the homomorphic image to fix the rotation and projection in an image. Now I'm trying to implement the OpenCV warpPerspective method in order to "fix" ...
95 views

### STFT Spectrum Analyzer: power drops over 15 kHz with songs, not with pure signals

I'm developing an audio file spectrum analyzer for a University Project. My main goal is to have an application that plots the Db Spectrum of a 16 Bit WAV PCM audio file (at this time only mono files) ...
49 views

### Once spines recognized, how do I find each individual book?

I want to make a system like the Book Spine Recognition on Youtube. So I read research paper and I built this system. According this paper, I use Hough transform, then I recognize book boundary ...
11 views

### Adjustments to get better result appyling hough circles

I have the aboveimage and wanted to detect circles spread around the image. I can detect the circles in the middle through hough circles but it does not work out for the left-most circles which exists ...
181 views

### Low-pass filtering with DCT produces blocky, high-frequency results?

I have a grayscale image, available at https://pasteboard.co/IdX7NfA.png. Now I want to low-pass filter this image in the Discrete Cosine Transform (DCT) spectrum. Specifically, I centered the image ...
368 views

### How to convert a spectrogram back to a signal [duplicate]

I'm converting a signal to a spectrogram, manipulating that (nonlinear stuff), and then want to use the modified audio signal. I can make it so the segments are not overlapping, but am unsure how to ...
286 views

### Frequency range for STFT in Librosa

I am currently looking at the STFT for Librosa. I was wondering how to understand the output of the STFT function, specifically what kind of frequencies the different values represent. Say I have a ...
17 views

### How to harvest the highest amount of information from an image?

I wrote a script that detects objects, crops the part of the image where an object is located and tries to increase the quality of cropped image. The object detection runs tensorflow. To increase ...
144 views

### High frequencies disappear when applying discrete wavelet transform

Trying to decompose and reconstruct a signal using a to some extent self-made implementation of DWT for some reason fails. The result looks highpass filtered and/or shifted. I wanted to write the code ...
51 views

### Losing lowest Frequencies in frequency modulated signal, rest of spectrum is fine

For several reasons I am attempting to re-modulate a de-modulated FM (as in WFM Radio) signal using python. Demodulating the initial signal goes well, it produces the PSD chart below which looks just ...
29 views

### delayed result in sinc upsampled signal

I have implemented an infinite kernel sinc interpolation. For some signals I notice an artifact, visible at the right end of the plot. I am wondering: is it a bug in my code or a phenomenon usual for ...
135 views

### Exponential Chirp

I'm trying to replicate in python the exponential chirp (here) but I cannot understand well the t and T in the formulas; here is what I wrote, but it is surely wrong, please could you help me? ...
25 views

### derivative filter for computing speed from robot rangefinder

I have a laser rangefinder on my robot and I need to compute the speed of the detected object. I have seen many different filters for that, but all of them apply only to offline data, or introduce ...
74 views

### How to Remove the Patch Artifacts of Neural Network Denoising Process?

I have written a python script which uses the Noise2Noise: Learning Image Restoration without Clean Data implementation of the Auto Encoder which is useful to remove noise from images. In the original ...
130 views

### Detecting a three-tone signal in real-time

I'm new to digital signal processing, and I've been looking into FFT, filtering, Matlab etc. What I'd like is to build a program which will detect when a certain BEEP is transmitted through a trunked ...
202 views

### Detect the Beginning and Ending of a Signal

I have a signal that looks more or less like square wave signal with different phases (Like in the picture below). However, the signal fluctuates a lot, we can see in the image below: At first, I ...
18 views

### How to separate spliced(photoshopped) part from the rest of the spliced image?

I'm working on a project to detect spliced images and want 128x128 patches at the boundaries of the forged regions. I have the authentic background image and the spliced(photoshopped) one. If I ...
137 views

### Reading a Wav File [closed]

I need to read two .wav files. One of them is a song, and the other one is impulse response. Then, I have to convolve them. In fact, I have read them by using ...
63 views

### Intelligent Noise Removal in Data

This question is linked to this question: I have this data: ...
1k views

### Bandpass filter for audio wav file

How do I apply a bandpass filter on an audio file which is in wav format? And write back the filtered data in a new wav file for further analysis.
137 views

### dft of sampled sine using python

I'm trying to write a python script to perform a 100-point DFT over a finite length sample of a sinewave at 1/8 the sampling frequency. I'm curious why my DFT magnitude plot has two spikes in it when ...
151 views

### PSD subtraction

I am interested seeing the difference between two power spectral densities (PSD) as a noise reduction exercise The blue line is the psd of my signal, and the the orange line is the psd of the ...
516 views

I hope this is the right location to post this, as my question isn't really stack-overflow material but involves images. I have hundreds of SEM-Images like this: and need to track changes in certain ...
161 views

### Delay in Savitzky-Golay filtering

I am applying a Savitzky-Golay filter to a signal, using the scipy function. I need to calculate the lag of the filtered signal, and how much is it behind the original signal. Could someone shed ...
50 views

### Strange phase for gaussian beam 2D

I have a 2D Gaussian beam : After doing FFT2 and angle I get strange results: This is the code I'm using (Python 3) ...
121 views

### Microscopy crystal particle object length detection

Hi I try to detect the particle length size from this image and I'd like to get the length size of the particle Like this below. and get the histogram of the size of the particle using centroid and ...
31 views

### Need help with detecting onset of audio in wav file

I'm new to DSP and I'm learning as I go. I have an audio file with a chirp signal(2kHz). I played and recorded this chirp signal and the recording has a lot of environmental sounds. Here is my code:
176 views

### Restoration problem with numpy fft function and self-made high-pass filter

Hi, I am using numpy.fft functions to do CV assignments in univ. But while implementing the high-pass and low-pass filter, I found something wrong during the process. The difference should converge ...
59 views

### Detecting similar behaviour in audio files

Can anyone help, I'm trying to find a solution that would allow me the ability to look at a batch of .WAV files and detect ones which share a similar behaviour in the recording like the image attached....
98 views

### Is there any python code for applying a-law/mu-law on 3D numpy array?

I have 3D numpy array of probabilities between [0,1], I need to emphasize on some area with lower probabilities. I was suggested to apply a-law and mu-law. I am wondering if there is python library/...
110 views

### Remove background noise from audio signal

I am looking for a python or matlab code to take an input audio signal, process it and remove any background noise other than the infant cry such as vehicle noise or a human talking noise and get the ...
322 views

### Beat detection in Matlab or Python

Try to determine the start time and duration of each "beat" in an audio signal (circled in figure below). It looks like a simple question, and python or Matlab should have toolbox/functions to do this,...
96 views

### Discrete-time, second-order section, direct-form II filter

I found dfilt.df2sos in Matlab and trying to figure it out how do I do that in Python? Is there any function that works similarly with the Matlab function? I also ...
200 views

### How to plot real time graph using python for the signals received from RTL SDR?

Using the below python code, I am able to plot a graph. Can anyone please tell me how to modify this code to plot the graph continuously in real time? ...