[Opencv Make Error]: ‘SolvePnPMethod’ does not name a type; did you mean ‘solvePnPRansac’?

I’m trying to install opencv 3.4.6 on ubuntu 18.04. My CUDA toolkit version is 10.2 with nvidia driver 470. I downloaded opencv in https://opencv.org/releases/ and downloaded opencv_contrib by git clone https://github.com/opencv/opencv_contrib.git with git checkout 3.4 . Then I ran cmake using

cmake -D CMAKE_INSTALL_PREFIX=/usr/local \
 -D CMAKE_BUILD_TYPE=Release \
 -D OPENCV_GENERATE_PKGCONFIG=ON \
 -D ENABLE_CXX11=1  \
 -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules \
 -D OPENCV_ENABLE_NONFREE=True \
 -D INSTALL_C_EXAMPLES=ON \
 -D WITH_CUDA=ON \
 -D WITH_TBB=ON \
 -D ENABLE_FAST_MATH=1 \
 -D WITH_OPENMP=ON \
 -D WITH_CUFFT=ON \
 -D WITH_CUBLAS=ON \
 -D BUILD_opencv_cudacodec=OFF \
 -D CUDA_nppicom_LIBRARY=stdc++ \
 -DCUDA_ARCH_NAME=Manual \ 
 -DCUDA_ARCH_BIN="86" ..

The cmake process ran smoothly. However, during make -j8 process, I encountered the following errors: ‘SolvePnPMethod’ does not name a type; did you mean ‘solvePnPRansac’?; class ‘cv::aruco::EstimateParameters’ does not have any field named ‘solvePnPMethod’.

I searched this error but didn’t get the answer. I really appreciate your help!

both the main and contrib repos need to be checked out to equivalent branches or version tags.

I would not recommend 3.4.6. that’s ancient. stick with latest 4.x. if you must use 3.4, stick with absolute latest 3.4.x

there’s also never a guarantee that a specific branch or version is free of errors. play around.

crosspost:

1 Like

Many thanks for your suggestion! Today I tried to install opencv 4.2.0 with cuda 11.8 and successfully installed it, which had few errors. You are right. Lastest versions are more stable. Meanwhile, building opencv3.4 with contrib3.4 also has this error.