convolution

Need Block-Oriented Error Correcting Scheme

I'm storing many files of various lengths into a block-oriented medium (fixed-size e.g. 1024 bytes). When reading back the file, each block will either be missing or correct (no bit errors or the like). The missing blocks are random, and there's not necessarily any sequence to the missing blocks. I'd like to be able to reassemble the ...

How do I do convolution in F#?

I would like convolve a discrete signal with a discrete filter. The signal and filter is sequences of float in F#. The only way I can figure out how to do it is with two nested for loops and a mutable array to store the result, but it does not feel very functional. Here is how I would do it non-functional: conv = double[len(signal) +...

Convolution Filter - Float Precision C Vs Java

Hey! I'm porting a library of image manipulation routines into C from Java and I'm getting some very small differences when I compare the results. Is it reasonable that these differences are in the different languages' handling of float values or do I still have work to do! The routine is Convolution with a 3 x 3 kernel, it's operated ...

Basic Complexity Question - Convolution

Hi All, I'm trying to evaluate the complexity of some basic image filtering algorithms. I was wondering if you could verify this theory; For a basic pixel by pixel filter like Inverse the number of operations grows linearly with the size of the input (In pixels) and Let S = Length of the side of the image Let M = # pixels input Inve...

Convolution of two functions in Python

Hi! I will have to implement a convolution of two functions in Python, but SciPy/Numpy appear to have functions only for the convolution of two arrays. Before I try to implement this by using the the regular integration expression of convolution, I would like to ask if someone knows of an already available module that performs these op...

How do I multiply the spectra of two images of different dimensions?

Hello, This is not a "programming" question. But I'm sure it's something that is widely known and understood in this community. I have an image, x, and a much smaller image, y, and I need to convolve the two by multiplying their FFTs. But since they are not the same size I don't know how to do the frequency domain multiplication. I ta...

Fastest method to compute convolution

I have to apply a convolution filter on each row of many images. The classic is 360 images of 1024x1024 pixels. In my use case it is 720 images 560x600 pixels. The problem is that my code is much slower than what is advertised in articles. I have implemented the naive convolution, and it takes 2m 30s. I then switched to FFT using fft...

Convolution matrix for diagonal motion blur

Hello, I know my question is not really a programming question but it came out of programming need. Does anyone happen to know the convolution matrix for diagonal motion blur. 3x3, 4x4 or 5x5 are all good. Thanks, ...

3d convolution in c++

Hello, I'm looking for some source code implementing 3d convolution. Ideally, I need C++ code or CUDA code. I'd appreciate if anybody can point me to a nice and fast implementation :-) Cheers ...

Improving Numpy Performance

I'd like to improve the performance of convolution using python, and was hoping for some insight on how to best go about improving performance. I am currently using scipy to perform the convolution, using code somewhat like the snippet below: import numpy import scipy import scipy.signal import timeit a=numpy.array ( [ range(1000000)...

How does a convolution matrix work?

I know this isn't very relevant to programming, but I need to know how a convolution matrix works for a PHP GD function. I've searched a lot on Google, but can't find anything that explains it well. ...

2d convolution using python and numpy

Hi I am trying to perform a 2d convolution in python using numpy I have a 2d array as follows with kernel H_r for the rows and H_c for the columns data = np.zeros((nr, nc), dtype=np.float32) #fill array with some data here then convolve for r in range(nr): data[r,:] = np.convolve(data[r,:], H_r, 'same') for c in range(nc): ...

OpenMP + SSE gives no speedup

Hi, My Professor found out this interesting experiment of 3D Linearly separable Kernel Convolution using SSE and OpenMP, and gave the task to me to benchmark the statistics on our system. The author claims a crazy 18 fold speedup from the serial approach! Might not be always, but we were expecting at least a 2-4 times speedup running th...

Convolving two signals

Calculate the convolution of the following signals (your answer will be in the form of an equation): h[n] = [n-1] + [n+1], x[n] = [n-a] + [n+b] I'm lost as to what I do with h and x. Do I simply multiply them? h[n]*x[n]? I programmed convolution with several types of blurs and edge detectors, but I don't see how to translate that...

Multi-dimensional array edge/border conditions

Hi, I'm iterating over a 3 dimensional array (which is an image with 3 values for each pixel) to apply a 3x3 filter to each pixel as follows: //For each value on the image for (i=0;i<3*width*height;i++){ //For each filter value for (j=0;j<9;j++){ if (notOutsideEdgesCondition){ *(**(outArray)+i)+= *(**(pix...

Trouble with lazy convolution fn in Clojure

I am writing some signal processing software, and I am starting off by writing out a discrete convolution function. This works fine for the first ten thousand or so list of values, but as they get larger (say, 100k), I begin to get StackOverflow errors, of course. Unfortunately, I am having a lot of trouble converting the imperitive ...

Gaussian blur and convolution kernels

I do not understand what a convolution kernel is and how I would apply a convolution matrix to pixels in an image (I am talking about doing a Gaussian Blur operation on an image). Also could I get an explanation on how to create a kernel for a Gaussian Blur operation? I am reading this article (http://en.wikipedia.org/wiki/Gaussian_bl...

Opencv: Detect a black to white gradient in an area

Hi, I uploaded an example image for better understanding: http://www.imagebanana.com/view/kaja46ko/test.jpg In the image you can see some scanlines and a marker (the white retangle with the circle in it). I want opencv to go along a specified area (in the example outlined trough the scanlines) that should be around 5x5. If that area co...

Writen Convolution function in matlab giving trouble

Hey there, I've been having difficulty writing the matlab equivalent of the conv(x,y) function. I cant figure out why this gives the incorrect output. For the arrays x1 = [1 2 1] and x2 = [3 1 1]. Here's what I have x1 = [1 2 1]; x2 = [3 1 1]; x1len = leng(x1); x2len = leng(x2); len = x1len + x2len - 1; x1 = zeros(1,len); x2 = zeros(...

PHP sharpness convolution martix

I'm using a convolution matrix for sharpness in PHP GD and I want to change the sharpness "level". Where would I make changes to this if I want to make it more or less sharp? $image = imagecreatefromjpeg('pic.jpg'); $matrix = array( array(0, -1, 0), array(-1, 5, -1), array(0, -1, 0) ); imageconvolution($image, $matrix, 1, 0...