opencv:C2668: 'cvRound':对重载函数的模糊调用

标签 opencv

我在 Qt5.7 中使用 opencv3.2。以下是我的部分代码:

  for(int i=0;i<contour[0].size();i++)
  {
    if(contour[0][i].x>xmax) xmax = contour[0][i].x;
    if(contour[0][i].x<xmin) xmin = contour[0][i].x;
    if(contour[0][i].y>ymax) ymax = contour[0][i].y;
    if(contour[0][i].y<ymin) ymin = contour[0][i].y;
  }
  int step = cvRound(contour[0].size()/16); #this line causes the error

建筑错误是:
error C2668: 'cvRound': ambiguous call to overloaded function
C:\opencv-3.2.0\mybuild\include\opencv2/core/fast_math.hpp(232): note: could be 'int cvRound(int)'
C:\opencv-3.2.0\mybuild\include\opencv2/core/fast_math.hpp(201): note: or       'int cvRound(float)'
C:\opencv-3.2.0\mybuild\include\opencv2/core/fast_math.hpp(93): note: or       'int cvRound(double)'

任何人都可以帮助解决错误?

最佳答案

尝试转换 Round 的参数。你可以在它们前面写( float )。这样,您可以帮助编译器找到正确的 Round 函数(例如,采用 float 参数的函数)

关于opencv:C2668: 'cvRound':对重载函数的模糊调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48673249/

相关文章:

Android:使用 JavaCV 进行形状检测

python - cv2.fillPoly 奇怪的结果

python - 将颜色应用于渐变方向

c++ - 如何使用 OpenCv 将字节数组转换为 IplImage?

python-3.x - OpenCV - Python 将底部添加到现有图像

android - 如何在 Android 中从文件读取 OpenCV Mat 对象?

opencv - 使用 OpenCV 和 FFMPEG 从网络摄像机通过 RTSP 捕获视频时出错

python - 如何在opencv中使用脊线检测过滤器

c++ - 从 SVN 编译 Opencv

python - opencv cv2.calibrateCamera错误