当前位置:网站首页>OpenCV函数line()的参数pt1和pt2的类型要求
OpenCV函数line()的参数pt1和pt2的类型要求
2022-04-22 12:55:00 【昊虹算法】
群里有人遇到下面的问题:

从截图中可以看出问题出在函数line()的pt1参数上,并且是其类型错误。
OpenCV的函数line()的原型如下:
void cv::line( InputOutputArray img,
Point pt1,
Point pt2,
const Scalar & color,
int thickness = 1,
int lineType = LINE_8,
int shift = 0
)
从这个原型可以看出其参数pt1和pt2的类型为Point,所以去查阅Point类型的定义如下:

typedef Point2i cv::Point
再查阅类型Point2i的定义:

typedef Point_<int> cv::Point2i
可见,其点坐标的类型要求是整型,而群里那位朋友写的值为浮点型,如下:

所以要报错。
总结一下:
OpenCV函数line()的参数pt1和pt2的坐标值数据应该是int型,而不能是浮点型。
版权声明
本文为[昊虹算法]所创,转载请带上原文链接,感谢
https://blog.csdn.net/wenhao_ir/article/details/124312709
边栏推荐
- JS foundation 5
- 396. Rotation function
- R语言使用treemap包中的treemap函数可视化treemap图:treemap将分层数据显示为一组嵌套矩形、自定义设置标签颜色、标签背景色、标签大小、字体格式、边界线条粗细、标签位置等
- 51单片机之串口通信详解及代码示例
- Novartis Nebula updated its prospectus and continued its listing process. Is the "academic school" gaining momentum step by step?
- R language changes dataframe data from long to wide: spread function of tidyr package and pivot of CDATA package_ to_ Rowrecs function, data Table package dcast function
- Share the small problems you have encountered in writing projects recently
- vnpy本地導入csv數據
- Machine learning 7- logistic regression to realize the binary classification of watermelon dataset 2.0
- 【生活杂谈】中体平台教你如何提高彩票中奖率
猜你喜欢
随机推荐
JS foundation 5
Shrinking ox: the last Carnival
396. Fonction de rotation
matlab 桥梁跨径组合问题GUI图形界面完成
R language ggplot2 visualization: ggplot2 visualization moves the legend of the image to the inside of the image and customizes the location of the legend
R语言使用write_xlsx函数导出、写入dataframe数据到excel文件实战
Vnpy importing CSV data locally
<JDBC> 获取数据库连接的五种方式:你真的get到了吗?
R language ggplot2 visualization: calculate the number of missing values of each data column in the dataframe, and visualize the missing values of each data column using a stacked bar plot (set the co
JS foundation 8
Use phpstudy to start MySQL service and create a database
Ros2 learning notes (8) learn the startup file of ros2 from turnlesim
给自己成功的可能性
node. JS database error failed to lookup view "list" in views directory
Let cpolar get a fixed TCP address
Opencv project 1-ocr recognition
What equipment is needed for VR panoramic shooting? What does it do?
11. Container with the most water
R language ggplot2 visualizes the aspect ratio of fixed images_ Fixed() function
3D application rotation album








