I'm following the instructions in How to build applications with OpenCV inside the Microsoft Visual Studio but I'm getting errors from the sample code:
- error C2065: 'CAP_PROP_FRAME_WIDTH' : undeclared identifier
- error C2065: 'CAP_PROP_FRAME_HEIGHT' : undeclared identifier
- error C2065: 'CAP_PROP_FRAME_COUNT' : undeclared identifier
I think the identifiers that are undeclared should be declared in highgui so why am I not getting them despite the demo code's #include <opencv2/highgui/highgui.hpp>
?
Here are the steps I have taken.
I've unpacked the OpenCV (Version 2.4.6) files into
C:\OpenCV
, runsetx -m OPENCV_DIR C:\OpenCV\Build\x64\vc11
from an elevated command prompt and added%OPENCV_DIR%\bin
to my path (following instructions in Installation in Windows). Then using the Property pages (View -> Property Pages or Shift-F4) set to 'All Configurations'I've added
$(OPENCV_DIR)\..\..\include
to my C/C++ Additional Include Directories
- I've added
$(OPENCV_DIR)\lib
to the linker Additional Library Directories
- I've cut-an-paste the directory listing of the lib files in
C:\OpenCV\build\x64\vc11\lib
into my input Additional Dependencies
- I've copied the sample code from the article into a new C++ console app (with ATL). I had to change one line in the template code from
int _tmain(int argc, _TCHAR* argv[])
toint _tmain(int argc, char* argv[])
I think the identifiers that are undeclared should be (are) declared in highgui so why am I not getting them despite the demo code's #include <opencv2/highgui/highgui.hpp>
?
Other people having similar issues getting this sample code working in the How to build applications with OpenCV inside the Microsoft Visual Studio note seem to fall over with link errors (e.g. here and here) but I am getting past the linker.
========== EDIT ==========
There appear to be more insurmountable difficulties with the sample code. It is documented as a simple example to load and display an image whose path is supplied as the sole argument to main
, while the code listing itself is video code requiring four command line arguments (i.e. it first checks and stops if argc != 5
). I've submitted a documentation bug. I think the sample code listing should have been be taken from this: https://github.com/Itseez/opencv/blob/master/samples/cpp/tutorial_code/introduction/display_image/display_image.cpp