I worked with both Matlab and OpenCV. Both are very good. To choose between Matlab or OpenCV depends on your background of programming. If you do not like to go down to the C or C++ programming level, then I would recommend Matlab, and vice versa.
Matlab 2013 has very strong Image processing TB and they just introduced computer vision TB with many new functions and video processing in MATLAB 2013b. It has also many functions for feature extraction such as Viola Jones and HOG features. You can take a look at the Computer vision TB from http://www.mathworks.se/videos/computer-vision-system-toolbox-overview-61219.html
in addition to the previous comment, I want to add that it also depends on what you actually want to achieve,
do you want to create an actual implementation which is supposed to run in a bigger environment? then use openCV since, as mentioned before, it is C++ based and can easily be integrated in running code.
if you want to test algorithms and parameters for image processing, so to create a processing scheme, Matlab gives you a better framework to analyze results and effects.
Thank you Benedikt for the comment. I also want to add that if you want to do something with real time application, then I recommend OpenCV. It runs much faster as you go down to C++ level. you should remember that MATLAB is an interpreter. However, you can convert your matlab code into exe also.
Thank you Richard, Benedikt and Hasan. First I should learn OpenCV. Its good to find OpenCV faster than Matlab. I often find Matlab taking more than 5 minutes in average applications.
Thank you Carmen. This is really good point. There is something very interesting in OpenCV that is you do not need to install the whole software. What I did before is that I only selected the libraries I needed for my work and I integrate them in my C code and it worked pretty well. By this way you can even reduce the size of your project.
The reason for slowing of MATLAB many times is not using as it asks for. I mean it gives optimal performance if we use vectorization i.e avoid use of for loops.
For performance improvement see utility of profiling tools (Profile)
Ex
profile on
plot(magic(35)) % OR you can have your *.m file here
Matlab is really convenient for coding, but bad at running time. OpenCV, on the other hand, is fast in the term of running time, but will cost you some time to write the code. In general, you need to know how to balance these two. If you have a lot of images or videos to process, it is better spending some time on coding. But if you want to try something just for one image or small dataset, Matlab will save you a lot of time ion the coding part.
Actually, you can use Matlab to call OpenCV to have the benefits from both. And I guess these two also will become similar in the future.