# Python vs Matlab? Which one better for image processing?

I want to learn practical image processing from scratch/basics in easy way. Which software will be helpful in this regard? Matlab or python?

• I have added a couple of lines on how to learn with book+software. I hope you finally found your way – Laurent Duval May 16 at 14:06

[EDIT-20200516: see at the bottom fro comparison with...cars] For learning from scratch, I would not suggest a programming language alone, but instead the couple "teaching materials" (book, lecture notes) + "exercices with a specific programming language". So if you find a book that you like on "Python for computer vision with exercices" or "Image processing theory and practice with Matlab, that could be interesting starting points. Also, your programming tastes and skills may evolve, and learning a first programming language helps you learning a second one in general. But laziness sometimes drives you to sticking to your first language, reusing old librairies. Last, the purpose is important. In my case, I mostly engineer algorithms as prototypes and proofs of concepts, that can stay as them, or are turned into "solid programs" by people that are better at, and like better, programming with the rules-of-art in lower levels languages, depending on the target.

To that respect, Matlab is great at designing and fine tuning algorithms, possesses a lot of documentation and help that you can follow step-by-step, and enjoys a long list of contributed toolboxes, esp. at MatlabCentral FileExchange. When the workflow is set, if you care of speed, efficiency, etc., it is time to pass the algorithmic prototyping over to real programmers (C++, or lower level, which I can't do).

Python now has a large community, and has developed toolsets like Scikit-Image, and there is a tutorial for instance at Scikit-image: image processing. It is also interfaced with OpenCV.

Globally, as long as you grow solid image processing skills, I would think what mostly differ between Matlab and Python are the cost and the trendiness. On my side, I would switch to Python for machine learning and data science, but I will stick to Matlab for most of my signal processing and image analysis works for a while.

You can also use (free) open source software, with contributed toolboxes and plugins, that often benefit from external publications. I would suggest:

For comparisons:

MATLAB [...] It’s probably still the easiest to learn for basic numerical tasks. Meticulous documentation and decades of contributed learning tools definitely matter.

MATLAB is the BMW sedan of the scientific computing world. It’s expensive [...] rock-solid [...] attracts a disproportionate amount of hate.

Python is a Ford pickup. It’s ubiquitous and beloved by many (in the USA). It can do everything you want, and it’s built to do some things that other vehicles can’t. Chances are you’re going to want to borrow one now and then. But it doesn’t offer a great pure driving experience.

Julia is a Tesla. It’s built with an audacious goal of changing the future, and it might. It may also become just a footnote. But in the meantime you’ll get where you are going in style, and with power to spare.

• Laurent, you might be interested in this: nature.com/articles/d41586-019-02310-3 – MBaz Sep 23 '19 at 0:01
• I was very exited with Julia at the beginning. However, it seems it takes time to have an field ecosystem around it. I admit I did not check whether there is a good image processing toolbox by now – Laurent Duval Sep 23 '19 at 13:47
• Very well explained – engr May 17 at 18:56

most of the people who answer questions here tend to use python or matlab.

you are more likely to get help here using those tools rather than labview.

in of itself, this doesn’t say matlab is “better”. it all depends on what is better for you.

in the distant past, matlab was restricted to double floats for all numerical representations. this made matlab a huge memory hog with images. this is no longer true.

a lot of questions posted here, concern opencv. if i were you, i would factor opencv compatibly highly.

• Sorry dear,i m not a native english. I couldn't understand your last linepart " i would factor opencv compatibly highly" – engr Sep 21 '19 at 14:25
• matlab historically has been slow in offering interfaces to tools outside of itself. calling R from matlab is difficult is an example. you probably will want to be able to call opencv easily from whatever tool you choose – user28715 Sep 21 '19 at 15:15
• @engr: "Dear" is for family members or your boyfriend or girlfriend. – JRE Sep 21 '19 at 18:54
• @JRE got it sir – engr Sep 21 '19 at 18:55

MATLAB is one of the most important software inventions of the twentieth century, from a DSP point of view its syntax is simply the best in the world. And image processing is one of its strongest parts. However it's mainly of academic focus and if you look for industrial output you should consider having a number of additional tools.

LabView is one such example and its natural integration with NI produced DSP chips and platforms is probably its strongest part. Yet for core algorithm development you would still benefit from a flexible tool such as MATLAB or its free semi-clone OCTAVE.

Python is a free, powerful and expanding language. Very versatil. I don't like its syntax which simply sucks. Neverthless it's free, growing and academically accepted with excellent Linux integration vs poor Windows support. Its packages are probably its strongest part and syntax is the weakest.

OpenCV is a specialised tool for unique task of image processing. It's quite popular in machine vision, or industrial automation world. I think however that, as Python packages are growing and improving day by day, they may eventually replace OpenCV as a package of Python in the future.

• This is a highly subjective answer. Granted, many people seem to like Matlab's syntax – fair enough, this is a matter of taste. But syntax is a pretty trivial part of languages' design space; far more important are semantics, in that regard NumPy is close to being a clone of Matlab but within a language that's much better for non-matrix stuff. Lauding Matlab as an “important software invention” because of its syntax is at any rate pretty ridiculous, it's a bit like lauding the DeLorean as one of the greatest cars of the 20th century because you like the look of its stainless steel body panels. – leftaroundabout Sep 21 '19 at 23:42
• Not so. MATLAB's natural syntax is so powerfully, uniquely and inherently linked with linear algebra and DSP notation that it certainly deserves an oscar (for those subjective lovers) if not a nobel (for those strictly objective lovers ;-) ). I hope you didn't try to compare Matlab Development Environment with languages like C / C++ / Java / Python etc. which I deduced from your semantics argumentation. Matlab is not a software development system, rather a mathematical algorithm development environment; the de-facto choice for most academics and especially (electrical) engineers. – Fat32 Sep 22 '19 at 9:56
• Would have Matlab chosen a $0$-based indexing, it would have been flawless :) – Laurent Duval Sep 22 '19 at 17:10
• I'll add my own opinion to this subjective discussion: Matlab is historically very important, and the language is a huge leap in productivity compared to C or Fortran. It also has a large number of flaws that hang around its neck like a ton of bricks. Newer languages have learned from those mistakes and are much, much better than Matlab. An example of a beautiful modern language is Julia. – MBaz Sep 22 '19 at 23:56
• @MBaz you are also making the same mistake. Matlab is not a general purpose programming language like C / C++ / Java / Python / Julia etc. Yes it has syntax and an interpreter engine but it's not a general purpose programming languge. It's intention is to provide a robust and flexible computational environment for algorithm development. This includes data input, imports, exports, plots, figures, visualisations and seamless data processing. Yet it has grown into something much more than that in time. So many toolboxes and blocksets and simulink, x-target, real-time etc.. – Fat32 Sep 23 '19 at 8:18