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

  • 1
    $\begingroup$ I have added a couple of lines on how to learn with book+software. I hope you finally found your way $\endgroup$ Commented May 16, 2020 at 14:06

5 Answers 5


[Comparison with cars at the end] For learning from scratch, I would not suggest a programming language alone, but instead the couple "teaching materials" (book, lecture notes) + "exercises with a specific programming language". So if you find a book that you like on "Python for computer vision with exercises" 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 (with cars):

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.

  • 1
    $\begingroup$ Laurent, you might be interested in this: nature.com/articles/d41586-019-02310-3 $\endgroup$
    – MBaz
    Commented Sep 23, 2019 at 0:01
  • $\begingroup$ 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 $\endgroup$ Commented Sep 23, 2019 at 13:47
  • 1
    $\begingroup$ Very well explained $\endgroup$
    – DSP_CS
    Commented May 17, 2020 at 18:56
  • 1
    $\begingroup$ If comfortable, will you please try to update your answer keeping in view latest and most updated trends. $\endgroup$
    – DSP_CS
    Commented Mar 2, 2023 at 14:20

I have spent the first 20 years of my career working extensively in MATLAB for signal processing applications. Six years ago I gravitated over to Python out of curiosity and it has since completely replaced Matlab as my tool of choice meeting all my needs for signal processing.

Matlab still rules in integrated hardware and co-simulation solutions, and I have access to both tools, yet I prefer using Python for general signal processing simulation and analysis.

I wanted to share here some main points that influenced me and why I am such a big fan of Python for this application space.

  • It's Free (although Octave served that purpose for me, but Octave is slower than Matlab)

  • It's comparable to Matlab in speed, both in writing an application and its execution.

  • It's user friendly, once you really understand its functionality and features. Jumping in without actually learning it can be very frustrating if coming from Matlab; but in particular once you learn how well and universally it handles iteration, it is quite beautiful!

  • It's supported by a MUCH LARGER user community.

The above main points are my perceptions based on my own experience which is always evolving and open to change, but let me also share some supporting evidence that have influenced my thinking to date (beyond my personal experience with both tools). I am not overly biased toward any of the tools other than these reasons; each on their own are fantastic accomplishments by the people involved in putting them together and I would be happy to be stuck on an island with any of these tools (between Matlab, Octave and Python) if it was an island where I still needed to solve challenging signal processing related problems. (The island of misfit transforms perhaps).

Benchmarks with Matlab

At this link Rob Hicks has benchmarked Matlab with Python/Numpy (last updated 2015) with this result:

Benchmark Matlab vs Python

For the plot above, "LA" denotes linear algebra test models where Matlab wins on speed while the other lines where Python wins are with statistical models. A later plot as you read down the post shows that under parallel operation distributed across multiple processor cores, Matlab still wins with the LA models but with marginal difference in that scenario.

Julia has been posting benchmarks comparing Octave, Matlab and Python that captured my interest. This chart was made by the Julia folks (surprise, they are at the top of the run-time speed scale), but of interest to me was something I personally wanted to see-- how does Python compare to Matlab, and Matlab to Octave. So I was pleased to see that in considering switching from Matlab to Python that the speeds are comparable. Matlab is faster in some categories and slower than others, but overall the processing speed is similar in contrast to Matlab vs Octave. Not that Python is a choice when speed is the ultimate concern but I did want to know if there would be a significant penalty. I see that over time the reported results from Julia are changing (here is an earlier one from 2017) and not sure if that has to do with different versions of the tools or changes in the testing approach.

Recent benchmark from Julia captured 4/30/2022

I am motivated to do my own benchmarking specific to common applications in signal processing since I have access to all three tools, perhaps as a Github repository as Chris Luengo has suggested in the comments. I like that idea, and will post a link here if progress is made on that front, or if I find other existing benchmarks more specific to signal processing tools.

Much Larger User Community

Python is supported by a very large community in many areas beyond where Matlab participates (web design for example). The reason that it is a general purpose software development tool and not reserved just for mathematical algorithm development is specifically an advantage to building a larger community, given that with the right libraries (numpy and scipy in particular) it still provides all the powerful mathematical algorithm development with vector processing similar to Matlab. It is widely used in many fields and applications including specifically scientific computing and engineering, but has a broad user base of different disciplines. Given it is an open source user supported tool this is a huge strength in quickly finding the help you need to questions, or the tool you need for any given application (in most cases you can find it rather than build it, or build on it). This also contributes to writing applications faster. Below are some interesting datapoints suggesting a scale on the size of the relative communities:

The plot below was generated at the time of writing this at this link. These are the trending results for questions based on different languages posted to Stack Overflow. Based on the importance to me of a large user community (and the advantages I have experienced from that), I won't be jumping over to Julia anytime soon according to these same results, but could be a promising language to consider in the future:

Stack Overflow Trends

And similarly based on worldwide searches using Google Trends results in:

Google trends

And this Blog result from Codingdojo.com was also interesting, although it didn't include MATLAB:

Worldwide jobs

So the above points were "frosting on the cake" once I understood that I could easily create all the signal processing applications and analysis, with all the graphics and integrated development features I enjoyed with MATLAB, with a very intuitive easy to read and write language.

  • 4
    $\begingroup$ MATLAB is definitely much, much faster than Python. Code that loops over individual pixels is easily 100x as fast in MATLAB, which has a built-in JIT. In Python you’d need to use Numba for similar performance. The Julia benchmarks are very biased, the maintainers seem to have something against MATLAB. I tried to get them to fix MATLAB code in their benchmarks some years back, but they didn’t want to have it represented fairly, as it would remove most of Julia’s advantage (of course they didn’t acknowledge that, but it was clear to me). $\endgroup$ Commented Apr 30, 2022 at 15:39
  • 1
    $\begingroup$ @CrisLuengo not sure that's true, using Numpy for vector based processing rather than "Looping". However I am certainly open to having been mislead by the benchmark shown (although I already saw from our MBaz here that Julia is MUCH faster than python and Matlab from his own testing). But how about we come up with some of our own bench mark cases; I have access to both tools and we can get to the bottom of that ourselves. I'm not biased toward either tool beyond these perceived advantages I list. $\endgroup$ Commented Apr 30, 2022 at 15:45
  • 2
    $\begingroup$ Python isn't even close to MATLAB speed wise. For BLAS / LAPACK in case they both use MKL they are comparable. For functions written in auxiliary language they are the same. But for pure Python vs. MATLAB code, they are not even close since Python has, at the moment, not JIT. You may get that using Numba which is amazing in some cases, but pure Python vs. MATLAB isn't even close. $\endgroup$
    – Royi
    Commented Apr 30, 2022 at 18:26
  • 3
    $\begingroup$ One more thing, Neither Julia not Python has anything close to MATLAB's plotting library. Especially when trying to explore data and not only display a static graph. MATLAB's experience is smooth with great performance. I wish MatplotLib will have the figure() element that MATLAB has with all of its tools to explore the data. $\endgroup$
    – Royi
    Commented Apr 30, 2022 at 18:42
  • 2
    $\begingroup$ @DanBoschen, I have a lot of experience with Python and MATLAB. For non ML / DL task I'd chose MATLAB every day. The question is the context of Image Processing, not a genera purpose language. Regarding plotting, I know Bokeh, I know PlotLy Altair and MatPlotLib. I'm not aware of others which are engines (Not wrappers like SeaBorn). There might be more smaller ones based on WebGL. But from my experience none of them can have the smooth experience of MATLAB's figure. The data tips, Zooming, Panning, handling large data sets, hovering data, etc... $\endgroup$
    – Royi
    Commented Apr 30, 2022 at 19:06

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.

  • $\begingroup$ Sorry dear,i m not a native english. I couldn't understand your last linepart " i would factor opencv compatibly highly" $\endgroup$
    – DSP_CS
    Commented Sep 21, 2019 at 14:25
  • $\begingroup$ 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 $\endgroup$
    – user28715
    Commented Sep 21, 2019 at 15:15
  • 1
    $\begingroup$ @engr: "Dear" is for family members or your boyfriend or girlfriend. $\endgroup$
    – JRE
    Commented Sep 21, 2019 at 18:54
  • $\begingroup$ @JRE got it sir $\endgroup$
    – DSP_CS
    Commented Sep 21, 2019 at 18:55

MATLAB is one of the most useful & successful software tools developed for scientists and engineers. From a DSP point of view, its syntax is simply the best. And, image processing is one of its strongest parts in addition to Simulink. However, it has an academic inclination; thus it lacks sufficient support for integration with industry standard production platforms. So, if you look for such hardware, embedded, or software applications, you should consider using some other or additional tools.

LabView is one such example, and its native integration with NI produced DSP chips is probably its strongest part. Yet for core algorithm development, (where you need most flexibility), you would still require an assistance from MATLAB or its free limited-clone OCTAVE.

Python is a free, expanding, and versatile language. You can find applications from AI research down to some embedded projects, through its package-library support. I don't like its syntax which simply sucks. Neverthless it is free, growing, and academically accepted; and it comes with excellent Linux (vs poor Windows) support. Its packages, (such as machine learning and AI), are probably its strongest parts, and syntax is the weakest.

OpenCV is a specialised tool for unique task of image processing algorithm and program development for indutrial targets. 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 whole OpenCV as a package of Python in the future.

  • 5
    $\begingroup$ 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. $\endgroup$ Commented Sep 21, 2019 at 23:42
  • 4
    $\begingroup$ 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. $\endgroup$
    – Fat32
    Commented Sep 22, 2019 at 9:56
  • 5
    $\begingroup$ Would have Matlab chosen a $0$-based indexing, it would have been flawless :) $\endgroup$ Commented Sep 22, 2019 at 17:10
  • 3
    $\begingroup$ 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. $\endgroup$
    – MBaz
    Commented Sep 22, 2019 at 23:56
  • 3
    $\begingroup$ @Fat32 I know all of that; I've been using Matlab since 1997 and continue to use it today. What I think is a mistake is to ignore Matlab's warts, and to ignore better-designed, modern, often free alternatives. $\endgroup$
    – MBaz
    Commented Sep 23, 2019 at 14:42

MATLAB's Image Processing toolbox is much richer than what you'd find on Python except OpenCV. OpenCV on Python doesn't feel natural yet still give you access to basically the largest library of image processing related algorithms. Usually they are also implemented quite efficiently.

When comparing them I'd say MATLAB's advantages are:

  1. Great documentation.
  2. Coherent package.
  3. Good performance per function.
  4. Graphics library.

Python advantage:

  1. Access to Deep Learning based algorithms.
  2. Python supports pass by reference which means in a pipeline of functions it might be faster.
  3. Access to OpenCV which has a lot of state of the art algorithms.
  4. Support for GPU using CuPy or PyTorch.

If you start now, probably you should go with Python.
Pay attention that if you implement something in Python to take advantage of Numba or the GPU (See CuPy).

  • 1
    $\begingroup$ I'd add MATLAB's plotting library which is superior to Python's. $\endgroup$
    – Royi
    Commented Apr 30, 2022 at 18:43
  • $\begingroup$ “Python supports pass by reference” — MATLAB’s lazy copy means that any value passed to a function is not copied unless modified in the function (ie passed by reference). Furthermore, if written correctly, a function can modify its input data in place, with no copy made (ie same result as if passed by reference). $\endgroup$ Commented Apr 30, 2022 at 21:15
  • $\begingroup$ I am aware of those tricks. But the correct mental picture is that Python works by reference and MATLAB by copy. It means it is not trivial to do in place functions in MATLAB. $\endgroup$ Commented May 1, 2022 at 14:48
  • $\begingroup$ Matlab's documentation vary based which toolboxes you have. The core and older toolboxes (signal processing, image processing) are quite good and contained references to papers for the implementations. For newer toolboxs (STAP, Tracking) the documentation is complete garbage. You basically get a black box with no idea of what's going on inside - also there are no references. Another issue with Matlab is the granularity of the toolboxes. If I want one spline function I need the whole toolbox. $\endgroup$
    – David
    Commented May 2, 2022 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.