recipe: opencv-contrib-python 5.0.0.93#110
Merged
Merged
Conversation
The contrib twin of opencv-python 5.0.0.93 — same importable cv2, with the opencv_contrib modules folded in (aruco, face, tracking, ximgproc, wechat_qrcode, img_hash, xfeatures2d [non-free off], dnn_superres, ...). The contrib sdist ships the identical opencv/ source tree (it only ADDS opencv_contrib/ and points the extra-modules path at it), so the recipe is a byte-for-byte twin: meta.yaml and mobile.patch mirror opencv-python's, and the 14-file patch real-applies clean to the contrib sdist. gen2.py's generated- binding fix covers the contrib modules generically. One contrib-only iOS wrinkle: rgbd's hand-written pyopencv_linemod.hpp uses bare std::vector<Ptr<...>>, which hits the Apple <MacTypes.h> Ptr clash. Gated with -DBUILD_opencv_rgbd=OFF on the iOS lane only (Android has no MacTypes.h and keeps rgbd); restoring rgbd on iOS is a 4-line cv::Ptr follow-up. Tests de-versioned per convention; test_contrib_module_works proves a contrib-only module (img_hash perceptual hash) actually loads and runs on device.
Cosmetic: '14 hunks' -> '14 files (38 hunks)'. Text-before-first-diff, no build impact — the running CI is unaffected.
…MAKE_ARGS scalar [skip ci] All 3 iOS legs failed with 'ValueError: No closing quotation' (android green). Cause: the explanatory '#' comment I added lived INSIDE the iOS 'CMAKE_ARGS: >-' folded scalar. YAML only treats '#' as a comment OUTSIDE scalar values, so the prose (with apostrophes/backticks: MacTypes.h's, `char* Ptr;`) folded into the CMAKE_ARGS string and forge's shlex.split choked on the unbalanced quotes. Android has a separate scalar with no comment, hence green. Moved the rationale to a real YAML comment above the scalar. Verified: the rendered CMAKE_ARGS now shlex-splits cleanly for all three SDKs, no '#' in the value, rgbd gate present on iOS only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
opencv-contrib-python— OpenCV plus theopencv_contribextra modules — for iOS and Android, as a twin of the already-landedopencv-python5.0.0.93.Requested by flet-dev/flet#4712
What it adds over
opencv-pythonThe
opencv_contribmodules: aruco (AR markers), face, tracking, ximgproc (edge-aware filters, superpixels), wechat_qrcode, img_hash, xfeatures2d (non-free off), dnn_superres, and more — the same importablecv2, just with these extra namespaces available.Shape
The contrib sdist ships the identical
opencv/source tree (it only ADDSopencv_contrib/and points the extra-modules path at it), so the recipe is a byte-for-byte twin ofopencv-python:meta.yamlandmobile.patchmirror it, and the v5 patch (14 files) applies unchanged — verified by real-applying to theopencv-contrib-python-5.0.0.93sdist. Same Flet 0.86 cv2 loader fix (find_spec('cv2.cv2')→ExtensionFileLoader('cv2', origin)+extract_packages: [cv2]), same iOS MLAS gate.One contrib-only iOS detail: the
rgbdmodule's hand-writtenpyopencv_linemod.hppuses a barePtr<>that clashes with Apple's<MacTypes.h>underusing namespace cv, so the iOS lane sets-DBUILD_opencv_rgbd=OFF. Android has noMacTypes.hand keepsrgbd. Restoring it on iOS is a 4-linecv::Ptrfollow-up.Consumer notes (usage & recommendations)
opencv-contrib-pythonis OpenCV with theopencv_contribextra modules folded into the sameimport cv2— aruco, face, tracking, ximgproc, wechat_qrcode, img_hash and more, on top of everything the base OpenCV gives you.Install
numpycomes in automatically as an OpenCV dependency:Minimal app
Run a real cv2 pipeline and show the result. There's no GUI on a phone, so display images through Flet controls rather than
cv2.imshow:For live/streaming frames (video, real-time filters, per-frame detection),
ft.RawImageis a better fit thanft.Image— it takes a NumPy array directly (no per-frame PNG encode) and streams frames over a data channel at interactive rates. One caveat: OpenCV is BGR, RawImage expects RGB, so convert first:Recommendations
opencv-python/opencv-contrib-python(or their headless variants) — all provide thecv2module and will collide. Pick one; use contrib only if you actually need the extra modules.cv2.rgbd/cv2.linemodare Android-only in this build (the iOS gate above). Everything else — aruco, face, ximgproc, wechat_qrcode, img_hash, dnn_superres, … — is on both platforms.cv2.imshow/waitKeydon't apply; render viaft.Image(src=<png bytes>)orft.RawImageas shown.page.run_thread(...).