opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.41k stars 5.76k forks source link

opencv [opencv_text] installation issue #1409

Closed smearumi closed 7 years ago

smearumi commented 7 years ago
System information (version)
Detailed description

My steps for installing opencv with opencv_contrib:

  1. I've installed required dependencies.
  2. I've created 'build' directory inside 'opencv-3.3.0' directory.
  3. 'cmake' has been successfully configured and generated.
  4. Got error during 'make'.

Please let me know if I've done anything wrong regarding installation.

Steps to reproduce
mkdir build
cd build

cmake -D WITH_TBB=ON -D WITH_EIGEN=ON ..

cmake -D BUILD_DOCS=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF ..

cmake -D WITH_OPENCL=OFF -D WITH_CUDA=OFF -D BUILD_opencv_gpu=OFF -D BUILD_opencv_gpuarithm=OFF -D BUILD_opencv_gpubgsegm=OFF -D BUILD_opencv_gpucodec=OFF -D BUILD_opencv_gpufeatures2d=OFF -D BUILD_opencv_gpufilters=OFF -D BUILD_opencv_gpuimgproc=OFF -D BUILD_opencv_gpulegacy=OFF -D BUILD_opencv_gpuoptflow=OFF -D BUILD_opencv_gpustereo=OFF -D BUILD_opencv_gpuwarping=OFF ..

cmake -D WITH_OPENGL=ON -D WITH_OPENMP=ON -D WITH_GSTREAMER=ON -D WITH_QT=ON ..

cmake -D OPENCV_EXTRA_MODULES_PATH=/home/rumi/cv2/opencv_contrib-master/modules /home/rumi/cv2/opencv-3.3.0/ ..

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..

[rumi@localhost build]$ make 
[  0%] Built target ittnotify
[  8%] Built target libprotobuf
[ 16%] Built target opencv_core
[ 16%] Built target opencv_flann
[ 16%] Built target opencv_hdf
[ 23%] Built target opencv_imgproc
[ 24%] Built target opencv_ml
[ 26%] Built target opencv_objdetect
[ 26%] Built target opencv_phase_unwrapping
[ 28%] Built target opencv_photo
[ 28%] Built target opencv_plot
[ 29%] Built target opencv_reg
[ 30%] Built target opencv_surface_matching
[ 31%] Built target opencv_video
[ 32%] Built target opencv_xphoto
[ 33%] Built target opencv_bgsegm
[ 39%] Built target opencv_dnn
[ 39%] Built target opencv_dnn_modern
[ 40%] Built target opencv_face
[ 40%] Built target opencv_freetype
[ 41%] Built target opencv_fuzzy
[ 42%] Built target opencv_img_hash
[ 44%] Built target opencv_imgcodecs
[ 45%] Built target opencv_shape
[ 46%] Built target opencv_videoio
[ 46%] Built target opencv_xobjdetect
[ 46%] Automatic MOC for target opencv_highgui
[ 46%] Built target opencv_highgui_autogen
[ 47%] Built target opencv_highgui
[ 47%] Built target opencv_waldboost_detector
[ 48%] Built target opencv_superres
[ 49%] Built target opencv_ts
[ 50%] Built target opencv_bioinspired
[ 51%] Built target opencv_dpm
[ 54%] Built target opencv_features2d
[ 55%] Built target opencv_line_descriptor
[ 57%] Built target opencv_saliency
Scanning dependencies of target opencv_text
[ 57%] Building CXX object modules/text/CMakeFiles/opencv_text.dir/src/ocr_holistic.cpp.o
/home/rumi/cv2/opencv_contrib-master/modules/text/src/ocr_holistic.cpp: In member function ‘size_t cv::text::OCRHolisticWordRecognizerImpl::getClassCount()’:
/home/rumi/cv2/opencv_contrib-master/modules/text/src/ocr_holistic.cpp:74:63: error: no matching function for call to ‘cv::dnn::experimental_dnn_v1::Net::getLayerShapes(cv::dnn::experimental_dnn_v1::MatShape&, int&, std::vector<std::vector<int> >&, std::vector<std::vector<int> >&)’
         net.getLayerShapes(inputShape, id, inShapes, outShapes);
                                                               ^
In file included from /home/rumi/cv2/opencv-3.3.0/modules/dnn/include/opencv2/dnn.hpp:62:0,
                 from /home/rumi/cv2/opencv_contrib-master/modules/text/src/ocr_holistic.cpp:4:
/home/rumi/cv2/opencv-3.3.0/modules/dnn/include/opencv2/dnn/dnn.hpp:505:22: note: candidate: void cv::dnn::experimental_dnn_v1::Net::getLayerShapes(const MatShape&, int, std::vector<std::vector<int> >*, std::vector<std::vector<int> >*) const
         CV_WRAP void getLayerShapes(const MatShape& netInputShape,
                      ^~~~~~~~~~~~~~
/home/rumi/cv2/opencv-3.3.0/modules/dnn/include/opencv2/dnn/dnn.hpp:505:22: note:   no known conversion for argument 3 from ‘std::vector<std::vector<int> >’ to ‘std::vector<std::vector<int> >*’
/home/rumi/cv2/opencv-3.3.0/modules/dnn/include/opencv2/dnn/dnn.hpp:511:22: note: candidate: void cv::dnn::experimental_dnn_v1::Net::getLayerShapes(const std::vector<std::vector<int> >&, int, std::vector<std::vector<int> >*, std::vector<std::vector<int> >*) const
         CV_WRAP void getLayerShapes(const std::vector<MatShape>& netInputShapes,
                      ^~~~~~~~~~~~~~
/home/rumi/cv2/opencv-3.3.0/modules/dnn/include/opencv2/dnn/dnn.hpp:511:22: note:   no known conversion for argument 1 from ‘cv::dnn::experimental_dnn_v1::MatShape {aka std::vector<int>}’ to ‘const std::vector<std::vector<int> >&’
make[2]: *** [modules/text/CMakeFiles/opencv_text.dir/build.make:135: modules/text/CMakeFiles/opencv_text.dir/src/ocr_holistic.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3889: modules/text/CMakeFiles/opencv_text.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
[rumi@localhost build]$
alalek commented 7 years ago

OpenCV => 3.3.0 opencv_contrib-master

You should keep codebases synchronized.

smearumi commented 7 years ago

@alalek Sorry, I'll keep codebases synchronized next time. Already I've edited the issue.

Curiouschild commented 7 years ago

@alalek I use opencv_contrib-master, but still get the same errors.

Curiouschild commented 7 years ago

@smearumi Have you solved this problem? I am still in trouble...

smearumi commented 7 years ago

@Curiouschild Not yet with all modules but have successfully installed by excluding some modules. Please check below:

[rumi@localhost opencv-3.3.0]$ mkdir build
[rumi@localhost opencv-3.3.0]$ cd build
[rumi@localhost build]$

[rumi@localhost build]$ cmake -D WITH_TBB=ON -D WITH_EIGEN=ON ..

[rumi@localhost build]$ cmake -D BUILD_DOCS=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF ..

[rumi@localhost build]$ cmake -D WITH_OPENCL=OFF -D WITH_CUDA=OFF -D BUILD_opencv_gpu=OFF -D BUILD_opencv_gpuarithm=OFF -D BUILD_opencv_gpubgsegm=OFF -D BUILD_opencv_gpucodec=OFF -D BUILD_opencv_gpufeatures2d=OFF -D BUILD_opencv_gpufilters=OFF -D BUILD_opencv_gpuimgproc=OFF -D BUILD_opencv_gpulegacy=OFF -D BUILD_opencv_gpuoptflow=OFF -D BUILD_opencv_gpustereo=OFF -D BUILD_opencv_gpuwarping=OFF ..

[rumi@localhost build]$ cmake -D WITH_FFMPEG=ON -D WITH_OPENMP=ON -D WITH_GSTREAMER=ON ..

[rumi@localhost build]$ cmake \
    -D OPENCV_EXTRA_MODULES_PATH=/home/rumi/cv2/opencv_contrib-master/modules \
    -D BUILD_opencv_matlab=OFF \
    -D BUILD_opencv_text=OFF \
    -D BUILD_opencv_aruco=OFF \
    -D BUILD_opencv_bgsegm=OFF \
    -D BUILD_opencv_ccalib=OFF \
    -D BUILD_opencv_cnn_3dobj=OFF \
    -D BUILD_opencv_contrib_world=OFF \
    -D BUILD_opencv_cvv=OFF \
    -D BUILD_opencv_datasets=OFF \
    -D BUILD_opencv_dnns_easily_fooled=OFF \
    -D BUILD_opencv_dpm=OFF \
    -D BUILD_opencv_freetype=OFF \
    -D BUILD_opencv_hdf=OFF \
    -D BUILD_opencv_line_descriptor=OFF \
    -D BUILD_opencv_matlab=OFF \
    -D BUILD_opencv_optflow=OFF \
    -D BUILD_opencv_phase_unwrapping=OFF \
    -D BUILD_opencv_plot=OFF \
    -D BUILD_opencv_reg=OFF \
    -D BUILD_opencv_rgbd=OFF \
    -D BUILD_opencv_saliency=OFF \
    -D BUILD_opencv_sfm=OFF \
    -D BUILD_opencv_stereo=OFF \
    -D BUILD_opencv_structured_light=OFF \
    -D BUILD_opencv_surface_matching=OFF \
    -D BUILD_opencv_xfeatures2d=OFF \
    -D BUILD_opencv_ximgproc=OFF \
    -D BUILD_opencv_xobjdetect=OFF \
    -D BUILD_opencv_xphoto=OFF \
    /home/rumi/cv2/opencv-3.3.0/ ..

[rumi@localhost build]$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..

[rumi@localhost build]$ make
[rumi@localhost build]$ sudo make install

N. B. you have to replace files locations eg. replace "/home/rumi/cv2/..." with your files locations.

mora260 commented 7 years ago

I'm still facing the issue. And I'm not really sure about the "keep codebases synchronized". I have just cloned the repo and checkout the commit for opencv version 3.3.0 and cloned the repo of opencv_contrib in branch master. The error persists.

alalek commented 7 years ago

opencv version 3.3.0 opencv_contrib in branch master

Compatibility of different versions opencv/opencv_contrib is not supported.

mora260 commented 7 years ago

I have exactly what you say, and the build still fails.

alalek commented 7 years ago

Actually mistake is highlighted above.

It should be:

Usage questions should go to Users OpenCV Q/A forum: http://answers.opencv.org

mora260 commented 7 years ago

Ohhhh! Ok thanks! I get it now!

luuuyi commented 7 years ago

@mora260 have you already solved this problam after using opencv_contrib-3.3.0?

yhx5768 commented 6 years ago

@luuuyi After I changed opencv_contrib(master) to opencv_contrib-3.3.0, it works.