OpenCV + Contrib · prebuilt

L'AAR officiel manque la moitié de la librairie. On livre le reste.

OpenCV on Maven Central doesn't include contrib modules. No face recognition, no advanced tracking, no ML classique. To get them, you'd have to rebuild the entire SDK from source. Or you add our Pro AAR — one Gradle line, every module, no NDK.

// OpenCV 5.0 + contrib · arm64-v8a + x86_64 · API 24+ · 16 KB aligned

app/build.gradle.kts
// official — core modules only
implementation("org.opencv:opencv:5.0.0.1")
import org.opencv.face.FaceRecognizerSF NOT FOUND
import org.opencv.tracking.TrackerCSRT NOT FOUND
import org.opencv.ml.SVM NOT FOUND

// Pro — core + ALL contrib modules
implementation("dev.ffmpegkit-maintained:opencv-contrib:5.0.0")
import org.opencv.face.FaceRecognizerSF RESOLVED
import org.opencv.tracking.TrackerCSRT RESOLVED
import org.opencv.ml.SVM RESOLVED
Ce qui manque

L'AAR officiel contient le core seulement. Voici ce qui manque.

These modules require opencv_contrib, which means rebuilding the entire SDK from source — or adding our Pro AAR.

MODULE WHAT IT DOES OFFICIAL PRO
faceFace recognition (LBPH, FaceRecognizerSF)
trackingAdvanced trackers (CSRT, KCF, MOSSE)
textScene text detection (EAST, DB, CRNN)
xfeatures2dSURF, DAISY, StarDetector
mlClassic ML (SVM, KNN, DTrees) ← moved from core in 5.0
xobjdetectHaar cascades, HOG detectors ← moved from core in 5.0
gapiGraph API ← moved from core in 5.0
Migration OpenCV 5.0 · ML, Haar & HOG moved to contrib Your code didn't change — the modules moved Rebuild from source? 30-60 min + NDK + CMake Or: one Gradle line → Pro AAR
Officiel + Pro

Commencez gratuitement avec l'officiel. Passez au Pro quand vous avez besoin de contrib.

Official (free) Apache 2.0
$0 · Maven Central
  • Core modules: imgproc, video, dnn, features, objdetect
  • Maintained by the OpenCV team + ARM
  • One Gradle line: org.opencv:opencv:5.0.0.1
+ Contrib
Pro Apache 2.0
$34 · $89 team (5)
  • Everything in official + ALL contrib modules
  • Face recognition · tracking · text detection · ML
  • Haar cascades · HOG · G-API (back from 5.0 exile)
  • arm64-v8a + x86_64 (emulators, Chromebooks)
  • 16 KB page aligned · Android 15 ready
  • Single AAR — no NDK, no source rebuild
Mise à jour drop-in

Même API. Plus de modules. Une ligne à changer.

The Pro AAR is a superset of the official package. Your existing OpenCV code stays identical — you just gain access to the modules that were missing.

app/build.gradle.kts
// before — official, core only
implementation("org.opencv:opencv:5.0.0.1")
// after — core + ALL contrib modules
implementation("dev.ffmpegkit-maintained:opencv-contrib:5.0.0")
// same imports, now they resolve
import org.opencv.face.FaceRecognizerSF
import org.opencv.tracking.TrackerCSRT
import org.opencv.ml.SVM
Migration OpenCV 5.0

Vous passez de 4.x? Voici ce qui casse et comment le corriger.

OpenCV 5.0 moved several popular modules from core to contrib. Your code didn't change — the modules moved. If your app uses ML, Haar cascades, HOG detectors, or G-API, they're no longer in the official AAR.

What breaks in OpenCV 5.0
// These imports worked in 4.x — they fail in 5.0 official AAR
import org.opencv.ml.SVM // → moved to contrib
import org.opencv.objdetect.CascadeClassifier // Haar → contrib (xobjdetect)
import org.opencv.objdetect.HOGDescriptor // HOG → contrib (xobjdetect)
import org.opencv.gapi.GComputation // G-API → contrib
BUILD FAILED cannot find symbol
La solution

Deux options. Une est rapide.

Option A — rebuild from source (30-60 min + NDK + CMake)
// clone two repos
$ git clone https://github.com/opencv/opencv.git
$ git clone https://github.com/opencv/opencv_contrib.git
// configure NDK, CMake, Python, env vars...
$ python3 platforms/android/build_sdk.py \
  --ndk_path $ANDROID_NDK --sdk_path $ANDROID_SDK \
  --extra_modules_path opencv_contrib/modules ...
// wait 30-60 min... fix CMake errors... retry...
$ python3 build_java_shared_aar.py ...
// ☕ hope it works on the first try (it won't)
Option B — one Gradle line (10 seconds)
implementation("org.opencv:opencv:4.9.0")
implementation("dev.ffmpegkit-maintained:opencv-contrib:5.0.0")
// same imports — they resolve again
import org.opencv.ml.SVM RESOLVED
import org.opencv.objdetect.CascadeClassifier RESOLVED
import org.opencv.objdetect.HOGDescriptor RESOLVED
import org.opencv.gapi.GComputation RESOLVED
BUILD SUCCESSFUL SHIPPING
No code changes. No NDK. No CMake. Swap one Gradle line, and the modules that disappeared in 5.0 come back — same package, same class names, same API. Your existing OpenCV 4.x code compiles again, now on 5.0.