Why after linking the OpenCV libraries, Mat objects are still 'undefined'?
-
@Matiyash
This is C++ code, why are you posting in Qt for Python forum?I don't know anything about OpenCV. But your code shows a compilation error on the word
Matso far as I can see. That would have nothing to do with whether or not you are linking with something. It would imply you have not#included the right header file(s) orMatis not right, e.g. perhaps it's defined in a namespace?UPDATE
Looking at the link you just posted, by the end you can see they usecv::Mat mat;. That's just what I suggested: looks likeMatis defined in acv::namespace. Usecv::Mat QImage2MatColor()or maybe introduceusing cv;into your file to useMatwithout the namespace in front of it. -
@JonB yes, I tried to include cv::, but what caused the expected namespace name error

and also why the error with the name of the function, use of undeclared identifier
@Matiyash
Like I said, I don't use OpenCV. Check it uses a namespace and what that name is. Maybe it'scv2now, oropencv? Surely it gives an example somewhere?What about trying the example at https://docs.opencv.org/3.0-beta/doc/tutorials/introduction/display_image/display_image.html (or equivalent for OpenCV 2.x if 3.0-beta is not suitable, it's what I came across Googling) to see if that works for you?
-
@JonB Thanks for the link, but probably not, it seems like Opencv is installed correctly, I probably have an error related to the paths to the libraries

@Matiyash
Since you show compilation errors onlyINCLUDEPATHis relevant, it has not got as far asLIBSyet. If yourINCLUDEPATHwere wrong you would get errors on#includelines but you do not. Your problem seems to beusing namespace cv. Which is why I would test the sample code I linked, just to see whether it compiles. -
@Matiyash
Since you show compilation errors onlyINCLUDEPATHis relevant, it has not got as far asLIBSyet. If yourINCLUDEPATHwere wrong you would get errors on#includelines but you do not. Your problem seems to beusing namespace cv. Which is why I would test the sample code I linked, just to see whether it compiles. -
@Matiyash
LOL, like I said, I don't use OpenCV or try that example. I know nothing about the other errors it reports. But theusing namespace cvhas gone through without complaint, andMatis accepted, so you ought be able to adapt that/get it working for your code. -
@Matiyash The first error message basically says that std::string is an int which is very strange. Did you redefine "string" somewhere? I would not use "use namespace", at least not for cv.
@jsulm said in Why after linking the OpenCV libraries, Mat objects are still 'undefined'?:
Did you redefine "string" somewhere?
That seems impossible since the whole of the source file is shown, and it has nothing other than system
<...>includes. And the error message states it is matching againststd::string.....The OP was only supposed to be using that sample code to get either
cv::Matorusing namespace vc; Matworking. -
S SGaist moved this topic from Qt for Python on

