-
Notifications
You must be signed in to change notification settings - Fork 12
Doesn't work with OpenCV 4 #39
Comments
There's /~https://github.com/matze/pkgconfig to help with finding the correct include dir, and opencv2/core/version.hpp defines |
Darn. cscore itself doesn't support OpenCV 4.
|
cscore in allwpilib supports now opencv4.
I build opencv and allwpilib from source.
and finally |
You'll have to query pkg-config for the OpenCV include dir. See above for a package to help with that. |
Ok need to change setup.py with
and
note: libuv needs to be changed also, not just adding opencv4 include folder and now we need to fix |
And if you want to work with pkgconfig for opencv you need to compile opencv with |
patch
|
I'm surprised that's the only change to the Adding However, an open question for me is whether we should migrate this to robotpy-build assuming that we migrate everything to binary bindings? In that case, we could utilize pkg-config with robotpy-build directly, and could get rid of the cscore subtree. However, not sure whether the upstream WPILib builds would be able to support python bindings or not. |
The upstream builds would be built against the WPILib-packaged OpenCV, so it would definitely not work with the system-installed OpenCV and won't have Python bindings. I've pushed up what I had in my working tree in my experiments compiling against OpenCV 4: add61ae |
robotpy-cscore is used by allwpilib has made changes to accomodate OpenCV4 but I am not sure if they just disabled functions.
When adding and changing the opencv related includes it compiles. The JPEG_QUALITY issue above can be fixed by using the opencv4 equivalent name. One can make current release version of allwpilib compile with opencv4. I have pkgconfig for opencv4 and its in the pkgconfig path but setup.py does not automatically use it. I don't know how to make that work. You are correct there are more issues to solve because latest version of allwpilib on github introduces allwpilib/wpiutil/src/main/native/cpp/jni/WPIUtilJNI.cpp which includes jni.h (found in jvm jdk) and "edu_wpi_first_wpiutil_WPIUtilJNI.h" which appears not being a part of the allwpilib. Perhaps it can be somehow exclude from the robotpy-cscore. I am no expert with creating system packages and perhaps the title of this issue will remain a while longer in effect. |
The frcvision image has all of WPILib, OpenCV, and robotpy-cscore built from source. It does not use any of WPILib's binary artifacts. |
I just realised we will want to make sure we can still build on Windows as well, lest we undo all the work I did last season. |
Hey, I was trying to install cscore on my mac (with OpenCV 4) and finally, I made it thanks to the previous workarounds on this thread. I am sharing what I have done so anyone who needs it can benefit. I have done all the changes on this commit add61ae. It is successfully compiled and installed. Changes (additional to add61ae):
|
This was done in #81. |
(Filing this so people don't waste time trying to get this working with OpenCV 4. tl;dr: it doesn't work and it's hard; stick with OpenCV 3 for now.)
OpenCV 4 appears to install headers to /usr/include/opencv4 instead of /usr/include. It seems like the intended way to discover the correct include path is to call pkg-config:
pkg-config --cflags opencv4
. (One can trick distutils to pass through a-I
by setting $CFLAGS, but obviously that's a terrible suggestion.)However, once you convince distutils to tell gcc to look for the OpenCV headers in the right spot...
The text was updated successfully, but these errors were encountered: