Hot answers tagged

9

Matlab's fft functions are all based on FFTW (this is confirmed here), so I guess the obvious choice for you should be FFTW. FFTW is hardware-independent but it can take advantage of some hardware-specific features.


6

The reason for that is that you don't normalize the DFT samples properly. Dividing by number of samples in time domain is valid only for Rectangular Window. For simple case of DFT, you should divide your amplitude by sum of window samples: $$S=\sum_{i=0}^{N-1}w_i $$ This for Rectangular Window will be obviously equal to $N$ ($8192$ in your case), whereas ...


5

Maybe a bit late, but since others might land here like me. The following are good signal processing libraries/frameworks: * https://www.gnuradio.org/ - lots of classic signal processing + cascading options * https://root.cern.ch/ - advanced statistical signal processing Both provide generic facade, fall-back implementations as well as performance ...


5

I was also searching for fast FFT library to be used from C++. Let me share what I think the situation is in 2019. FFTW is the most popular FFT library. It has planty of features and it's often used as the reference point, but a number of other libraries has comparable or better performance. Intel MKL library, which is now freely redistributable, is ...


4

Since FFT treats the signal as if it is periodic you need either to apply a window function (for example hanning) on your signal or make it coherent. In the image3 you attached you may make it coherent by only using data for a number of cycles; use samples 0..31 or 0..63. If the signal is non-coherent it will be seen by the FFT as a concatenated signal with ...


3

I would like to direct you to 3 references: C. Steger: “Extracting Curvilinear Structures: A Differential Geometric Approach”. In B. Buxton, R. Cipolla, eds., “Fourth European Conference on Computer Vision”, Lecture Notes in Computer Science, Volume 1064, Springer Verlag, pp. 630-641, 1996. C. Steger: “Extraction of Curved Lines from Images”. ...


3

Simply put, you need a bank of passband filters. You feed your signal through each of the filters, and sum up the outputs from the filters. Designing the filters is where the fun comes in. First off, assuming this is just audio (music or the like) then there's no need of special filters. You can use the simplest and fastest and not worry too much about ...


3

There's also FFTS (written in C, not C++, though), which has some impressive benchmarks: https://github.com/anthonix/ffts I compiled it under Linux, but haven't had a chance to play with it yet.


3

I second the fftw suggestion. One of the nice features of fftw is "wisdom". That is, if you call many times the same Fourier Transform (with the same array size), you can ask fftw to look for the fastest way to do it, and then it will use that way for all the following computation in your code.


3

In computer programs, complex numbers are usually represented by an array, field or vector containing two values: one value represents the real part, the other represents the imaginary part of the complex number. The imaginary unit itself is usually not represented at all, because this information would be redundant. An alternative representation is to ...


3

From BFMatcher constructor documentation: NORM_HAMMING should be used with ORB, BRISK and BRIEF, NORM_HAMMING2 should be used with ORB when WTA_K==3 or 4 (see ORB::ORB constructor description) And ORB constructor documentation: WTA_K - [...] Other possible values are 3 and 4. [...] Such output will occupy 2 bits, and therefore it will need a special ...


3

I think least squares is going to be the best approach, and that's not going to be that computationally expensive (I think! Please correct me if I'm wrong). The gradient can be estimated from a sliding window of your data using: $$ \hat{k} = \frac{\sum (x_n - \bar{x})(y_n - \bar{y})}{\sum (x_n - \bar{x})^2 } $$ where the sum over $n$ is taken over the ...


3

Take a sine-like signal $s$. In the appropriate Fourier $\mathcal{F}$ domain, it is represented by two "peaks", the other coefficients being zero. Fourier is a sparse representation for sines or close-to-sine signals. Conversely, a zero signal, except for a few values, is sparse in its original domain. In narrow sense, a sparse representation of data is a ...


3

The best performance you will be able to squeeze out of a PC is with an audio interface that supports ASIO. To be able to get near 10ms of total delay (input and output) you will also need a very fast machine. Not only in terms of CPU but more importantly in terms of memory performance. On top of this delay, you are going to have to add the delay in ...


3

Your analog transfer function looks OK. For the sake of clarity - and to reduce the chance of making errors - I'd just rewrite it as $$H_a(s)=G\cdot\frac{s^2+as + b}{s^2+cs + d}\tag{1}$$ with $$\begin{align}G&=\frac{2R_g}{R_d+2R_g}\\a&=\frac{R_d}{L}\\b&=\frac{1}{LC}\\c&=G\left(a+\frac{1}{2R_gC}\right)\\d&=G\cdot b\frac{}{}\end{align}$$ ...


3

Could be a few things You may be borderline clipping. Your sine wave has an amplitude of 1, which is just at the edge of clipping (depending on how its rendered). Try it with an amplitude of 0.5 Your hardware is sloppy. For example, cheap laptop sound cards often cut corners in the anti aliasing filters and or clipping management Your operating system is ...


2

I was looking for a way of converting MATLAB code to C/C++ that I found Armadillo: http://arma.sourceforge.net/license.html. It's a C++ library covering various categories such as signal and image processing, statistics, matrix and vector, etc. For implementing a FIR filter for example, one can use the convolution (conv(A,B)) function.


2

I am not familiar with signal processing for audio, but I would like give answer which contain common programming suggestions. Sorry, I really do not know your programming level and may be this suggestions will be look obvious and ridiculous, but I hope it will be useful. I'm getting some odd results with some code I'm working on. When you get odd ...


2

Try dilation, a technique used to enlargen light spots over darker spots in an image. Start by dilating the image such that many of the enlargened white blobs will overlap and form a complete connected contour, as such: Now, when OpenCV finds contours from this large figure to make convex hulls, it will find a complete circle rather than loose seperate ...


2

The two that I see being used most often are: Ooura FFT: http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html IPP: https://software.intel.com/en-us/intel-ipp You have to pay for a license for IPP (Intel Performance Primatives) but it would be the tool of choice for a commercial offering. Ooura FFT has good all round performance and a permissive license. On a ...


2

Reading the manual, even though only half the data is returned, the full length FFT is calculated: So you should normalize by whatever the full length is normalized to: fft_size.


2

The UINT8 type is limited to integer numbers on the range [0, 1, 2, ..., 255]. Hence negative values are clipped into 0. A solution could be wither use other types (Floating Points) or scale and shift. For instance, given a Floating Point image with values imageMax and imageMean you can scale it into the [0, 1, 2, ..., 255] by doing: Create only ...


2

You can fully reconstruct L and R from M and S, as you suspect. In your case: $ M = {{L + R} \over 2} $ $ L = 2M - R $ $ S = {{L - R} \over 2} $ then $ S = {{2M - R - R} \over 2} $. So the math checks out. Are you not getting the results you expect? When I've worked with M&S in the past, I've alyways just done the scaling by 1/2 when returning ...


2

As a first step, try just a simple first order smoother on your already-smoothed (but still too spiky) data: $$ v_f[n] = (1-\alpha) v_f[n-1] + \alpha v[n] $$ where $v_f$ is the velocity with extra filtering, $v$ is your current filtered velocity, and $0 \lt \alpha \lt 1$, and usually close to 1. If I do this in the R code below, then I get the green line in ...


2

Your implementation of the delay line is flawed. It's just copying the second last sample over each element. Try this instead: for (int i = 7; i >=0; i--) { // delayLine being 9 values long delayLine[i + 1] = delayLine[i]; } Previous answer below Your filter seems to be a lossy low pass filter --- even the passband has -15dB ...


2

If you require two outputs, which belong to a movement in x and the other in y direction, you could start with the assumption, that both movements are independent an simply implement two PID controller, each caring for one direction. It gets interesting at the point where you translate the output of these two controller to signals to the actuators. Here it ...


2

When dealing with Gaussian Blur in the Image Processing context the following holds: The Standard Deviation, $ \sigma $, is sometimes called radius. I think this goes back to Photoshop. If you implement this using FIR Filter (Well, Gaussian Kernel is infinite so you approximate it) usually the radius of the filter will be something like ceil(4 * kernelStd). ...


2

Here are some approaches to consider: FMCW: Transmit a "chirp" signal where the frequency transmitted is slowly ramped from a low frequency to a high frequency (repeatably as a sawtooth or ramp pattern). Multiply the received chirp with a replica of the transmitted chirp. The frequency of the resulting signal (after low pass filtering) will be ...


2

When you solve Non Linear Least Squares problem of a non convex cost function the end solution (Which is guaranteed to be a Local Minimum) will depend on: Method of Minimization. Method Parameters. Starting Point. In the case above you set the starting point to be the same for both. Yet in AlgLib you use the method of Levenberg Marquardt (Classic for Non ...


2

Your sine wave should use 2pi instead of frame rate. Also, your frequency data should have window size/2 points and go from 0 to frame rate/2, not frame rate.


Only top voted, non community-wiki answers of a minimum length are eligible