error: ‘cvPoint’ was not declared in this scope

error: ‘cvPoint’ was not declared in this scope

imageCorners[0] = cvPoint(0, 0);

解决方案:

imageCorners[0] = cv::Point(0, 0);

参考思路:

https://stackoverflow.com/questions/57053358/opencv-cvpoint-and-cv-font-hershey-simplex-not-declared-in-this-scope

Don’t mix the obsolete C api with the C++ api. Use cv::Point instead of cvPoint, and cv::FONT_HERSHEY_SIMPLEX instead of CV_FONT_HERSHEY_SIMPLEX, e.g.:

cv::putText(image, line1, cv::Point(10,image.rows-18),
cv::FONT_HERSHEY_SIMPLEX, 0.4, cv::Scalar(200,200,250), 1, 8);

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
test1.cpp: In function ‘int main(int, char**)’: test1.cpp:7:2: error: ‘CvPoint’ was not declared in this scope 7 | CvPoint center; | ^~~~~~~ test1.cpp:10:2: error: ‘IplImage’ was not declared in this scope 10 | IplImage* image = cvLoadImage("luhan.png"); | ^~~~~~~~ test1.cpp:10:12: error: ‘image’ was not declared in this scope 10 | IplImage* image = cvLoadImage("luhan.png"); | ^~~~~ test1.cpp:10:20: error: ‘cvLoadImage’ was not declared in this scope 10 | IplImage* image = cvLoadImage("luhan.png"); | ^~~~~~~~~~~ test1.cpp:13:2: error: ‘cvShowImage’ was not declared in this scope 13 | cvShowImage("Image", image); | ^~~~~~~~~~~ test1.cpp:15:26: error: ‘center’ was not declared in this scope 15 | if (!image) return -1; center = cvPoint(image->width / 2, image->height / 2); | ^~~~~~ test1.cpp:15:35: error: ‘cvPoint’ was not declared in this scope 15 | if (!image) return -1; center = cvPoint(image->width / 2, image->height / 2); | ^~~~~~~ test1.cpp:21:44: error: expected primary-expression before ‘,’ token 21 | uchar* ptr = &CV_IMAGE_ELEM(image, uchar, i, j * 3); | ^ test1.cpp:21:18: error: ‘CV_IMAGE_ELEM’ was not declared in this scope 21 | uchar* ptr = &CV_IMAGE_ELEM(image, uchar, i, j * 3); | ^~~~~~~~~~~~~ test1.cpp:28:8: error: ‘cvarrToMat’ was not declared in this scope 28 | src = cvarrToMat(image); | ^~~~~~~~~~ test1.cpp:31:5: error: ‘cvNamedWindow’ was not declared in this scope 31 | cvNamedWindow("test",1); imshow("test", src); | ^~~~~~~~~~~~~ test1.cpp:32:3: error: ‘cvWaitKey’ was not declared in this scope 32 | cvWaitKey(); | ^~~~~~~~~
最新发布
07-17

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

君宝bob

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值