How to contribute
Version 15 (Daniil Osokin, 2014-07-14 06:01 pm)
1 | 13 | Daniil Osokin | {{>toc}} |
---|---|---|---|
2 | 13 | Daniil Osokin | |
3 | 1 | h1. How to contribute |
|
4 | 1 | ||
5 | 13 | Daniil Osokin | We suppose that you've seen the http://opencv.org/contribute.html page, and now, as an enthusiastic coder, want to contribute some code. For that purpose OpenCV project now has a mirror on the GitHub, to simplify everybody's life! And if you're familiar with the GitHub way of working, you can contribute in a friendly and familiar way. So, the preferred way to submit your code is to create a pull request on the GitHub (you can even do not create tickets here). This way it will be automatically tested and reviewed: http://pullrequest.opencv.org. |
6 | 1 | ||
7 | 14 | Daniil Osokin | Ready to start? Here is the repository to fork: https://github.com/Itseez/opencv. |
8 | 13 | Daniil Osokin | |
9 | 1 | h2. Overall process |
|
10 | 1 | ||
11 | 13 | Daniil Osokin | Here are some important details regarding the contribution to the OpenCV project. |
12 | 13 | Daniil Osokin | |
13 | 13 | Daniil Osokin | h3. "Fork & Pull model" for code contribution |
14 | 13 | Daniil Osokin | |
15 | 1 | # Create your fork of OpenCV repository: https://github.com/Itseez/opencv (see https://help.github.com/articles/fork-a-repo for details). |
|
16 | 13 | Daniil Osokin | # Choose the right "base branch" onto which pull request will be applied. As of today (Feb 2013), OpenCV has two main branches for development: |
17 | 13 | Daniil Osokin | ## "2.4" - used for the next minor releases of OpenCV (e.g. 2.4.3, 2.4.4, etc). This branch is good for contributing performance optimizations and bugfixes. New functionality usually goes to the "master" branch. Please note, "2.4" can contain only "binary compatible code":http://upstream-tracker.org/versions/opencv.html relative to the current major version (2.4). |
18 | 13 | Daniil Osokin | ## "master" - used for the future major releases of OpenCV (2.5). It can contain binary incompatible with current major version changes. By default all the new code goes here. |
19 | 13 | Daniil Osokin | # Write code, according to all prerequisites from below. |
20 | 13 | Daniil Osokin | # When you are done, create a pull request with your commits (see https://help.github.com/articles/using-pull-requests for details). |
21 | 12 | Daniil Osokin | |
22 | 13 | Daniil Osokin | h3. Testing and merging of pull requests |
23 | 11 | Daniil Osokin | |
24 | 13 | Daniil Osokin | # Your pull request will be automatically tested by OpenCV's buildbot (testing status can be checked here: http://pullrequest.opencv.org). If any builders are failed, you should fix the issue. |
25 | 11 | Daniil Osokin | # When all builders are green, one of OpenCV developers will review your code. Reviewer could ask you to modify your pull request. Please provide timely response for reviewers, otherwise you submission could be postponed or even rejected. |
26 | 11 | Daniil Osokin | |
27 | 13 | Daniil Osokin | h3. Pull request lifecycle |
28 | 13 | Daniil Osokin | |
29 | 11 | Daniil Osokin | !https://docs.google.com/drawings/pub?id=1_m7oVQ4CvoMxZn63N1_TyhhazmLLWY5uLEGUyPCERLo&w=960&h=720! |
30 | 11 | Daniil Osokin | |
31 | 11 | Daniil Osokin | h2. Prerequisites |
32 | 1 | ||
33 | 4 | Daniil Osokin | Below are some recommendations for contributors. They are raw, but can be used as a starting point for anybody who wants to see his code added to the library. |
34 | 4 | Daniil Osokin | |
35 | 4 | Daniil Osokin | > We would gladly accept such a contribution, but because of little resources available on our side, I would ask you to do all the preparations. Here is the checklist, including both generic items and the specific things related to your code that I found after brief inspection: |
36 | 4 | Daniil Osokin | |
37 | 4 | Daniil Osokin | # A prerequisite: is the algorithm patented? If yes, then we may not be that interested in putting it in. |
38 | 4 | Daniil Osokin | # License - the current license is fine, it's compatible with OpenCV. |
39 | 4 | Daniil Osokin | # Interface. Here some work is needed to make this code a seamless part of OpenCV. |
40 | 4 | Daniil Osokin | ** @M_PI -> CV_PI@ |
41 | 4 | Daniil Osokin | ** You should remove all the static constants from the header. it's not portable and generally a bad practice. Use defines and enumerations. |
42 | 4 | Daniil Osokin | ** cv:: and std:: should not be used in the header, since all the stuff is already inside cv namespace and we already have "using std::vector", "using std::string" directives. |
43 | 4 | Daniil Osokin | ** "m_" in member names should be dropped, we do not this convention in OpenCV. |
44 | 4 | Daniil Osokin | # Implementation. |
45 | 4 | Daniil Osokin | ** The code should be portable, it should compile fine on ARM too, for example. Therefore, you should not use SSE2 intrinsics outside of conditional compilation. Instead of "#ifdef USE_SSE" you should use "#if CV_SSE2". |
46 | 4 | Daniil Osokin | ** Avoiding duplication of existing OpenCV functionality. |
47 | 4 | Daniil Osokin | ** Writing to cerr should be replaced with CV_Error() calls. |
48 | 4 | Daniil Osokin | # Documentation. |
49 | 4 | Daniil Osokin | ** Documentation in RST format should be provided for the functionality. Check http://docs.opencv.org/modules/features2d/doc/feature_detection_and_description.html#orb as example. |
50 | 4 | Daniil Osokin | # You should provide sample code. |
51 | 9 | Daniil Osokin | ** help() function should be added, check opencv/samples/cpp. |
52 | 9 | Daniil Osokin | # Regression tests - the code should include some regression tests. |
53 | 4 | Daniil Osokin | ** Please, take a look at opencv/modules/features2d/test/test_features2d.cpp. You will need to add a similar test for your code. |
54 | 4 | Daniil Osokin | # Integration |
55 | 9 | Daniil Osokin | ** Take the latest version of our repository or fork from our github mirror at https://github.com/Itseez/opencv/ |
56 | 1 | ** Add your code |
|
57 | 1 | ** Insert documentation and add the test to the corresponding module |
|
58 | 1 | ** Build OpenCV, run tests. If you have access to both Linux and Windows - great! Sometimes GCC-approved code does not built with MSVC and vice versa. |
|
59 | 15 | Daniil Osokin | ** Create pull request on http://github.com or create patch file or and submit it as patch at http://code.opencv.org/projects/opencv/issues/new. |