Closed izaquiellbessas closed 10 years ago
Make sure you are compiling against the stable OpenCV 2.4.9, not a dev version. If you already are, then you probably have an incorrectly configured setup (start by checking the output of pkg-config --cflags --libs opencv
).
If you follow the included header files, you get:
$MEXOPENCV/src/+cv/adaptiveThreshold.cpp
-> $MEXOPENCV/include/mexopencv.hpp
-> $MEXOPENCV/include/MxArray.hpp
-> $OPENCV/opencv2/opencv.hpp
-> $OPENCV/opencv2/imgproc/imgproc_c.h
-> $OPENCV/opencv2/imgproc/types_c.h
which is where those constants are defined in v2.4.9
Once the next version of OpenCV is released, those constants will probably need to be renamed as:
const ConstMap<std::string,int> DistType = ConstMap<std::string,int>
("User", cv::DIST_USER)
("L1", cv::DIST_L1)
("L2", cv::DIST_L2)
("C", cv::DIST_C)
("L12", cv::DIST_L12)
("Fair", cv::DIST_FAIR)
("Welsch", cv::DIST_WELSCH)
("Huber", cv::DIST_HUBER);
Until then, the only ones defined in v2.4.9 are CV_DIST_*
. Same goes for CV_AA
and probably other constants.
Thank you, solved
I am running into the same problem using opencv2.4.9 (with the 2.4 mexopencv branch here)
$ make
/usr/local/MATLAB/R2015a/bin/mex -cxx -largeArrayDims -Iinclude -I/usr/local/include/opencv -I/usr/local/include src/+cv/adaptiveThreshold.cpp -lMxArray -Llib -ltbb -lrt -lpthread -lm -ldl -L/usr/lib/x86_64-linux-gnu/ -L/usr/local/lib/ -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab -lopencv_viz -lXext -lX11 -lICE -lSM -lGL -lGLU -output +cv/adaptiveThreshold
Building with 'g++'.
In file included from /home/ubuntu/paperdoll/paperdoll-v1.0/mexopencv/src/+cv/adaptiveThreshold.cpp:7:0:
include/mexopencv.hpp:84:16: error: ‘DIST_USER’ is not a member of ‘cv’
I am not sure if the pkg-config results are ok :
$ pkg-config --cflags --libs opencv
-I/usr/local/include/opencv -I/usr/local/include /usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_ocl.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_superres.so /usr/local/lib/libopencv_ts.a /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so /usr/local/lib/libopencv_viz.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so -ltbb -lrt -lpthread -lm -ldl
Any help welcome....
@jeremy-rutman: are you sure you checked-out the v2.4
branch not master
?
According to the the line number in the error message (mexopencv.hpp:84), I would say you working out of master
branch (which targets OpenCV 3.0, not 2.x)...
In v2.4 branch, that enum value doesnt appear on the line mentioned: https://github.com/kyamagu/mexopencv/blob/v2.4/include/mexopencv.hpp, please double check which branch you are on.
Thanks for the help. I tried git checkout v2.4 and git pull then make, and get yet another error .... as its a multiple definition error maybe I added extra unnecessary lib directories to opencv.pc?
ubuntu@ip-172-31-37-253:~/paperdoll/paperdoll-v1.0/mexopencv2.4/mexopencv$ more /usr/local/lib/pkgconfig/opencv.pc
#Package Information for pkg-config
prefix=/usr/local
exec_prefix=${prefix}
libdir=/usr/local/lib
includedir_old=${prefix}/include/opencv
includedir_new=${prefix}/include/opencv2
includedir_extra=${prefix}/include
Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.4.9
Libs: ${exec_prefix}/lib/libopencv_calib3d.so ${exec_prefix}/lib/libopencv_contrib.so ${exec_prefix}/lib/libopencv_cor
e.so ${exec_prefix}/lib/libopencv_features2d.so ${exec_prefix}/lib/libopencv_flann.so ${exec_prefix}/lib/libopencv_gpu.
so ${exec_prefix}/lib/libopencv_highgui.so ${exec_prefix}/lib/libopencv_imgproc.so ${exec_prefix}/lib/libopencv_legacy.
so ${exec_prefix}/lib/libopencv_ml.so ${exec_prefix}/lib/libopencv_nonfree.so ${exec_prefix}/lib/libopencv_objdetect.so
${exec_prefix}/lib/libopencv_ocl.so ${exec_prefix}/lib/libopencv_photo.so ${exec_prefix}/lib/libopencv_stitching.so ${
exec_prefix}/lib/libopencv_superres.so ${exec_prefix}/lib/libopencv_ts.a ${exec_prefix}/lib/libopencv_video.so ${exec_p
refix}/lib/libopencv_videostab.so ${exec_prefix}/lib/libopencv_viz.so -ltbb /usr/lib/x86_64-linux-gnu/libXext.so /usr/l
ib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-li
nux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so -lrt -lpthread -lm -ldl -L${libdir} -lopencv_calib3d -lopencv_imgp
roc -lopencv_contrib -lopencv_legacy -lopencv_core -lopencv_ml -lopencv_features2d -lopencv_objdetect -lopencv_flann -l
opencv_video -lopencv_highgui
Cflags: -I${includedir_new} -I${includedir_old} -I${includedir_extra}
The output I get from 'make' is now:
MEX completed successfully.
/usr/local/MATLAB/R2015a/bin/mex -cxx -largeArrayDims -Iinclude -I/usr/local/include/opencv2 -I/usr/local/include/opencv -I/usr/local/include src/+cv/groupRectangles.cpp -lMxArray -Llib -L/usr/local/lib -ltbb -lrt -lpthread -lm -ldl -lopencv_calib3d -lopencv_imgproc -lopencv_contrib -lopencv_legacy -lopencv_core -lopencv_ml -lopencv_features2d -lopencv_objdetect -lopencv_flann -lopencv_video -lopencv_highgui -L/usr/lib/x86_64-linux-gnu/ -L/usr/local/lib/ -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab -lopencv_viz -lXext -lX11 -lICE -lSM -lGL -lGLU -output +cv/groupRectangles
Building with 'g++'.
lib/libMxArray.a(MxArray.o): In function `std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > > MxArray::toVector<cv::Rect_<int> >() const':
MxArray.cpp:(.text+0x72ca): multiple definition of `std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > > MxArray::toVector<cv::Rect_<int> >() const'
/tmp/mex_22521652329547206_26609/groupRectangles.o:groupRectangles.cpp:(.text+0x1e): first defined here
collect2: error: ld returned 1 exit status
@jeremy-rutman:
I suggest you revert all changes you've made, and try again. The closed issues you've read about tinkering with opencv.pc
or Makefile
have since been fixed in 2.4, and you shouldn't have to edit anything manually...
# OpenCV 2.x
$ sudo apt-get install --reinstall libopencv-dev
# mexopencv
$ cd mexopencv
$ git reset --hard
$ git pull
$ git checkout v2.4
$ make clean && make
Ok thanks , a good compile occurred it seems (I tried 'make clean' then 'make' which worked in the meantime but I imagine your suggestion would have done it too). Now I am up against an error in 'paper-doll' which is the reason why I downloaded mexopencv in the first place - I guess it may be offtopic but it is related I blv: when I run 'make' from matlab to make the clothes parsing tool (http://vision.is.tohoku.ac.jp/~kyamagu/research/paperdoll/) , I get yet another series of errors starting with
Building with 'g++'.
In file included from /usr/local/include/opencv2/opencv.hpp:56:0,
from include/MxArray.hpp:11,
from include/mexopencv.hpp:14,
from /home/ubuntu/paperdoll/paperdoll-v1.0/.../src/+cv/private/SVM_.cpp:7:
/usr/local/include/opencv2/ml/ml.hpp: In function ‘void mexFunction(int, mxArray**, int, const mxArray**)’:
/usr/local/include/opencv2/ml/ml.hpp:554:12: error: ‘CvSVM& CvSVM::operator=(const CvSVM&)’ is private
/home/ubuntu/paperdoll/paperdoll-v1.0/.../src/+cv/private/SVM_.cpp:155:31: error: within this context
In file included from /usr/local/include/opencv2/opencv.hpp:56:0,
from include/MxArray.hpp:11,
from include/mexopencv.hpp:14,
from /home/ubuntu/paperdoll/paperdoll-v1.0/.../src/+cv/private/SVM_.cpp:7:
/usr/include/c++/4.7/type_traits: In substitution of ‘template<class _From1, class _To1> static decltype ((__test_aux<_To1>(declval<_From1>()), std::__sfinae_types::__one())) std::__is_convertible_helper<_From, _To, false>::__test(int) [with _From1 = _From1; _To1 = _To1; _From = CvSVM; _To = CvSVM] [with _From1 = CvSVM; _To1 = CvSVM]’:
/usr/include/c++/4.7/type_traits:1258:70: required from ‘constexpr const bool std::__is_convertible_helper<CvSVM, CvSVM, false>::value’
@jeremy-rutman
Well @kyamagu is more qualified to answer questions regarding his paperdoll
project, but I believe the issue you're seeing is related to #91, meaning you're gonna have to downgrade OpenCV if you wanna keep using an older version of mexopencv... (try OpenCV 2.4.6 or 2.4.7)
@jeremy-rutman Well, I cannot give a thorough support for a proof-of-concept work like paperdoll, but the easiest fix is just to replace the mexopencv directory inside the paperdoll package with the fresh v2.4 branch of mexopencv.
I guess this is the same thing with any scientific or academic project. If you want to test a certain published code, you're gonna have to recreate the exact versions of frameworks and tools that were used when developing the project. As software is always updated, there's bound to be breaking changes...
Hi, I get the following error in 'make' command:
I'm using the current version of the openCV (2.4.9) and mexopenCV