Contours2 not working [closed]
I've been working on using OpenCV with regards to a school project. I've downloaded and installed it onto my computer, set it up to work with Dev-C++ 5.11, and tried to run the contours2 cpp sample to make sure I had everything working as planned. Unfortunately, I have received the error "'Mat' in namespace 'cv' does not name a type," originating in the "types" header. While I am somewhat knowledgeable in C++, I am new to OpenCV and not entirely sure how to fix this without inadvertently messing things up further. Does anyone have suggestions?
Could you please include your source code in your question?
I was using the contours2 example from the OpenCV library, as well as the headers that are referenced in it (core, opencv, utility, cvdef, highgui, highgui_c, imgproc, imgproc_c, and types_c). The error shows up in the types_c header. As there's so much ground to cover I wasn't sure how to upload it, as .zip files aren't allowed for upload. Sorry...
note, that the contours2.cpp does NOT include any xx_c.h headers
I understand that much. The only one that contours2 explicitly included was imgproc. But imgproc included some other headers, and some of them included more. All those headers I mentioned were the ones that showed up when I tried to compile contours2.
what exactly did you do here?
devcpp usually comes bundled with an (outdated) mingw compiler, to use that, step #1 would have been building the opencv libs from src (the prebuilt libs are for VisualStudio only)
is there any chance, you can use VisualStudio instead of devcpp ?
The library is only for Visual Studio? I guess that explains why it looked weird when I opened it in Dev-C++. But how do I make a library compatible with Dev-C++? I've never used Visual Studio before and I'm already having a hard time learning OpenCV without learning to use an entirely new software.
you seem to underestimate the problems ahead. support for mingw has been dropped many years before, and building libs from src is not a piece of cake for a noob (esp. if i look at the question, and the comments above)
I guess I'll try again with setting it up for Visual Studio, then. I'm kind of on a time limit with this project, and the more I can get done quickly, the better.
Yes, VS Community Edition 2017 is free, and it works with the prebuilt OpenCV libraries (it's how I installed OpenCV on both of my Windows machines). See: https://opencv.org/releases.html --> (3.4.3) Win Pack.