Questions tagged [convolution]

A mathematical operation that combines two signals to generate a third signal. Convolution often arises in audio processing (e.g., filtering, reverb) and image processing (e.g., blurring, edge detection).

Convolution takes two signals and combines them to generate a third signal. For 1-D signals, the operation can be thought of as sliding the time-reverse of one signal along the other, and at each time step, taking the integral of the product of the signals (see wikipedia). The convolution operation describes the response of linear time-invariant systems to common input signals. Therefore, it commonly occurs in digital signal processing (DSP) contexts. Audio and image processing are two very common application areas for convolution.

A simple implementation for convolving two discrete time signals requires M*N multiply-add operations, where M and N are the lengths of the two signals. However, by taking advantage of the fact that convolution in the time domain is equivalent to multiplication in the frequency domain, and that transforming between domains can be implemented with O(N*log N) operations, convolution can be sped up. See here for more details.


Related tags

2052 questions
0
votes
0 answers

Confused with calculating convolutional arrays on Rust and Python

So, I am currently translating an equation on rust, which functions will be used in Python. For your reference, here's the equation: (Equation Image) I have two questions regarding the convolution process that I am currently working on: How to…
tanosheet
  • 1
  • 2
0
votes
0 answers

Use gaussian function only in the masked area of original image

I have a segmented mask of vessel and original image. Trying to use gaussian function to erode out that region into a lower intensity. I read the image and mask segment (black/white) then pass it over to erode_vasc; there I just average it out.…
Zulu112
  • 19
  • 3
0
votes
1 answer

Unexpected shift in convolution of PDFs

I'm trying to convolve two PDFs, but the result is not making sense to me. I'm convolving a triangular and a uniform distribution. None of them is centered in zero. Here's the code: import numpy as np import plotly.express as px # X values for…
ArthurOA
  • 23
  • 5
0
votes
0 answers

Convolution operation using FFT in pytorch

I want to compute the convolution operation using FFT. Apply FFT to the two input tensors and generate output tensors using element-wise multiplication. This output tensor is then subjected to IFFT to produce the final output. The code below is the…
core_not_dumped
  • 759
  • 2
  • 22
0
votes
1 answer

Using pyFFTW to convolve two PDFs

I want to get the mode and standard deviation of the sum of two random variables. For that, I create the discrete representation of the PDFs, and perform a convolution to get the new PDF, from which I calculate the mode and standard deviation. I am…
0
votes
0 answers

(JUCE Framework) juce::dsp::Convolution effect does not work with bluetooth headphones in Android Application

I have created a simple Audio Player Android application that provides various DSP effects. All the effects are working great, but the IMPULSE effect I created with the DSP Convolution Class does not work with Bluetooth headphones. The sound gets…
yetkin955
  • 1
  • 1
0
votes
1 answer

Sobel edge detection on raster data in R returns lines instead of edges in r

I'm using the lidR, raster, and terra packages in R to perform a canopy height model (CHM) analysis on a LiDAR dataset, and I'm attempting to use Sobel edge detection on my CHM…
0
votes
0 answers

Fast 1D convolution using AVX

I would like to do optimize the following code. void conv(int n, double* output, const double* input, double p1, double p2, double p3) { for (int i = 1; i + 1 < n; ++i) { output[i] = input[i - 1] * p1 + input[i] * p2 + input[i + 1] *…
JEK
  • 11
  • 3
0
votes
0 answers

Effect of 1x1 convolution on spatial dimension of image

If image size is 32x32 (no third dimension) and filter size is 1x1 for convolution. Then to my understanding, resulting size must be 32x32. However, if Image has third dimension like 32x32x64 and image filter is just one filter with dimensions…
jaykio77
  • 379
  • 1
  • 7
  • 22
0
votes
0 answers

Convolution in nengo

I wanted to perform convolution using Nengo networks. I requested ChatGPT to provide me with a code, but there is an issue with the code (explained below). I encountered a “ValueError: cannot reshape array of size 0 into shape (10,10)” error related…
DBM
  • 71
  • 7
0
votes
0 answers

Object detection, without prior classification

I'm looking for a method of detecting multiple, arbitrary, possibly overlapping objects in a dataset. An example image is shown below. I would like to find an algorithm to detect that there are 2 principle characters in the image, their approximate…
0
votes
0 answers

I am making Face Mask Detection and this error is given

pd.DataFrame(confusion_matrix(y_test , predict), columns=["No Mask","Mask"], index =["No Mask","Mask"]) ValueError: Shape of passed values is (1, 1), indices imply (2, 2) How to correct this error
0
votes
0 answers

How to solve an equation including a convolution integral in python?

I am trying to solve Cummins' equation: In this equation, M, A_inf and C are (n, n) constant matrices, F^exc is a time-dependent vector of length n, and K is a so-called 'Impulse Response Function' which associates an (n, n) matrix to each time…
0
votes
0 answers

Unexpected output from fftconvolve

I have two distributions where the probability density from [-0.05, 0) is 0 and defined using interpolation for [0,1]. import matplotlib.pyplot as plt import numpy as np from scipy import signal step = 1e-3 x = np.arange(-0.05, 1, step) x_0minus =…
matsuo_basho
  • 2,833
  • 8
  • 26
  • 47
0
votes
1 answer

Convolution in spatial domain vs fourier domain

i wrote a function which performs 2d-convolution in the fourier domain. However, when i compare the output of my function to the output of the scipy.ndimage.convolve function without transfering the image and the kernel into the fourier domain the…
Laurids
  • 23
  • 3