Skip to content

Contribution Rules

  1. Fork the repository — Go to github.com/opencv/opencv, click Fork, and create a personal fork under your GitHub account. If contributing to extra modules, fork github.com/opencv/opencv_contrib as well.

  2. Enable the pre-commit hook — After cloning your fork, rename the pre-commit sample hook to activate it:

    Terminal window
    mv .git/hooks/pre-commit.sample .git/hooks/pre-commit
    chmod +x .git/hooks/pre-commit

    This hook automatically checks for whitespace errors before each commit.

  3. Choose the correct base branch — For OpenCV 4.x patches, target the 4.x branch. For OpenCV 5.x (current development), target 5.x. Consult the Branches wiki page at github.com/opencv/opencv/wiki/Branches when in doubt. Never target master for new contributions.

  4. Create a topic branch — Use a descriptive name for your branch:

    Terminal window
    git checkout -b fix-resize-interpolation # for a bugfix
    git checkout -b add-clahe-gpu-support # for a new feature
  5. Write your code — Follow the Coding Style Guide. All new C++ code must use C++11 standard (C++17 is allowed for 5.x). New algorithms belong in opencv_contrib first, not the main repository.

  6. Add tests — Accuracy tests go in modules/<module>/test/, performance tests in modules/<module>/perf/. New functionality requires at least one accuracy test.

  7. Run the test suite locally — See the Local Testing page. All tests must pass before submitting.

  8. Push and open a PR — Push your topic branch to your fork, then open a pull request against the correct upstream branch. The PR title should be concise and descriptive.

  9. Respond to review feedback — Reviewers are core developers. Respond within weeks, not months. Address all comments. When approved, a reviewer will post a 👍 or :shipit: emoji which signals the PR is ready to merge.

OpenCV uses a PR template (.github/PULL_REQUEST_TEMPLATE.md) with a required “Readiness Checklist”. Every pull request must confirm all of the following:

  • I agree to contribute to the project under Apache 2 License
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test, and test data in opencv_extra
  • The PR description clearly explains the changes and their motivation
  • All related documentation has been updated
  • The sample code (if any) can be built and run with CMake

Bug reports require a system info block including:

  • OpenCV version
  • OS and platform
  • Compiler name and version
  • Detailed description of the problem
  • Steps to reproduce

The issue template checklist also requires confirming that you have checked the documentation, FAQ, open issues, the forum at forum.opencv.org, and Stack Overflow, and that you have tried upgrading to the latest OpenCV release.

Significant API additions or changes use the Evolution Proposals process at github.com/opencv/opencv/wiki/Evolution-Proposals. Smaller features can use standard issues with the evolution label.

Pull requests go through a two-gate review:

  1. Automated CI — GitHub Actions and the OpenCV buildbot at pullrequest.opencv.org run first. All builders must be green before human review begins.
  2. Human review — Core developers review for: CI status, coding style, API design (correct use of InputArray/OutputArray, CV_EXPORTS_W), ABI compatibility, test coverage, patent/license cleanliness, and documentation updates.

Final approval is a 👍 or :shipit: comment from a reviewer, which signals the PR is merge-ready to the maintainers.

LabelMeaning
bugConfirmed defect
featureNew capability request
good first issueSuitable for newcomers
category: dnnDeep neural networks module
category: imgprocImage processing module
category: build/installBuild system issue
platform: win32Windows-specific
platform: ios/osxApple platform
needs investigationRequires more info
evolutionProposed API change
backport is neededMust be ported to older branch