I’ve installed OpenCv 4.8.0 with contribs and linked it with ROS.
I can use the extra modules with C++ nodes, but I can’t with Python. I found that I have to rebuild OpenCv with OPENCV_ENABLE_NONFREE = ON, but it is not working.
Do I have to rebuild even the vision_opencv pacage I’ve got in my workspace?
Thanks in advance for your help
if you build opencv yourself, you also have to “install” it properly. if you do not, you will not get that opencv in your python. you’ll get whatever you installed previously.
This is the error I get when I try to run the python node I’ve written in ROS:
cv2.error: OpenCV(4.7.0) /io/opencv_contrib/modules/xfeatures2d/src/surf.cpp:1026: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function ‘create’
But I’m not sure I’m doing this properly
you describe two issues.
you’ve provided evidence for the latter. I don’t see evidence that the former is an actual issue. I’ll ignore that then.
yes, you have to build with that flag if you want parts of OpenCV that require the flag.
please set it (use cmake-gui or pass via CLI), have cmake regenerate the build files, then build.
I’ve built with OPENCV_ENABLE_NONFREE=ON, but it still doesn’t work with Python. I get the same error.
after you’ve built the library, how do you install it?
OpenCv is already installed, I’ve just rebuilt the package.
Sorry, I don’t know much about these things so maybe I don’t understand what you mean
perhaps, but not the one you just built.
what do you think happens when you build the library? do you think python somehow knows about those files?
I am trying to tell you that you are missing some steps.
Ok, well I thought the files were there and I just had to “link” them or something, but, as I said, I don’t know much about what happen when I build a library.
Do you have any suggestion about the steps you think I am missing?
what build files do you generate from cmake? makefiles? ninja? something else?
have you run the “make install” command on a successful opencv build?
what is the resulting output?
No, I’ve run the command: make -j8
I’ve tried to run “make install”, but I still get the same error as before.