As we all know, OpenCV 3.0 was officially released back in June of 2015. This new update incorporated a ton of new features and optimizations, including Python 3 bindings.
But the big question on everyone’s mind is: “Should I switch to OpenCV 3? If so, when should I switch?”
Deciding when or even if you should switch to OpenCV 3 isn’t necessarily the easiest decision, especially (1) if you are deploying OpenCV to a production environment or (2) you’re doing research in the computer vision space.
In order to help answer whether or not you should switch to OpenCV 3 (along with “when” you should make the transition), I emailed a portion of PyImageSearch readers and asked them to take a quick four question survey on their OpenCV usage.
The results are quite insightful — but I’ll leave you to draw your own conclusions from the results before I share my key takeaways.
OpenCV 3 adoption rate
A few months ago I emailed subset of the most active PyImageSearch readers and asked them to answer a short, 4 question survey about their OpenCV usage. I received 431 responses which I have gathered here today. For most questions, readers were allowed to select multiple responses for each answer that was applicable to them.
Question #1: Which version of OpenCV are you currently using?
- OpenCV 2.4.X
- OpenCV 3.0 (includes beta, RC, and official release)
- Other
The purpose of this question was simply to establish a baseline on which version of OpenCV most people were using. As expected, OpenCV 2.4.X dominates OpenCV 3.0:
Not surprisingly, most people are still using OpenCV 2.4.X. However, 29% of developers, researchers, and programmers have already started using OpenCV 3.0 in some capacity. For a brand new major release of a library to achieve 29% usage in only a few short months is quite remarkable.
Will this adoption trend continue?
Yes, I believe it will. However, I think it will take another year for us to see OpenCV 3.0 hit 50% adoption rate, putting it equal with OpenCV 2.4.X.
The primary reason for this is because OpenCV 2.4 is still the de facto standard for computer vision development. OpenCV 2.4 has been around longer. It’s more stable. It’s had more bug patches applied. And it’s currently deployed to production environments and research labs around the world where the cost of switching is non-trivial and potentially quite expensive.
For example, with the release of OpenCV 3, common functions such as cv2.findContours
have different return signatures than OpenCV 2.4. The cv2.normalize
function signature has also changed. SIFT and SURF are no longer included in OpenCV 3 by default, requiring us to install the opencv_contrib
package.
Are these changes “deal-breakers”?
Absolutely not. But for large codebases, the cost of switching is non-trivial, especially since this is just the v3.0 release of OpenCV and more changes are likely to come as the version matures.
Question #2: Which version of Python are you currently using?
- Python 2.7+
- Python 3+
- Other
The results follow:
The fact that Python 2.7 is being used over 2.6x than Python 3 shouldn’t come as a surprise. First, the Python scientific community is reluctant to switch to Python 3 — although that is now quickly changing given NumPy, SciPy, scikit-learn, and the awesome 2to3 tool paving the way for Python 3 adoption.
Secondly, OpenCV 2.4.X was only compatible with Python 2.7. It wasn’t until the OpenCV 3.0 release that we received Python 3 support.
Simply put: if you were doing any development with OpenCV prior to June of 2015, you were most certainly using Python 2.7.
In fact, it’s quite a surprise to see that OpenCV users have reached 31% Python 3 usage! I would have guessed a far lower percentage of computer vision developers would be using Python 3. But then again, you could quite possibly be working on other projects unrelated to computer vision where the libraries are Python 3 compatible.
All that said, given the OpenCV 3 and Python 3+ integration, I fully expect this number to rise over the next year.
Question #3: What type of “setting” do you use OpenCV in?
- Home/hobby
- Academic
- Scientific
- Production
- Other
Again, users were allowed to select all answers that applied. Below you can see the results:
It’s important to note that these answers are not mutually exclusive. Just because you may be doing academic or scientific research, does not mean that you cannot come home at the end of the day and work on your hobby computer vision project (in fact, I’m willing to be that’s what a lot of us do).
Similarly, “academic” and “scientific” do have a significant amount of overlap. If you’re writing and publishing papers at your university, then you’re most certainly using OpenCV in an academic setting. But you’re also conducting scientific research.
However, if you’re building a state-of-the-art computer vision product, then you’re performing scientific research in a production setting, but this research isn’t necessarily academic.
Personally, I don’t see OpenCV 3 affecting these numbers much.
Home and hobby users will be more likely to play with OpenCV and take it for a spin, especially when they go to the OpenCV.org website and see that OpenCV 3.0 is the latest, stable version.
But in a production, scientific, or academic setting, the cost of switching from OpenCV 2.4 to OpenCV 3 is much higher given legacy code and other dependencies. Furthermore, if you’re doing scientific/academic research, you may be reliant on OpenCV 2.4 to run legacy code associated with various experiments.
Question #4: Do you plan on upgrading to OpenCV 3.0?
- I am in no rush — I will take my time and upgrade when the v3 release is more mature.
- Yes, I am upgrading right now/have already upgraded.
- I have no plans to upgrade to OpenCV 3.0 right now.
Readers were only allowed to select one answer for this question.
Personally, I’m not too surprised by the response to this question. OpenCV is a big, established library with lots of history. It takes awhile to push out new releases, especially major ones. In fact, it’s been approximately 6 years since the v2.0 release. And 3 years in between v2.3 and v2.4 — talk about a long time in between releases!
Given that it takes awhile for new versions of the library to be released, it makes sense that the adoption rate is a bit slow as well. We’re all curious about the new version, but we may not fully adopt the latest version until we (1) have the time/resources to update our old code base or (2) we start a new project can start from scratch without worrying about dependencies.
My takeaways
If I were to sum up my opinion in only a single sentence it would be:
Don’t stress yourself out about switching to OpenCV 3.0.
If you’re starting from scratch:
If you’re starting a brand new project where you don’t have to worry about dependencies and legacy code, there is no harm in switching to OpenCV 3.0. In fact, in this particular case, I would encourage you to use OpenCV 3 since you will increase adoption rates and push the library forward. Just keep in mind that the library will evolve and that if you want to use OpenCV 3.0 now, you might have to update your code later when OpenCV 3.1 is released.
If you have an existing OpenCV project:
Unless there is a new feature inside OpenCV 3 that is not available in 2.4.X or you absolutely must have Python 3 support, it may be too early to migrate your entire codebase. In my opinion, OpenCV 3.0 is still very much in its infancy: there are still problems that need to be addressed and there are still bugs to be fixed. I would consider waiting until the v3.1 or even v3.2 release before you seriously consider making the big switch.
If you’re in an academic, scientific, or production setting:
I would advise against making the switch at this moment, provided that you have an existing codebase of experiments. As I mentioned before, OpenCV 2.4.X is still the de facto standard for computer vision development. The 2.4 flavors are much more mature and stable. And by sticking with the 2.4 version until v3 matures, you can save yourself a lot of headaches.
What is Adrian doing?
Personally, I have both OpenCV 2.4 and OpenCV 3 installed on my laptops. I use both of them daily, mainly so I can adjust to the OpenCV 3 environment (not to mention, work with Python 3) and help field any questions related to differences in the versions. But I am still using OpenCV 2.4 in all of my production environments. Eventually I will fully make the switch to OpenCV 3 — but I don’t see that realistically happening to the v3.1 or v3.2 release.
What's next? We recommend PyImageSearch University.
86 total classes • 115+ hours of on-demand code walkthrough videos • Last updated: October 2024
★★★★★ 4.84 (128 Ratings) • 16,000+ Students Enrolled
I strongly believe that if you had the right teacher you could master computer vision and deep learning.
Do you think learning computer vision and deep learning has to be time-consuming, overwhelming, and complicated? Or has to involve complex mathematics and equations? Or requires a degree in computer science?
That’s not the case.
All you need to master computer vision and deep learning is for someone to explain things to you in simple, intuitive terms. And that’s exactly what I do. My mission is to change education and how complex Artificial Intelligence topics are taught.
If you're serious about learning computer vision, your next stop should be PyImageSearch University, the most comprehensive computer vision, deep learning, and OpenCV course online today. Here you’ll learn how to successfully and confidently apply computer vision to your work, research, and projects. Join me in computer vision mastery.
Inside PyImageSearch University you'll find:
- ✓ 86 courses on essential computer vision, deep learning, and OpenCV topics
- ✓ 86 Certificates of Completion
- ✓ 115+ hours of on-demand video
- ✓ Brand new courses released regularly, ensuring you can keep up with state-of-the-art techniques
- ✓ Pre-configured Jupyter Notebooks in Google Colab
- ✓ Run all code examples in your web browser — works on Windows, macOS, and Linux (no dev environment configuration required!)
- ✓ Access to centralized code repos for all 540+ tutorials on PyImageSearch
- ✓ Easy one-click downloads for code, datasets, pre-trained models, etc.
- ✓ Access on mobile, laptop, desktop, etc.
Summary
Recently, I sent out a survey to the most active PyImageSearch readers and asked whether or not they were planning on switching to OpenCV 3. I received 431 responses to this survey and have presented the results in this blog post.
Overall, most readers are in no hurry to switch to OpenCV 3.
Although I can reciprocate this feeling, I use both OpenCV 2.4 and 3.0 daily. If you’re using OpenCV in a home/hobby environment, by all means, upgrade to OpenCV 3 and play with it. But if you’re in a production, academic, or scientific setting, I would consider waiting until the v3 release matures a bit. The primary exception to this being if you are starting a brand new project where you don’t any dependencies or legacy code — in that case, I would encourage you to use OpenCV 3.
Join the PyImageSearch Newsletter and Grab My FREE 17-page Resource Guide PDF
Enter your email address below to join the PyImageSearch Newsletter and download my FREE 17-page Resource Guide PDF on Computer Vision, OpenCV, and Deep Learning.
Bruce Lunde
I think that your takeaways make sense. I am new to the community, but I am using the 2.4 to get started with Python 2.7 due to the amount of information available, plus the fact that your bundle included a VM that was built to those versions. I would like to also learn to install the environment (I don’t really like VM’s) , and will look for a tutorial that will help me install this native to my PC, and will probably accomplish that with the 3.0 python and opencv 3
Adrian Rosebrock
You make an excellent point — there are a ton of tutorials available for OpenCV 2.4. Now that OpenCV 3 is released we’ll start to see more OpenCV 3 tutorials, but like with anything, it will take a bit of time. If you decide to setup an OpenCV 3 and Python 3 development environment, be sure to consult this page for detailed instructions for your operating system.
Janderson
Hi, Adrian.
I had lots of questions in my mind if I’ll use OpenCV 2.4.X ou 3.0 versions. But this post was really great for me. As a while, I’m gonna use 2.4.X. Thanks a lot!
Adrian Rosebrock
I’m glad the post helped Janderson! 🙂
Gary Lee
Adrian:
Great post as usual. Have you (or others here) experienced any performance issues with 3.0 versus 2.4?
I converted a fairly stable Python app still in development (going into alpha) to 3.0 over the weekend. The conversion from 2.4.1 to 3.0 was pretty easy with the only changes being changing CV_AA to LINE_AA in a few draw text functions, and then dealing with how cv2.findContours now returns three values. What is surprising, however, is that I am experiencing some delays in performance.
I appear to be getting the same fps throughput, but the delay on screen as I am processing (and showing) frames from the video is noticeably slower. I am even experiencing a few instances where I appear to “drop” frames as it appears someone will freeze in place, and then appear a long way again when the video catches up.
I also converted to Jessie on this same test (because what could be more fun than troubleshooting two major upgrades over a holiday weekend! (grin)). To try and troubleshoot what I am seeing, I tested 2.4.1 on Jessie as well and I am not seeing the performance degradation.
So are there known degredations in 3.0? Anyone seeing things to watch out for, or things to program around?
I’ll test a little more, but my initial impression is that I’ll revert back to Jessie and 2.4.1 for our development environment. There are not any critical features needed in 3.0 (yet), and it’s interesting to see a performance hit — and I am not sure what’s causing it.
If anyone has similar experiences or ideas, please comment here.
Thanks
Adrian Rosebrock
Hey Gary, thanks for the comment. As I mentioned in the post, I am still using OpenCV 2.4 in all of my production environments so I don’t have any good benchmarks to compare the two (yet). I personally can’t justify this, so take it with a grain of salt, but I’ve seen a few tweets and LinkedIn posts that also speculate that OpenCV 3 is a tad bit slower than 2.4. Again, we’ll need some real benchmarks to prove anything.
Also, keep in mind that OpenCV has many dependencies related to video and image I/O. It could very well be that a different version of the image or video I/O packages could be causing the slow down you are seeing.
Diego Vargas
Has anyone managed to figure out this problem? I’m currently experiencing an incredibly slow cv2.Imshow in opencv 3 and python 2.7. It’s just cv2.imshow however, everything else is running at a reasonable pace, and Imshow works fine in opencv 2.4
Aldi
Hey Adrian just want to ask you some question. Did the practical opencv is written for opencv 3 or 2.X.X?
Adrian Rosebrock
It is written for both OpenCV 2.4 and OpenCV 3. Both versions are covered inside the book.
Gerardo
Hi Adrian,
I am experimenting with OpencCV 3.1.0 and cascade classifiers. I am also using EmguCV3.1.0 and EmguCV2.4.x’s on this project. From using EmguCV2.4.x I found out that HOG features could be used in cascade classifiers.
As I experimented with cascade training with OpenCV 3.1, I found out that the HOG features are no longer supported by the cascade classifiers. So now I want to also install Open CV 2.4, as I think HOG may be a better result for the type of objects I am detecting (vehicles).
So my question is about your development environment. Have you installed both versions of OpenCV under the same machine? If so, how did you achieve this?
After looking at your (excellent) installation guide for OpenCV 3.1, I thought a possible way would be to use python environments for this objective. Hence have an environment name cv24 and another called cv31 respectively.
I would appreciate your advise, if this approach (or any other) is possible.
Thanks,
Gerardo
Adrian Rosebrock
Basically, the trick is to create a virtual environment for each of your OpenCV installs. You then download the OpenCV source code and create two builds — one for OpenCV 3.1 and one for OpenCV 2.4; however, you don’t run
make install
. You instead keep everything in yourbuild/lib
directory and delete the rest. You can then sym-link in thecv2.so
bindings into your respective virtual environments.