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
2 answers

Gradient descent for image deblurring

I'm having trouble implementing gradient descent algorithm to solve an optimisation problem of deblurring an image. Here is my initial optimisation function: E[u] = |g - u*k|^2 + λ Where g is a blurry image, u is a sharp image, k is a 2x2 blur…
0
votes
1 answer

2D Convolution for JavaScript Arrays

I am fairly new to JavaScript. I am trying to implement the 2D convolution described at http://www.songho.ca/dsp/convolution/convolution.html for C in JavaScript for a web app. function conv_2d(kernel, array){ var result =…
OMS
  • 57
  • 1
  • 9
0
votes
0 answers

How do I convolve() more than two distributions without doubling the result rowcount every time?

I am attempting to convolve() 36 beta distributions. The result distribution is one of the two input distributions to the next successive call to convolve(). After every convolve(), the result has row count = (nrow(vector1)+nrow(vector2)-1). In…
nigewi
  • 11
  • 1
0
votes
0 answers

Initializing conv2d Layer in Pytorch

I have a following neural network architecture: A(1x16x5x5)---\ -> concat(A,B) (1x32x5x5) --> Conv2D -> classification B(1x16x5x5)---/ Conv2D=nn.Conv2d(32,16, kernel_size = 1, stride = 1 , padding = 0) If I want to choose branch…
Bedrick Kiq
  • 365
  • 1
  • 5
  • 14
0
votes
1 answer

Apply a convolution to a scipy.sparse matrix

I try to compute a convolution on a scipy.sparse matrix. Here is the code: import numpy as np import scipy.sparse, scipy.signal M = scipy.sparse.csr_matrix([[0,1,0,0],[1,0,0,1],[1,0,1,0],[0,0,0,0]]) kernel = np.ones((3,3)) kernel[1,1]=0 X =…
Robin
  • 1,531
  • 1
  • 15
  • 35
0
votes
1 answer

Audio Convolution output is longer than input, how can i get around this when feeding data back to a stream of fixed length?

After taking audio data from a stream of length x, the data is then convolved with an impulse response of length 256. This gives the output vector a length of (x + 256 - 1). When the data is then fed back into a stream of length x there are 255…
0
votes
1 answer

conv1D kernel size in Keras

I have created and trained neural network using several Conv1D layers. My input has size 125x3. I am using the same kernel sizes for each Conv1D layers. I tried several kernel sizes 2, 5, 25, 50 and even 125 and I am using "same" padding. It was…
0
votes
1 answer

How to apply a filter to a .jpg image using only NumPy and PIL

I am trying to apply the following blur filter np.array([[1,1,1],[1,1,1],[1,1,1]])/9 to a .jpg image, however, the image is coming out either all black or with strange colours. I don't understand what I'm getting wrong because I applied a greyscale…
xlvs
  • 1
  • 3
0
votes
1 answer

Using convolution in order to derive an image rise wrong results on the edges

I'm taking an online course of image processing in which all the problem sets were given in MATLAB. Nevertheless, I'm trying to solve them with Python and I get some unexpected results when I try to compute image derivative using convolution with…
David Harar
  • 301
  • 2
  • 12
0
votes
1 answer

expected conv2d input to have shape (5665,445,3) but got aray with shape (1,445,3)

I have data of input shape (5665,445,3) but when I run my code I got this error expected conv2d input to have shape (5665,445,3) but got aaray with shape (1,445,3) I don't why. Any I idea why I get this error and how to solve it ?? code: def…
0
votes
0 answers

Building a customized convolutional layer in Keras

I want to build a customized convolutional layer in Keras that does convolution for two kernels and one image, I want it to be implemented in my network so I finally have a fully connected network and can be learning end-to-end. In other words, I…
0
votes
2 answers

How to solve "NotImplementedError"

I defined a three layer convolution layer(self.convs) ,the input tensor has the shape([100,10,24]) x_convs =…
Xin Yang
  • 13
  • 1
  • 2
0
votes
1 answer

How can I add all kernels/filters in a single TensorFlow Layer and give output as 1 final single image?

What I need to do is I have a final layer in my model as (None,512,512,64) , I want to add all these 64 images element wise and give output from my model. So How can I add all the images present in a single layer leading to 1 output.
0
votes
1 answer

Sobel filter - How to correctly display convolution result?

I'm currently trying to implement my own version of the Sobel-Filter/Operator. I tried to pull as much information as possible from Wikipedia(https://en.wikipedia.org/wiki/Sobel_operator) and numerous explanations on YouTube, but i can't find a…
Testarea
  • 88
  • 1
  • 6
0
votes
1 answer

How can I do indexwise Convolution type operation in Tensorflow using Conv2D?

So I have 64 Images/Feature maps of dimension 512x512 making it a cube of (512x512x64), I want to convolve each image with 64 kernels INDEXWISE. Example - 1st Image ------> 1st Kernel 2nd Image ------> 2nd Kernel 3rd Image ------> 3rd Kernel…