Conversation
OpenCV 5 removed the legacy C API (IplImage, cvarrToMat, CV_INTER_NN, cvFindContours, …). MSYS2 already falls back to opencv 5.x when the pinned 4.13 package is missing, which then fails to compile ofxOpenCv. Add a compatibility layer that: - keeps the OpenCV 4 path (imgproc_c.h + cv::cvarrToMat) - shims IplImage/CvMat and the cv* helpers ofxOpenCv actually calls on OpenCV 5, wrapping cv::Mat - uses cv::findContours for blob detection on OpenCV 5 - routes getCvMat / Haar / undistort through ofxCvToMat Install scripts now pick opencv5, opencv4, or opencv via pkg-config. MSYS2 still prefers the pinned 4.x package; the 5.x fallback should compile.
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.
What
ofxOpenCv still uses OpenCV's legacy C API (
IplImage,cvCopy,CV_INTER_NN,cv::cvarrToMat,cvFindContours, …). OpenCV 5 removed that API entirely, so a system OpenCV 5 install fails to compile the addon.This showed up on MSYS2 ucrt64 when the pinned OpenCV 4.13.0-7 package could not be fetched and pacman fell back to
mingw-w64-ucrt-x86_64-opencv5.0.0.install_dependencies.shalready rewrote pkg-config toopencv5, thenallAddonsExampledied on:IplImagewas not declaredCV_INTER_NNwas not declaredcv::cvarrToMatwas not declaredMSYS2 is still being compiled against OpenCV 4; this is the fallback path.
Approach
Keep the public ofxOpenCv API. Branch on
CV_MAJOR_VERSION:IplImage/CvMatviaimgproc_c.hcv::Matcv*helperscv::resize/cvtColor/ …getCvMat()/ Haar / undistortofxCvToMat→cv::cvarrToMatofxCvToMat→ ROI-awarecv::MatviewcvFindContours+CvSeqcv::findContoursHaar
CascadeClassifierlives in contribxobjdetecton OpenCV 5; the compat header includes it when present (MSYS2's opencv 5 package ships it).Also
addon_config.mkstill defaults toopencv4. Install scripts now selectopencv5/opencv4/opencvfrom pkg-config (MSYS2 + Linux distros).cv::cvarrToMatnow usegetCvMat().Test plan
pkg-config opencv5)libopencv-dev/ opencv4allAddonsExampleand opencv contour / Haar examples