【问题标题】:OpenCV HoughCircles cvRoundOpenCV HoughCircles cvRound
【发布时间】:2013-06-21 19:34:00
【问题描述】:

我刚刚在opencv上关注了一个关于圆圈检测的例子http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.html

vector<Vec3f> circles;
/// Apply the Hough Transform to find the circles
HoughCircles( src_gray, circles, CV_HOUGH_GRADIENT, 1, src_gray.rows/8, 200, 100, 0, 0 );
/// Draw the circles detected
for( size_t i = 0; i < circles.size(); i++ )
{
   Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
   int radius = cvRound(circles[i][2]);
   ...

但是,我的项目与 Eclipse 不接受函数调用

cvRound(circles[i][0])

Invalid arguments ' Candidates are: int cvRound(double) '

我尝试在属性 -> c/c++ 常规 -> 路径和符号中添加包含许多 gnu c 和 c++ 的目录

ndkroot/sources/cxx-stl..../include

本机/jni/include

对于 opencv 等

但它仍然不接受 cvRound 函数,是我缺少什么吗?

提前谢谢

【问题讨论】:

    标签: android opencv eclipse-cdt


    【解决方案1】:

    cvRound 函数只是一个将双精度值转换为整数的舍入函数。两种方式:

    1- 你可以制作自己的舍入函数并使用它。

    int Round(double x){
    int y;
    if(x >= (int)x+0,5)
       y = (int)x++;
    else
       y = (int)x;
    return y;
    }
    

    2- 不仅包含 C++,还包含 opencv 的 C API。 (包括/opencv/)

    【讨论】:

      猜你喜欢
      • 2011-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-22
      • 2017-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多