OE 32. Change OpenCV License to Apache 2 - alalek/opencv GitHub Wiki

Change OpenCV license from BSD to Apache 2

Introduction and Rationale

From very beginning, when OpenCV was released by Intel as open-source computer vision library in 2000, it has been distributed under BSD license (https://github.com/opencv/opencv/blob/4.0.0/LICENSE), which was one of the few available options.

GNU Public license (GPL), while being a great license for certain applications and components of open-source software, was not appropriate and still is not appropriate for OpenCV, because we wanted not only to boost research in computer vision, but also accelerate development of commercial applications, i.e. push the whole industry.

BSD worked well for us for many years, but since the year 2000 computer vision world has changed a lot:

  • The technology is different, it's less of hand-made algorithms and more of industrial approaches and engineering.
  • The market has grown significantly, with much more money and more players.
  • Correspondingly, there is much more intellectual property (IP) there. Many companies and organizations, big and small, work professionally in this area, create lots of new algorithms and patent many of them.
  • Software landscape has changed significantly. In 2000 OpenCV was one of very few computer vision libraries available. Now there are many solutions, especially in deep learning area, that are cross-platform, efficient, have rich functionality and strong communities behind them.
  • OpenCV itself has changed significantly. It used to be a small C library of classical computer vision algorithms, solely developed by one team in one company. Now it contains 1,000,000+ lines of code and 70+ modules, and about half of the code is contributed by the community. Each working day about 5 patches are integrated into the library.

So, everything in computer vision nowadays, including OpenCV, is growing and developing fast, which is great! On the other hand, such a rapid growth brings some potential and real issues. One issue is stability, which we mostly solved using our excellent and constantly improving Continuous Integration System and the large set of unit tests. Another issue is IP cleanness of the code. Which is as important as the reliability, especially for commercial products. That is, when people take OpenCV and use in their applications, they should have some confidence that OpenCV is robust and that it is clean. While OpenCV, just like almost any other software on the planet, cannot provide 100% guarantee of robustness and cleanness, we need to constantly work on it. As the queen in Alice in Wonderland said: "My dear, here we must run as fast as we can, just to stay in place".

There are 2 main cases when IP cleanness may be violated:

  • Source code under incompatible license (specifically, GPL or "non-commercial use only") is integrated into OpenCV.
  • Some patented algorithm is integrated into OpenCV.

The first issue is easier to catch and is usually easier to solve. There are some tools that we regularly run over the code base to check if we/our contributors put (my mistake) some code, distributed under incompatible with OpenCV license, to OpenCV. The databases that we use are constantly updated, and as soon as the tools detect some "matches", we start working to replace the problematic pieces of OpenCV with alternative implementations.

The second issue is more difficult to catch (because of well-known "patent contamination" problem) and is often impossible to fix because of the same problem (other than just exclude the patented algorithm).

One may ask, why is this a problem, given that OpenCV is "free" library, i.e. it can be used with zero cost in any research project or product? It's the problem because OpenCV BSD license says nothing about the patents. That is, you can use OpenCV as you want, but potentially authors of the patented algorithms from OpenCV, which you use, may come to you and ask for compensation.

Proposed solution

As mentioned above, it's impossible to completely solve the problem of IP cleanness of the code. But we use a combination of several approaches to minimize it.

First of all, OpenCV contributors should have noticed that now each OpenCV pull request includes some checkboxes related to the possible code license violations. That is, we ask contributors to be more responsible for the code that they put into OpenCV.

Secondly, and this is the essence of this Evolution Proposal, we are going to change the license to Apache 2. Comparing to BSD, Apache 2 is more modern license, appeared in the era of software patents, so it's been designed to have some protection from possible legal claims.

Here is some explanation of the patent-related parts of Apache 2 license:

In brief (this is informal interpretation of the patent clauses):

  1. When some organization or individual contributes a code under Apache 2 license, they grant users of the code a non-exclusive license to use contributor's patents in this code.
  2. When some organization or individual raise legal claims about their patent violation in Apache 2 software, they loose the license to use all other patents in this software.

Of course, such a license does not protect against organizations who do not use this software, but just possess some patents and want to benefit from it (e.g. patent trolls), but at least it helps real users to live in peace and share their technology without fear of getting a "trojan horse".

Impact on existing code, compatibility

The benefits of OpenCV migration to Apache 2 are clear and, so far, there are no visible drawbacks. Apache 2 is now used by many projects, including Google's Android, clang, Intel's OpenVINO etc. Just like BSD, and unlike GPL, Apache 2 does not put any restrictions on the license or openness of derived/dependent software products.

The transition of OpenCV to Apache 2 license should happen somewhere during 2020 summertime. opencv/LICENSE will change the text from BSD to Apache 2. There will be a separate opencv/COPYRIGHT where all the copyrights from major sponsors/contributors will be collected.

Important: There will be a notice somewhere (e.g. opencv/docs/LICENSE_CHANGE_NOTICE.txt) that since the certain moment OpenCV has changed the license, and the text of the original license will be put below. This way we formally comply with BSD license of all the past contributions and our own old patches. This should make the license change procedure legally justified.

OpenCV 5.0 and later versions will be released under Apache 2. Newer versions of OpenCV 4.x, possibly starting with OpenCV 4.5, will also be released under Apache 2 license. It's still under question whether newer versions of OpenCV 3.x will migrate to Apache 2 (maybe OpenCV 3.5?). There is some logistic problem to maintain different versions of the library under different licenses.

For applications that use some previous releases of OpenCV no changes will be needed, of course. Applications that stated that they use OpenCV the text should probably be changed to affect the OpenCV license change.

People/organizations those patented algorithms are contributed to OpenCV – if you have no objections about it, you are welcome to contact us at https://opencv.org. We will add your copyrights to the respective files, and so you will get credits and become official "contributor" to OpenCV.

Contributors of the new code will have to agree to contribute their code under Apache 2 license instead of BSD, which is also minor change.

Possible alternatives

The only possible alternative is to keep the license, but it's not about solving the problem but rather putting it off. Because of the increasing code base and increasing risk of legal issues, it's still preferable to do the migration as early as possible.

References

  1. Current license: https://github.com/opencv/opencv/blob/4.0.0/LICENSE
  2. Proposed license: https://www.apache.org/licenses/LICENSE-2.0
  3. Explanation of patent clauses in Apache 2 license:
  4. Example of pull request with the checkboxes about the code licenses: https://github.com/opencv/opencv/pull/17000