首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行make CentOS时出现OpenCV错误

运行make CentOS时出现OpenCV错误
EN

Stack Overflow用户
提问于 2012-07-31 00:00:27
回答 3查看 2.9K关注 0票数 4

我正在尝试在CentOS 5.8上安装OpenCV 2.4.2,但出现以下错误

代码语言:javascript
复制
[ 34%] Built target opencv_test_highgui
[ 34%] Building CXX object modules/features2d/CMakeFiles/opencv_features2d.dir/src/freak.cpp.o
/home/jtrinidad/Downloads/OpenCV-2.4.2/modules/core/include/opencv2/core/core.hpp:1286: warning: ‘class cv::_InputArray’ has virtual functions but non-virtual destructor
/home/jtrinidad/Downloads/OpenCV-2.4.2/modules/core/include/opencv2/core/core.hpp:1365: warning: ‘class cv::_OutputArray’ has virtual functions but non-virtual destructor
/home/jtrinidad/Downloads/OpenCV-2.4.2/modules/features2d/src/freak.cpp: In member function ‘virtual void cv::FREAK::computeImpl(const cv::Mat&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::Mat&) const’:
/home/jtrinidad/Downloads/OpenCV-2.4.2/modules/features2d/src/freak.cpp:367: error: shift must be an immediate
make[2]: *** [modules/features2d/CMakeFiles/opencv_features2d.dir/src/freak.cpp.o] Error 1
make[1]: *** [modules/features2d/CMakeFiles/opencv_features2d.dir/all] Error 2
make: *** [all] Error 2

我在cmake上运行了以下命令

代码语言:javascript
复制
 cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_EXAMPLES=OFF WITH_CUDA=OFF ..     

谢谢。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2012-07-31 23:19:42

问题已解决。

我将以下补丁应用于~/Downloads/OpenCV-2.4.2/modules/features2d/src/freak.cpp

代码语言:javascript
复制
diff -crB OpenCV-2.4.2.orig/modules/features2d/src/freak.cpp OpenCV-2.4.2/modules/features2d/src/freak.cpp
*** OpenCV-2.4.2.orig/modules/features2d/src/freak.cpp  2012-07-25 09:54:50.000000000 -0400
--- OpenCV-2.4.2/modules/features2d/src/freak.cpp   2012-07-24 10:34:57.000000000 -0400
***************
*** 364,370 ****
        __m128i workReg = _mm_min_epu8(operand1, operand2); // emulated "not less than" for 8-bit UNSIGNED integers
        workReg = _mm_cmpeq_epi8(workReg, operand2);        // emulated "not less than" for 8-bit UNSIGNED integers

!                     workReg = _mm_and_si128(_mm_srli_epi16(binMask, m), workReg); // merge the last 16 bits with the 128bits std::vector until full
        result128 = _mm_or_si128(result128, workReg);
        }
        (*ptr) = result128;
--- 364,404 ----
        __m128i workReg = _mm_min_epu8(operand1, operand2); // emulated "not less than" for 8-bit UNSIGNED integers
        workReg = _mm_cmpeq_epi8(workReg, operand2);        // emulated "not less than" for 8-bit UNSIGNED integers

!                     // merge the last 16 bits with the 128bits std::vector until full
!                     __m128i shiftedMask;
!           switch(m) {
!               case 8:
!               shiftedMask = _mm_srli_epi16(binMask, 8);
!               break;
!               case 7:
!               shiftedMask = _mm_srli_epi16(binMask, 7);
!               break;
!               case 6:
!               shiftedMask = _mm_srli_epi16(binMask, 6);
!               break;
!               case 5:
!               shiftedMask = _mm_srli_epi16(binMask, 5);
!               break;
!               case 4:
!               shiftedMask = _mm_srli_epi16(binMask, 4);
!               break;
!               case 3:
!               shiftedMask = _mm_srli_epi16(binMask, 3);
!               break;
!               case 2:
!               shiftedMask = _mm_srli_epi16(binMask, 2);
!               break;
!               case 1:
!               shiftedMask = _mm_srli_epi16(binMask, 1);
!               break;
!               case 0:
!               shiftedMask = _mm_srli_epi16(binMask, 0);
!               break;
!           default:
!               throw "shifting less than 0";
!                     }
!                     workReg = _mm_and_si128(shiftedMask, workReg); 
! 
        result128 = _mm_or_si128(result128, workReg);
        }
        (*ptr) = result128;
票数 4
EN

Stack Overflow用户

发布于 2012-10-12 17:38:48

完整的修补程序文件:http://code.opencv.org/projects/opencv/repository/revisions/65f85856306575e4d71164c8212e84d26424cf0f

票数 2
EN

Stack Overflow用户

发布于 2013-01-29 12:58:30

在尝试使用补丁之后,我求助于手动编译freak.cpp。我的安装说明可以在这里找到:http://www.megalinux.net/compiling-opencv-2-4-on-rhelcentos-5/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11725136

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档