I notice that yesterdaya new version of OpenCV was released, v2.3.
I can't install this version in my Mac using cmake and the basic instructions to compilate the sourcecode for Linux & Unix.
I obtained this error message when I execute the make instruction:开发者_Go百科
/Users/jorgevegasanchez/Downloads/OpenCV-2.3.0/modules/highgui/src/cap.cpp: In function ‘CvCapture* cvCreateCameraCapture(int)’:
/Users/jorgevegasanchez/Downloads/OpenCV-2.3.0/modules/highgui/src/cap.cpp:130: error: ‘CV_CAP_OPENNI’ was not declared in this scope
/Users/jorgevegasanchez/Downloads/OpenCV-2.3.0/modules/highgui/src/cap.cpp:131: error: ‘CV_CAP_ANDROID’ was not declared in this scope
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2
There is no problem when installing OpenCV 2.2 using cmake. I think there is an error or a mistake with OSX version of OpenCV 2.3 version.Or I made something wrong ???
Thanks in advance.
You likely have a previous version of opencv2 installed already. Check /opt/local/include
and /opt/local/lib
. If this is the case, these locations likely take precedence on you system PATH
when you try to compile opencv2.3 resulting in the above errors. Either remove the old opencv version or temporarily move that relate to opencv2 from the above mentioned folders while you compile the new version.
I'm not sure your build won't have any more errors, but a quick hack is to protect those constants on a #ifdef
block.
Go to those lines where the error occurs and notice that those 2 constants are used to initialize an int
array named domains
. You can change it's definition to:
int domains[] =
{
#ifdef HAVE_VIDEOINPUT
CV_CAP_DSHOW,
#endif
CV_CAP_IEEE1394, // identical to CV_CAP_DC1394
CV_CAP_STEREO,
CV_CAP_PVAPI,
CV_CAP_VFW, // identical to CV_CAP_V4L
CV_CAP_MIL,
CV_CAP_QT,
CV_CAP_UNICAP,
#ifdef HAVE_OPENNI
CV_CAP_OPENNI,
#endif
#ifdef HAVE_ANDROID_NATIVE_CAMERA
CV_CAP_ANDROID,
#endif
-1
};
This will fix those specific errors, and hopefully you won't have others.
EDIT:
I just downloaded OpenCV 2.3 and compiled it using the standard procedure and everything went fine. No errors!
tar -xjvf OpenCV-2.3.0.tar.bz2
cd OpenCV-2.3.0
mkdir build
cd build/
cmake ../
make
sudo make install
You likely have a previous version of opencv2 installed already. Check /opt/local/include and /opt/local/lib. If this is the case, these locations likely take precedence on you system PATH when you try to compile opencv2.3 resulting in the above errors. Either remove the old opencv version or temporarily move that relate to opencv2 from the above mentioned folders while you compile the new version.
Thanks. It works fine now with mine with OpenCV 2.3.1 under Mac 10.6.8
Update cmake:
sudo port install cmake
精彩评论