Undefined reference to pbcvt::fromMatToNDArray(const& Mat)
Closed this issue · 5 comments
I am trying to pass opencv mat to python file.
I included header and the two source files in my project. I called the function pbcvt::fromMatToNDArray to convert Mat to pyobject. It is throwing undefined reference to pbcvt::fromMatToNDArray(const& Mat) while building.
Can you please guide me how to get rid of this error.
Hi, @Rapolu-Shivanand . What you're seeing is a typical linker error which will arise when your code is calling the pbcvt::fromMatToNDArray(const& Mat)
function from the header, but the compiler for whatever reason cannot find the actual definition of that function in the CPP file. This would mean that the *.cpp file with the definition of fromMatToNDArray somehow is not actually getting compiled. How are you actually including that? Are you sure it's being compiled? Have you used the provided CMakeLists.txt for reference?
P.S. the only other reason I can think of why compilation of fromMatToNDArray
might not go through is if both the preprocessor checks #if CV_VERSION_MAJOR == 3
(in file pyboost_cv3_converter.cpp) and #if CV_VERSION_EPOCH == 2 || (!defined CV_VERSION_EPOCH && CV_VERSION_MAJOR == 2)
(in file pyboost_cv2_converter.cpp) aren't satisfied. I have no idea why something like this might happen, aside from, maybe, if the OpenCV version defines have somehow radically changed in 3.2 or 2.4.13, which is highly improbable.
@Rapolu-Shivanand I haven't heard from you in awhile. I'm hoping you resolved your issue. I'm going to close it for now, you can reopen if the issue persists.
Hi everyone;
I'm trying to compile a c_module which make use of pbcvt::fromMatToNDArray(const& Mat) and I'm getting this same undefined reference when trying to load the module. I'm using opencv4, concretelly opencv_version
outputs 4.0.1, is there any chance I can tweak the code to get it compiled? my libboost is 1.69 while numpy is version 1.16.1.
Thanks in advance.
Szz
Hi I can see you added support to openCV 4 now, I will try it my self, sorry for the inconvenience.
Thanks again
Szz