I have exposure to MATLAB and have some basic exposure to signal processing and plotting in MATLAB... but I am more comfortable with C/C++ than MATLAB because I have been working in Image processing with OpenCV... I was just curious: Is there any DSP library or platform (as OpenCV is for image processing) for doing signal processing in C/C++?
-
1$\begingroup$ One example that is skewed toward wireless communications applications is GNU Radio. $\endgroup$– Jason RFeb 2, 2013 at 2:48
-
1$\begingroup$ There are lots of FFT libraries in C/C++. FFTW is a particularly fast one. $\endgroup$– Jim ClayFeb 2, 2013 at 3:49
-
3$\begingroup$ One problem with getting good answers to this question is that "signal processing" is an exceedingly-broad term encompassing many domain-specific subfields. I would call OpenCV a signal processing library, but that doesn't make it useful to someone who uses DSP for communications, for instance. Perhaps you could narrow your query. $\endgroup$– Jason RFeb 5, 2013 at 18:24
-
1$\begingroup$ Re: @JimClay 's comment: FFTW is a great library. If you need to use C-source code in a project, you might want to check out KissFFT. It's not as well optimized, but it's pretty good, and as the name might suggest it's rather simple to read through the source code. sourceforge.net/projects/kissfft $\endgroup$– Dave CFeb 8, 2013 at 15:33
6 Answers
Octave is a multi-platform open source math and matrix toolkit. It has a command line interpreter aimed to be very similar to MATLAB, but there is also a C++ API available for use. Since you refer to signal processing in contrast to image processing, I assume you mean audio processing, so you might need to look into the "signal" and "audio" packages in octave (which provide e.g. wavread). Keep in mind however, that the API is primarily designed for internal use in the octave CLI, and that it is considered not stable (i.e. the bindings might change). Also, since the library is not primarily meant to be linked with, the documentation is poor to say the least.
Alternatively, there is also GNU Scientific Library, which is not primarily aimed at signal processing, but provides complex numbers, matrices, fft and so on. On Windows, you would have to compile that yourself using Cygwin.
Have you checked out gnuradio? They have blocks similar to what is used in signal processing. When I used to a few years ago, there were a large number of blocks that were already available and more in the works, all written in C++. The blocks were glued together using python, but a complete C++ implementation was in the works.
Intel's Integrated Performance Primitives (IPP) C++ library has both signal processing and image processing components.
I haven't used it, but have heard good things about armadillo ( http://arma.sourceforge.net/ ) for matlab-like functionality. There are a few others like it, but it seems that armadillo is optimized and actively developed.
Part of the appeal of octave, matlab, or python/numpy/scipy (sometimes called "pylab") is the simple syntax along with an interactive interpreter with tab completions. This can speed up development quite a bit.
With python/numpy, it's possible to wrap a dll with a python wrapper, and use it from within the interactive interpreter. I believe this can also be done with matlab, but I'm unsure if this can be done in octave. Be warned, however, that this can be slightly complicated in python/numpy though I've found the benefits to be worth the cost in the past when performance is critical.
Armadillo does a great job for linear algebra in C++ (pretty fast via expression templates), and can be certainly used for signal processing as well. Apart from supporting matrices with various element types, it has support for 3rd order tensors (cubes), which are useful in image processing.
There is also a related C++ library known as IT++, which is not as fast as Armadillo, but it has more pre-built classes geared towards signal processing and communication.
-
$\begingroup$ Update: as of version 4.0+, Armadillo now has functions for 1D FFT, 2D FFT, and convolution $\endgroup$– mtallMar 26, 2014 at 16:13
JUCE is a nice C++ audio platform library. You can make VST's pretty easily in it if you want to quickly have an I/O buffer playing to your soundcard that you can work on. Plus afterwards you can use it as a cross platform VST if you want.