OpenCV 2.4 putText() and Scalar understanding
OpenCV 2.4 putText() and Scalar understanding
我在C++中使用OpenCV 2.4.11。我想在我的图片上显示带有putText()
功能的文本。
例如:
putText(imageOutput,"x:",Point(pos[0],pos[1]),1,1,Scalar(255,0,0),2);
Scalar
输入有什么作用?是否有替代输入而不是Scalar
?
您的代码:
putText(imageOutput,"x:",Point(pos[0],pos[1]),1,1,Scalar(255,0,0),2);
您的问题:
标量函数有什么作用?
您正在创建一个标量对象,您可以在此处查看文档
如果要创建 BGR(全彩色)图像,则可以使用 Scalar(B,G,R)
初始化标量。但是,如果您只想要灰度图像,您需要做的就是使用灰度值对其进行初始化:
Scalar(greyScaleValue);
所以你的代码将是:
putText(imageOutput,"x:",Point(pos[0],pos[1]),1,1,Scalar(30),2);
灰度值为 30。
相关文章:
- C++核心准则 C35 对于接口类"A base class destructor should be either public and virtual, or protected and nonv
- 为什么C++逐位AND运算符在不同大小的操作数中表现为这样
- 为什么 Clang 不允许"and"作为函数名称?
- 位阵列上的快速AND运算
- 是否可以在 C++03 中定义'move-and-swap idiom'等效项
- 使用 cmake 的 Linux 终端上的"Conversion to non-scalar type is requested"错误
- 对 Scalar ::Scalar() 的未定义引用
- BoostPython and CMake
- OpenSSL BIO and SSL_read
- Gurobi GRBModel and GRBmodel in C++
- std::visit and std::variant usage
- SHBrowseForFolder with BIF_BROWSEFORCOMPUTER and SHGetPathFr
- Directx12 and keystrokes
- different between int **arr =new int [ n]; and int a[i][j]?
- C++ getenv and setenv
- Inference pytorch C++ with alexnet and cv::imread image
- Visual Studio 2019 C++ and std::filesystem
- 保证逻辑 AND 表达式中的函数调用
- python ctypes and C++ pointers
- OpenCV 2.4 putText() and Scalar understanding