kyamagu / mexopencv

Collection and a development kit of matlab mex functions for OpenCV library
http://kyamagu.github.io/mexopencv
Other
664 stars 319 forks source link

Error compiling SuperResolution_.cpp #282

Closed Tariq-Abuhashim closed 6 years ago

Tariq-Abuhashim commented 8 years ago

I get this error when I run

make all MATLABDIR=/usr/local/MATLAB/R2016b

(btw, I believe that installation notes need to be updated, because using "make" compiles only few examples, "make all" compiles all the mex files).

In order to finish, I removed SuperResolution_.cpp from the src list, and compiling was successful. However, when I attempt to compile it, it generates the following error:

/usr/local/MATLAB/R2016b/bin/mex -largeArrayDims -cxx -Iinclude -I/usr/local/include/opencv -I/usr/local/include    -output +cv/private/SuperResolution_ src/+cv/private/SuperResolution_.cpp -Llib -lMxArray -L/usr/local/lib -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn -lopencv_dpm -lopencv_fuzzy -lopencv_line_descriptor -lopencv_optflow -lopencv_plot -lopencv_reg -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_rgbd -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_face -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_xobjdetect -lopencv_objdetect -lopencv_ml -lopencv_xphoto -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_photo -lopencv_imgproc -lopencv_core   
Building with 'g++'.
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:76:25: error: template argument 1 is invalid
 Ptr<FarnebackOpticalFlow> createFarnebackOpticalFlow(
                         ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp: In function ‘int {anonymous}::createFarnebackOpticalFlow(bool, std::vector<MxArray>::const_iterator, std::vector<MxArray>::const_iterator)’:
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:83:29: error: template argument 1 is invalid
     Ptr<FarnebackOpticalFlow> p = (use_gpu) ?
                             ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:83:33: error: invalid type in declaration before ‘=’ token
     Ptr<FarnebackOpticalFlow> p = (use_gpu) ?
                                 ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:85:33: error: invalid user-defined conversion from ‘cv::Ptr<cv::superres::FarnebackOpticalFlow>’ to ‘int’ [-fpermissive]
         createOptFlow_Farneback();
                                 ^
In file included from /usr/local/include/opencv2/core/cvstd.hpp:1064:0,
                 from /usr/local/include/opencv2/core/base.hpp:58,
                 from /usr/local/include/opencv2/core.hpp:54,
                 from /usr/local/include/opencv2/opencv.hpp:52,
                 from include/MxArray.hpp:14,
                 from include/mexopencv.hpp:14,
                 from /home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:8:
/usr/local/include/opencv2/core/ptr.inl.hpp:222:1: note: candidate is: cv::Ptr<T>::operator T*() const [with T = cv::superres::FarnebackOpticalFlow] <near match>
 Ptr<T>::operator T* () const
 ^
/usr/local/include/opencv2/core/ptr.inl.hpp:222:1: note:   no known conversion for implicit ‘this’ parameter from ‘cv::superres::FarnebackOpticalFlow*’ to ‘int’
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:86:11: error: request for member ‘empty’ in ‘p’, which is of non-class type ‘int’
     if (p.empty())
           ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:93:14: error: base operand of ‘->’ is not a pointer
             p->setPyrScale(val.toDouble());
              ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:95:14: error: base operand of ‘->’ is not a pointer
             p->setLevelsNumber(val.toInt());
              ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:97:14: error: base operand of ‘->’ is not a pointer
             p->setWindowSize(val.toInt());
              ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:99:14: error: base operand of ‘->’ is not a pointer
             p->setIterations(val.toInt());
              ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:101:14: error: base operand of ‘->’ is not a pointer
             p->setPolyN(val.toInt());
              ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:103:14: error: base operand of ‘->’ is not a pointer
             p->setPolySigma(val.toDouble());
              ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:105:14: error: base operand of ‘->’ is not a pointer
             p->setFlags(val.toInt());  //TODO: cv::OPTFLOW_FARNEBACK_GAUSSIAN
              ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp: In function ‘cv::Ptr<cv::superres::DenseOpticalFlowExt> {anonymous}::createDenseOpticalFlowExt(const string&, std::vector<MxArray>::const_iterator, std::vector<MxArray>::const_iterator)’:
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:249:11: error: no match for ‘operator=’ (operand types are ‘cv::Ptr<cv::superres::DenseOpticalFlowExt>’ and ‘int’)
         p = createFarnebackOpticalFlow(false, first, last);
           ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:249:11: note: candidates are:
In file included from /usr/local/include/opencv2/core/cvstd.hpp:1064:0,
                 from /usr/local/include/opencv2/core/base.hpp:58,
                 from /usr/local/include/opencv2/core.hpp:54,
                 from /usr/local/include/opencv2/opencv.hpp:52,
                 from include/MxArray.hpp:14,
                 from include/mexopencv.hpp:14,
                 from /home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:8:
/usr/local/include/opencv2/core/ptr.inl.hpp:160:9: note: cv::Ptr<T>& cv::Ptr<T>::operator=(const cv::Ptr<T>&) [with T = cv::superres::DenseOpticalFlowExt]
 Ptr<T>& Ptr<T>::operator = (const Ptr<T>& o)
         ^
/usr/local/include/opencv2/core/ptr.inl.hpp:160:9: note:   no known conversion for argument 1 from ‘int’ to ‘const cv::Ptr<cv::superres::DenseOpticalFlowExt>&’
In file included from /usr/local/include/opencv2/core/base.hpp:58:0,
                 from /usr/local/include/opencv2/core.hpp:54,
                 from /usr/local/include/opencv2/opencv.hpp:52,
                 from include/MxArray.hpp:14,
                 from include/mexopencv.hpp:14,
                 from /home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:8:
/usr/local/include/opencv2/core/cvstd.hpp:355:10: note: template<class Y> cv::Ptr<T>& cv::Ptr<T>::operator=(const cv::Ptr<Y>&) [with Y = Y; T = cv::superres::DenseOpticalFlowExt]
     Ptr& operator = (const Ptr<Y>& o);
          ^
/usr/local/include/opencv2/core/cvstd.hpp:355:10: note:   template argument deduction/substitution failed:
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:249:11: note:   mismatched types ‘const cv::Ptr<T>’ and ‘int’
         p = createFarnebackOpticalFlow(false, first, last);
           ^
In file included from /usr/local/include/opencv2/core/cvstd.hpp:1064:0,
                 from /usr/local/include/opencv2/core/base.hpp:58,
                 from /usr/local/include/opencv2/core.hpp:54,
                 from /usr/local/include/opencv2/opencv.hpp:52,
                 from include/MxArray.hpp:14,
                 from include/mexopencv.hpp:14,
                 from /home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:8:
/usr/local/include/opencv2/core/ptr.inl.hpp:265:9: note: cv::Ptr<T>& cv::Ptr<T>::operator=(cv::Ptr<T>&&) [with T = cv::superres::DenseOpticalFlowExt]
 Ptr<T>& Ptr<T>::operator = (Ptr<T>&& o)
         ^
/usr/local/include/opencv2/core/ptr.inl.hpp:265:9: note:   no known conversion for argument 1 from ‘int’ to ‘cv::Ptr<cv::superres::DenseOpticalFlowExt>&&’
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:253:11: error: no match for ‘operator=’ (operand types are ‘cv::Ptr<cv::superres::DenseOpticalFlowExt>’ and ‘int’)
         p = createFarnebackOpticalFlow(true, first, last);
           ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:253:11: note: candidates are:
In file included from /usr/local/include/opencv2/core/cvstd.hpp:1064:0,
                 from /usr/local/include/opencv2/core/base.hpp:58,
                 from /usr/local/include/opencv2/core.hpp:54,
                 from /usr/local/include/opencv2/opencv.hpp:52,
                 from include/MxArray.hpp:14,
                 from include/mexopencv.hpp:14,
                 from /home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:8:
/usr/local/include/opencv2/core/ptr.inl.hpp:160:9: note: cv::Ptr<T>& cv::Ptr<T>::operator=(const cv::Ptr<T>&) [with T = cv::superres::DenseOpticalFlowExt]
 Ptr<T>& Ptr<T>::operator = (const Ptr<T>& o)
         ^
/usr/local/include/opencv2/core/ptr.inl.hpp:160:9: note:   no known conversion for argument 1 from ‘int’ to ‘const cv::Ptr<cv::superres::DenseOpticalFlowExt>&’
In file included from /usr/local/include/opencv2/core/base.hpp:58:0,
                 from /usr/local/include/opencv2/core.hpp:54,
                 from /usr/local/include/opencv2/opencv.hpp:52,
                 from include/MxArray.hpp:14,
                 from include/mexopencv.hpp:14,
                 from /home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:8:
/usr/local/include/opencv2/core/cvstd.hpp:355:10: note: template<class Y> cv::Ptr<T>& cv::Ptr<T>::operator=(const cv::Ptr<Y>&) [with Y = Y; T = cv::superres::DenseOpticalFlowExt]
     Ptr& operator = (const Ptr<Y>& o);
          ^
/usr/local/include/opencv2/core/cvstd.hpp:355:10: note:   template argument deduction/substitution failed:
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:253:11: note:   mismatched types ‘const cv::Ptr<T>’ and ‘int’
         p = createFarnebackOpticalFlow(true, first, last);
           ^
In file included from /usr/local/include/opencv2/core/cvstd.hpp:1064:0,
                 from /usr/local/include/opencv2/core/base.hpp:58,
                 from /usr/local/include/opencv2/core.hpp:54,
                 from /usr/local/include/opencv2/opencv.hpp:52,
                 from include/MxArray.hpp:14,
                 from include/mexopencv.hpp:14,
                 from /home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:8:
/usr/local/include/opencv2/core/ptr.inl.hpp:265:9: note: cv::Ptr<T>& cv::Ptr<T>::operator=(cv::Ptr<T>&&) [with T = cv::superres::DenseOpticalFlowExt]
 Ptr<T>& Ptr<T>::operator = (Ptr<T>&& o)
         ^
/usr/local/include/opencv2/core/ptr.inl.hpp:265:9: note:   no known conversion for argument 1 from ‘int’ to ‘cv::Ptr<cv::superres::DenseOpticalFlowExt>&&’
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp: In function ‘MxArray {anonymous}::toStruct(cv::Ptr<cv::superres::DenseOpticalFlowExt>)’:
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:301:37: error: template argument 1 is invalid
             Ptr<FarnebackOpticalFlow> pp = p.dynamicCast<FarnebackOpticalFlow>();
                                     ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:301:42: error: invalid type in declaration before ‘=’ token
             Ptr<FarnebackOpticalFlow> pp = p.dynamicCast<FarnebackOpticalFlow>();
                                          ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:301:46: error: parse error in template argument list
             Ptr<FarnebackOpticalFlow> pp = p.dynamicCast<FarnebackOpticalFlow>();
                                              ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:301:80: error: no matching function for call to ‘cv::Ptr<cv::superres::DenseOpticalFlowExt>::dynamicCast()’
             Ptr<FarnebackOpticalFlow> pp = p.dynamicCast<FarnebackOpticalFlow>();
                                                                                ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:301:80: note: candidate is:
In file included from /usr/local/include/opencv2/core/base.hpp:58:0,
                 from /usr/local/include/opencv2/core.hpp:54,
                 from /usr/local/include/opencv2/opencv.hpp:52,
                 from include/MxArray.hpp:14,
                 from include/mexopencv.hpp:14,
                 from /home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:8:
/usr/local/include/opencv2/core/cvstd.hpp:409:12: note: template<class Y> cv::Ptr<Y> cv::Ptr<T>::dynamicCast() const [with Y = Y; T = cv::superres::DenseOpticalFlowExt]
     Ptr<Y> dynamicCast() const;
            ^
/usr/local/include/opencv2/core/cvstd.hpp:409:12: note:   template argument deduction/substitution failed:
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:301:80: error: template argument 1 is invalid
             Ptr<FarnebackOpticalFlow> pp = p.dynamicCast<FarnebackOpticalFlow>();
                                                                                ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:302:21: error: request for member ‘empty’ in ‘pp’, which is of non-class type ‘int’
             if (!pp.empty()) {
                     ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:303:45: error: base operand of ‘->’ is not a pointer
                 s.set("PyrScale",         pp->getPyrScale());
                                             ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:304:45: error: base operand of ‘->’ is not a pointer
                 s.set("LevelsNumber",     pp->getLevelsNumber());
                                             ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:305:45: error: base operand of ‘->’ is not a pointer
                 s.set("WindowSize",       pp->getWindowSize());
                                             ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:306:45: error: base operand of ‘->’ is not a pointer
                 s.set("Iterations",       pp->getIterations());
                                             ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:307:45: error: base operand of ‘->’ is not a pointer
                 s.set("PolyN",            pp->getPolyN());
                                             ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:308:45: error: base operand of ‘->’ is not a pointer
                 s.set("PolySigma",        pp->getPolySigma());
                                             ^
/home/tariq/Downloads/mexopencv/src/+cv/private/SuperResolution_.cpp:309:45: error: base operand of ‘->’ is not a pointer
                 s.set("Flags",            pp->getFlags());
                                             ^

make: *** [+cv/private/SuperResolution_.mexa64] Error 255
yiran-THU commented 8 years ago

We come across the same problem https://github.com/kyamagu/mexopencv/issues/269

amroamroamro commented 8 years ago

@Tariq-Abuhashim I suspect you are using the wrong OpenCV version. You must use OpenCV v3.1.0, and NOT the nightly dev version.