Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I've been using OpenCV for quite a while now and was wondering if switching to MATLAB would be a good idea. As far as I know they are both the same with MATLAB built over underlying OpenCV libraries. OpenCV is open source which is a definite advantage and supported on more platforms.
I'm trying algorithms specific for Pupil Detection so I need the results to be really precise.
Does anyone know any advantages by way of speed or processing or inbuilt functions that MATLAB uses?
If you already know OpenCV then stick with OpenCV. Currently OpenCV is the most comprehensive open source library for computer vision and it has large user community. OpenCV has more functions for computer vision than Matlab. Many of its functions are implemented on GPU. The library is being continuously updated (an updated version is released approximately every 3 to 4 months). In general C++ OpenCV code runs faster than Matlab code (if it's not fast enough, you can make it faster by optimizing the source code).
Matlab is useful for rapid prototyping and Matlab code is very easy to debug. It has good documentation and support. However, as others have mentioned, Matlab is not open source, its licence is pretty pricey, and its programs are not portable. Matlab is an interpreted language and it negatively affects its performance. Performance matters a lot in computer vision, especially if you are doing real time video processing. Its programs can be made fast too, however you will have to rely on high-level functions (i.e. built-in functions professionally written in C), mex functions (your own compiled C code), and you'll have to learn how to vectorize your code to achieve decent speed.
You haven't mentioned how you are using OpenCV so I am going to assume that you are using C++; in case you are using Python, please read this page..
If you are planning to use GPU for processing, then I would suggest you stick to C++.. Of course, there are loads of other optimizations you can do to your code..
For MATLAB, there are some fairly basic things that can be done as well..
At the end of the day, I would say that the closer you are to machine level language, the better your performance is going to be. But of course, using C can be a pain since there is a HIGH chance of writing unoptimized code and memory leaks. For this reason, C++ gives the best trade-off..
HTH
Your question does not really make sense.
OpenCV is a C++-library for carrying out computer vision tasks. Apart from C++, there is support for other programming languages via bindings.
MATLAB is a full scientific suite that consists of a massive IDE with its own language.
If you want your code to run in MATLAB, then you write MATLAB code. But then you will also need to install a 4GB IDE, and pay for a fairly expensive license.
My personal choice is to use OpenCV with the Python language bindings, as this gives me a nice scripting interface to do matrix operations (arguably somewhat more cluttered than MATLAB's) while still having easy access to OpenCV-functions.
If you really understand about opencv means definitly you never think about switching from opencv to matlab.
You can use opencv with python or cpp and even java etc., also.
Actually, you should not consider opencv only to complete your whole task.
Like opencv, other libraries also exists.
For example,
numpy -> for fast numeric calculation
matplotlib -> to show figure window etc., like matlab.
scipy -> for fast scientific calculation.
If you use your_programming_language + opencv + matplotlib + numpy + scipy definitly you will wonder about opencv.
And, don't worry about how to mingle these libraries together. Just mention their name and do your actual coding. Thats all.
Related
I have recently found a Matlab program (TraitLab) that I would like to try and use, but I do not have a Matlab license. Given that I thought GNU Octave and Matlab are mostly compatible, I tried to run it in octave, but the GUI way to run the program depends on loading a .fig file (now I know that I can use load to get the struct content of that file, but that does not make it a figure I can pass around to various GUI functions), and the headless way to run it reports many parse errors about
nested functions not implemented in this context
Is there an obvious way to get a function written for Matlab that shows these two symptoms to run under Octave?
I have downloaded TraitLab and it is obvious to me that it is a program that will need heavy modification for you to run on octave, which you probably don't have time (or possibly expert knowledge) to implement.
In this case you really only have two other options.
1) Write to the developers and ask them if they could re-implement their code in such a way to make it Octave compatible. I wouldn't hold my breath since it's an academic library, but it's always worth pointing out that there is demand for Octave compatible code. Also given this is old code, it's still worth contacting the stats lab in oxford, since they may have moved to a different codebase that might also suit your needs (e.g. I know that a lot of stats people in oxford have made the switch to julia).
2) In the meantime, if you really want to run this but you don't have matlab, find a matlab installation (e.g. from a friend, or at your university) and create a standalone-version using Matlab's "Application Compiler".
OR
Consider buying matlab. It has a reputation for being prohibitively expensive, partly because University-wide licences do cost an arm and a leg. But for personal use (especially if you are a student?), with the right licence and only the necessary toolkits, it's actually not as prohibitively expensive as you might think.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
after a long term of reading the theory behind neural networks I finally want to stark to do my own project in object recognition.
However I struggle to find a practical entry point. I want to use either C#,C++ or C however all new tutorials seem to involve newer languages such as python.
For starting I would especially like to reprogram the theory concepts of Yann LeCuns publications about object recognition.
Which programming language is recommended to use? And much more important: Which framework do I use? There seem to be docents of frameworks (AForge, Apache Mahout, OpenCV) and my theoretical knowledge seems to be too impractical to differentiate the usage of these.
I want to program a simple independent neural network application which should be easy trainable plus I don't want to reprogram classes such as neuron or layer in order to focus on the architecture for the beginning.
Thanks and sorry for the simple probably often ask question, however I just couldn't find anything matching.
Greetings
Nex
disclosure: i'm not an expert.
depends on what exactly you want to do.
if you want to build something from scratch, probably the easiest language to start prototyping is matlab/octave because it's high level and offers pretty fast matrix manipulations, nice math support (like numeric derivatives) and robust plotting to quickly verify your models. when you have your prototype, you can port to to c/c++ to make it faster, more space efficient, portable etc.
if you want to just use exiting tools/techniques and just play with parameters (preprocessing, feature selection etc) to find the best model for you, i would recommend start from R and caret package or python (don't remember the package name)
if you want to use NN in cluster on big data then i would try using existing frameworks like openCV (not sure if mahout provides NN)
Google just released their tensorflow framework.
Its perfect to start with and offers even for high skilled NN-architectures a lot of feautes. I highly recommend it for everyone.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
This semester, I'm implementing a compressed-sensing algorithm as an iPhone app. To do this, I'll need some good matrix/linear algebra libraries. I'm a little new to both iOS and Python, and am looking for some help at evaluating my options.
I know the iPhone has the Accelerate framework, which includes vecLib, BLAS, and LAPACK, but I'm not familiar with their API's (and they seem fairly confusing).
I've played around with Python/numpy, and I really like how simple it is to use - if I have the choice, I'd prefer to use numpy over Accelerate.
I know it's possible to embed Python, but I have had little luck on my own. I tried to include Enthought's EPD.framework in an XCode project, but didn't get it to work after playing around for an hour or so. I would imagine that compiling numpy would be worse.
As another alternative, could I use Cython (http://cython.org/) to generate C files then call functions from that? I also attempted this, but ran into more issues with including a .so library and calling it. Is there any way to have Cython generate .c and .h files? Would said .c and .h files still depend on numpy?
I've read some stuff about PyInstaller and freeze.py. Could either of those help me here?
Are there any options besides Accelerate or Python+numpy? Is Python+numpy a good option, or will it be hard to compile/build? Is Cython a valid solution?
Thank you!
Take the time to learn the Accelerate commands. If your doing complex math, these are the functions you want to be using. They are much faster, infinitely more likely to continue to be supported and tuned to future hardware, and as well - they use less energy than naive solutions.
The new release of the Swift programming language with iOS 8 allows for high level Python/Matlab -like code to be written. Accordingly, a framework called swix has been developed that wraps the Accelerate (/BLAS/Lapack/etc) frameworks.
Code snippet that fully utilizes the Accelerate framework:
var N = 10
var x = ones(N) * pi
var y = ones(N) * phi
var result = (x+y+4)*x
This code will can be compiled for the iPhone/iOS. Full details on installation are covered in the swix documentation.
With the release of Swift, and its access to the Accelerate framework, there is little reason to go out of your way to get Python running. With the right frameworks, you can use Swift to write high-level, and performant, code for iOS with syntax similar to Python/numpy, and performance that will be significantly greater than running numpy on iOS.
As other people have already posted, there are various libraries that attempt to 'wrap' the Accelerate framework to provide high-performance with an accessible API. As an alternative to the swix library in another answer, I have had great success with the Upsurge framework. For the kinds of operations that you are probably going to use, Upsurge may have everything that you need.
It provides an easy and detailed interface to a variety of Accelerate functions; matrices, convolution, FFT, linear algebra, mathematics etc. It also supports a lot of these operations on its own custom tensor type. The big advantage that I found over swix when I was deciding between them, was that Upsurge didn't have a dependency on OpenCV and didn't require any bridging headers (it is written in pure swift) which made debugging easier for me.
That being said, they are both great frameworks and either one will cover your needs. I would have a look at both and see which one better fits your needs.
There are libraries to include Python on iOS. These libraries are Kivy and Beeware. These are libraries that have the entire app written in Python.
Kivy
does not have a native GUI -- the app looks "Kivy"
can not make native system API calls
this is a more mature project than Beeware
Beeware
has a native looking GUI
can call native system APIs
(a newer project; less mature)
For Kivy, look at kivy-ios and the GitHub project and for Beeware look at python-ios-template.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I a medical researcher with code written in MATLAB 2009b that runs very slowly because of a self-referential loop (not sure of the programming lingo here), i.e., the results of the first iteration is used during the second iteration, etc. (I have vectorized it to a fare-thee-well. I have run the Profiler.)
I'd like to convert the slow parts of the code to a mex function. I learned Fortran in the early 1970s but haven't used it since. The code I need to convert doesn't do anything fancy, it is just a long numerical calculation.
My question is: what would be the easiest-to-relearn version of Fortran adequate for this purpose, and what compiler works best on the Intel Mac for this? I found information comparing syntax in MATLAB to Fortran 90 for example, and the conversion doesn't look like it would be too daunting for me. However, again, I am no programmer.
I am using a MacBook Pro with OS 10.6.
Appreciate any help, thanks.
I'd recommend using modern Fortran, at least 90/95 as the syntax is much more forgiving and almost all compilers now support it.
On a Mac I would recommend gfortran from here. It's not the most recent version, but it's well integrated with Apple build tools (you will need to install Xcode from your Mac OS DVD) and works well. In the numerical python community, which depends a lot of Fortran extensions, this build is highly recommended.
I haven't actually used fortran mex on the mac - but I think it should be fairly straightforward if you follow the mex documentation - and as you say translating code from Matlab to Fortran shouldn't be too bad (it's better if you can avoid calling Matlab functions, but fortran has sensible slicing and array access).
Well, you have probably found a solution already. However, I will say this: Matlab has been getting faster and faster. However making full use of Matlab's JIT is sometimes not intuitive. Mathworks used to say vectorize code for speed. Then they said write everything in explicit loops. I'm actually not certain what the current best practice is.
What I'm saying is, before you go to fortran, find out the best practice and implement it. That may give you enough of a speed-up right there.
Also, are you absolutely certain that you have isolated the slowdown to a loop? Have you been using the profiler? You probably have, since you sound experienced. I just thought I'd mention it.
Good luck,
Ariel
i'm a computer systems engineering undergraduate student, i just want to know what advantages MATLAB has over SCILAB and vice versa other than that SCILAB is freeware.
i mean from a computer engineer point of view.
thanks
I can't get into the nitty-gritty details, as I haven't used SCILAB extensively.
But from a bird's eye view, MATLAB is a very polished software, with decades of development behind it. And a price to match. It has a huge array of specialized packages, good support, a reasonably well designed UI, and it's generally user-friendly enough for non-computer engineers to work with. It's also very common in the industry, so it's not a bad thing to have on your resume.
But if you don't have very complex needs (which I suspect, given the use I made of MATLAB during my undergrad years) and you don't need the robustness and polish of a professional package, SCILAB will probably meet your needs.
And since it's based on the MATLAB language, what you'll learn can be transferred later on if your needs change, or you find yourself working in an environment where MATLAB is the default.
Scilab is to MATLAB as OpenOffice is to MS Office. That is to say, it's a not-quite-a-clone, and it's not as polished. You do get most of the functionality of MATLAB, and the price is much more agreeable.
That said, if you want a free/open pretend MATLAB, I personally prefer Octave, since the syntax is closer to MATLAB's.
If you aren't bothered about MATLAB compatibility, then check out the statistics language/environment R, which is delightful.
Matlab is the de-facto industrial standard, is ready now and here, and has a big firm behind to push it.
Scilab has been for long time the open source alternative, but honestly it never appealed me. I think that or they never belived enough on the project, or that you need too much money to make a valid product of this kind.
And it is a real pity, since we desperately need a good open source alternative, because being open source is the only way to be very efficient on different platform: actually matlab is very good at prototyping small-medium programs, but since it is closed source, it's very difficult to scale it up, to supercomputers for example, requiring often a complete rewrite of the code.
Sage might be the third way, it has a lot of potential, and I would bet on it. Check it. It doesn't reinvent the wheel like Scilab did, but take existing software and merge it in a new program. It is based on python which gained a lot of momentum in the computing world, since it has shown to be both easy enough to quick prototype, and versatile enough to run on exotic platforma like supercomputers or GPGPU.
# MatlabDoug
It is feasible in small-medium environment, but on very big task the flexibility of open source is invaluable.
Starting from low-level tool like open-mpi that allows you to finely tune your applications, through higher-level framework like PETSc that lift a lot of work from your shoulders, to java and python implementations that let you concentrate on the algorithms forgetting about many of the headaches of the lower level languages.
But the real proof is that an astonishing majority of the top500 supercompunters prefers open source alternatives.