I want to learn practical image processing from scratch/basics in easy way. Which software will be helpful in this regard? Matlab or python?
[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).
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:
- ImageJ: Image Processing and Analysis in Java
- Icy: Open Source Image Processing Software
- OpenCV: Open Source Computer Vision Library
- SciLab: Image Processing & Computer Vision
- Julia: Image Processing
For comparisons (with cars):
- From MathWorks (biased): MATLAB vs. Python: Top Reasons to Choose MATLAB
- For RealPython (biased): MATLAB vs Python: Why and How to Make the Switch Toby Driscoll (more balanced): Matlab vs. Julia vs. Python (compared to BMW sedan, Ford pickup and Testa)
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.
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.
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 points. However, it has naturally an academic (learning & inventing, research & development) focus, and thus it avoids integration with industry standard platforms or applications. So, if you look for such ready to install hardware, embedded, or software applications, you should better consider some other or 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, (where you need a lot of flexibility), you would still benefit from MATLAB or its free 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, (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. 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.
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:
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.
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:
And similarly based on worldwide searches using Google Trends results in:
And this Blog result from Codingdojo.com was also interesting, although it didn't include MATLAB:
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.
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:
- Great documentation.
- Coherent package.
- Good performance per function.
- Graphics library.
- Access to Deep Learning based algorithms.
- Python supports pass by reference which means in a pipeline of functions it might be faster.
- Access to OpenCV which has a lot of state of the art algorithms.
- Support for GPU using
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