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

About 2D convolutions and how they produce a 1 channel image

Trying to understand 2D convolutions, I ran into the following image, which has me confused: If I understood correctly: the blue shape is the input the orange shape is the one of the convolution filters the green shape is the output My question…
BillTheKid
  • 377
  • 1
  • 13
0
votes
1 answer

How does OpenCV's DFT-based filter2D actually work?

I have issues comprehending how the filter2D method of the the OpenCV library actually works. The "standard" direct version for small kernel sizes is clear, but for larger kernel sizes "(~11 x 11 or larger) the function uses the DFT-based…
lenxn
  • 85
  • 1
  • 8
0
votes
0 answers

Problem understanding convolutions (conv(data)[i] == conv(data[i].unsqueeze(0))??)

import torch import torch.nn as nn data = torch.ones(3,3,6,6) conv = nn.Conv2d(3, 16, kernel_size = 3, padding = 1) print(data[0].unsqueeze(0).shape) for i in range(3): print((conv(data)[i] ==…
Saad Jlil
  • 31
  • 4
0
votes
1 answer

spatial domain convolution not equal to frequency domain multiplication using pytorch

I want to verify if 2D convolution in spatial domain is really a multiplication in frequency domain, so I used pytorch to implement convolution of an image with a 3×3 kernel (both real). Then I transformed both the image and the kernel into…
MMLi
  • 98
  • 5
0
votes
1 answer

Fastest method to convolve a gaussian with an image containing a single delta for python

I have a images, each with a single value of 1 (delta) within it and previously known sigma. Reproduction of a single example: img = np.zeros((40,40)) idx1 = np.random.randint(0, img.shape[0]) idx2 = np.random.randint(0, img.shape[1]) img [idx1,…
havakok
  • 1,185
  • 2
  • 13
  • 45
0
votes
0 answers

Assertion error while computing 2D convolution of the 2D input image

I am having assertion error while computing 2D convolution of an 2d image. I am struggling to assign correct range of i and j and then computing Yield keyword for view. It's giving me assertion error. Can somebody tell me what mistake I am…
ana754
  • 1
0
votes
2 answers

Error plotting symbolic variable in MATLAB?

I am trying to learn fourier transform from book"signals and systems laboratory with matlab alex palamides" On page 312, following code is given which demonstrates that convolution can be implemented by multiplying the fourier transforms of two…
LECS
  • 121
  • 12
0
votes
0 answers

Why is the image shifted after cv2filter2D, np.ff and, np.ifft?

I convolute an image with a kernel and then trying to deconvolute in the Fourier domain. However, the reconstructed image is shifted? What is the reason for this? Is something wrong with my code? Original image: Reconstructed image: Code to…
tag
  • 419
  • 1
  • 10
  • 24
0
votes
1 answer

is Softmax a must have in NN?

I was wondering if softmax is a must-have in a multi-class(more than 2) classification neural network? I was reading some stack-overflow topics and I saw people talking that it's necessary to have softmax at the last layer, but I am not sure if it…
Solruhama
  • 101
  • 7
0
votes
1 answer

(Conv1D) Tensorflow and Jax Resulting Different Outputs for The Same Input

I am trying to use conv1d functions to make a transposed convlotion repectively at jax and tensorflow. I read the documentation of both of jax and tensorflow for the con1d_transposed operation but they are resulting with different outputs for the…
0
votes
0 answers

Confusion understanding MATLAB implementation of convolution?

I am trying to implement convolution in MATLAB without using built in command. I have obtained a code from google and some how understood it but still there is some confusion especially regarding the highlighted line and more specifically about the…
LECS
  • 121
  • 12
0
votes
2 answers

speeding up 1d convolution in PyTorch

For my project I am using pytorch as a linear algebra backend. For the performance part of my code, I need to do 1D convolutions of 2 small (length between 2 and 9) vectors (1D tensors) a very large number of times. My code allows for…
Patrickens
  • 321
  • 3
  • 14
0
votes
1 answer

Using Octave, construct an algorithm that cuts off pauses for a speech signal

Can you please explain how to do this? (Using Octave, construct an algorithm that cuts off pauses for a speech signal) The audio file: https://www.dropbox.com/s/34ait9wo4b1j1ld/test1.ogg?dl=1 Here is my plan: Read the audio file Create a filter…
einar
  • 13
  • 6
0
votes
0 answers

Can somebody explain what is a spatially varying kernel?

I have performed 2D convolution on image matrix using: A. Matrix multiplication B. Fast Fourier Transformation. My question is can I apply any of the above techniques (let's say FFT) for performing convolutions using spatially varying kernel? My…
d_n2001
  • 1
  • 2
0
votes
1 answer

How is the discrete convolution applied to real world signals

I'm in a position where I need to practically apply a filter to digitally sampled input data in realtime (from an ADC or otherwise). In other words, a Discrete Convolution. However, after reviewing the literature, it struck me that this operation…
sherrellbc
  • 4,650
  • 9
  • 48
  • 77