Linux下编译opencv的cvDrawChessboardCorners函数出错-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

Linux下编译opencv的cvDrawChessboardCorners函数出错

2016-07-15 12:06:23 5336 1

Linux下编译opencv的cvDrawChessboardCorners函数出错
在linux上编译:
zoegreen@zoegreen-Lenovo-IdeaPad-Y470:~/桌面/subpix_test$ g++ subpix2.cpp -o subpix2 pkg-config --cflags --libs opencv
subpix2.cpp: In function ‘int main()’:
subpix2.cpp:15:20: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

 char* filename="camara1.bmp";
                ^

subpix2.cpp:38:9: error: ‘CV_CALIB_CB_ADAPTIVE_THRESH’ was not declared in this scope

     CV_CALIB_CB_ADAPTIVE_THRESH|CV_CALIB_CB_FILTER_QUADS// check page 382-383.
     ^

subpix2.cpp:38:37: error: ‘CV_CALIB_CB_FILTER_QUADS’ was not declared in this scope

     CV_CALIB_CB_ADAPTIVE_THRESH|CV_CALIB_CB_FILTER_QUADS// check page 382-383.
                                 ^

subpix2.cpp:40:9: error: ‘cvFindChessboardCorners’ was not declared in this scope

     );
     ^

subpix2.cpp:49:9: error: ‘cvDrawChessboardCorners’ was not declared in this scope

     );
     ^

zoegreen@zoegreen-Lenovo-IdeaPad-Y470:~/桌面/subpix_test$

请问是环境没配置号吗?但是我之前编译其它的opencv程序都是好的.
其中源程序如下:
#include

include "opencv2/imgproc/imgproc.hpp"

include "opencv2/highgui/highgui.hpp"

include "opencv2/features2d/features2d.hpp"

//#include "opencv2/legacy/legacy.hpp"
using namespace std;

//by Huang, Haiqiao 25 Jun. 2011, fzyhhq@bift.edu.cn
//http://www.opencv.org.cn/forum/viewtopic.php?f=1&t=14214

int main( )
{

cout<<"Draw Chess OpenCV!"<<endl;  
char* filename="camara1.bmp";
IplImage* imgRGB = cvLoadImage(filename); 
IplImage* imgGrey = cvLoadImage(filename,CV_LOAD_IMAGE_GRAYSCALE); 

if (imgGrey==NULL){//image validation
    cout<< "No valid image input."<<endl; 
    char c=getchar();
    return 1;
} 

//-------find chessboard corners--------------
int corner_row=13;//interior number of row corners.(this can be countered by fingers.)
int corner_col=12;//interior number of column corners.
int corner_n=corner_row*corner_col;
CvSize pattern_size=cvSize(corner_row,corner_col);
CvPoint2D32f* corners=new CvPoint2D32f[corner_n];
int corner_count;

int found=cvFindChessboardCorners(//returning non-zero means sucess.
    imgGrey,// 8-bit single channel greyscale image.
    pattern_size,//how many INTERIOR corners in each row and column of the chessboard.
    corners,//a pointer to an array where the corner locations can be recorded.
    &corner_count,// optional, if non-NULL, its a point to an integer where the nuber of corners found can be recorded.
    CV_CALIB_CB_ADAPTIVE_THRESH|CV_CALIB_CB_FILTER_QUADS// check page 382-383.

    );
 cout<<"corner_count = "<<corner_count;
//-------Draw the corner pattern-------
cvDrawChessboardCorners(
    imgRGB,
    pattern_size,
    corners,
    corner_count,
    found
    );

//to summary a bit of findings.
cout<<"found="<<found<<endl;
cout<<"x="<<corners[2].x;
cout<<",y="<<corners[2].y<<endl;

cvNamedWindow("Find and Draw ChessBoard", 0 );
cvShowImage( "Find and Draw ChessBoard", imgRGB );

cvWaitKey(0); 

cvReleaseImage(&imgGrey);
cvReleaseImage(&imgRGB);
cvDestroyWindow("Find and Draw ChessBoard"); 

return 0;
取消 提交回答
全部回答(1)
相关问答

0

回答

openCL 移植到Linux 3.10

2016-07-12 15:38:10 1861浏览量 回答数 0

1

回答

[@wangccsy][¥20]linux 下Tomcat 8 配置https 访问不了

2018-12-14 16:26:14 2907浏览量 回答数 1

1

回答

qt上编译opencv程序出错

2016-07-15 13:24:50 3274浏览量 回答数 1

10

回答

阿里云cdn 的https就是个坑啊,各位谨慎开通

2017-07-24 15:58:36 12753浏览量 回答数 10

1

回答

h5 怎么引用js函数

2018-05-10 19:58:51 2555浏览量 回答数 1

1

回答

阿里云CDN申请 CDN 免费 HTTPS 证书失败是什么原因?

2021-01-05 13:10:37 491浏览量 回答数 1

1

回答

阿里云CDN为什么网站开启 HTTPS 以后显示不全?

2021-01-05 13:13:27 692浏览量 回答数 1

2

回答

阿里云OSS的API是怎么用的

2014-01-04 18:22:23 7896浏览量 回答数 2

1

回答

Linux中的工具OpenSSL(最为重要的SSL/TLS加密库)的具体信息以及渠道是什么?

2021-12-05 21:30:39 113浏览量 回答数 1

0

回答

使用 flash() 函数指定消息的类别时具体代码是怎样写的?

2021-11-17 13:27:58 193浏览量 回答数 0
+关注
杨冬芳
IT从业
1
文章
9167
问答
问答排行榜
最热
最新
相关电子书
更多
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载
冬季实战营第三期:MySQL数据库进阶实战
立即下载