简体   繁体   English

向量 <Vec3b> 与向量的差异 <int> 在OpenCV中

[英]Vector<Vec3b> difference with Vector<int> in OpenCV

My project is about the moving puck detection and location finding on hockey table. 我的项目是关于冰球桌上的移动冰球检测和位置查找。 I need to use HoughCircles to detect the circular form of the puck. 我需要使用HoughCircles来检测圆盘的圆形形状。 But for this hough alghoritm I need to make a Vector . 但是为此,我需要制作一个Vector I am familiar with Vector concept and how it is working ( basic), but there is problem of differentiating for example Vector<int> Vec and Vector<Vec3b> Vec . 我熟悉Vector概念及其工作原理(基本),但是存在区分Vector<int> VecVector<Vec3b> Vec

Is it possible to somebody let me know what is their difference in meaning and application? 有人可以让我知道他们在含义和应用上有什么区别吗?

Pay attention that Vector and vector are different. 注意Vectorvector不同。 vector is std::vector , while Vector is cv::Vector . vectorstd::vector ,而Vectorcv::Vector Even if in practice the difference is minimal, they are really different things. 即使实际上差异很小,它们实际上是不同的东西。

I'll assume you meant std::vector , but in this context this is valid also for cv::Vector . 我假设您的意思是std::vector ,但是在这种情况下,这对于cv::Vector也是有效的。


A vector<int> is a vector of integers. vector<int>是整数的向量。 Nothing fancy about this. 没什么好看的。

A vector<Vec3b> is a vector of cv::Vec3b , which is an OpenCV structure that holds 3 uchar ( unsigned char ), ie a type with 8 bit that can contain data from 0 to 255. It is in fact defined as a cv::Vec_<uchar, 3> . vector<Vec3b>cv::Vec3b的向量,它是一个OpenCV结构,包含3个ucharunsigned char ),即一种8位类型,可以包含0到255的数据。实际上,它定义为a cv::Vec_<uchar, 3> cv::Vec is a template class that represents short numerical vectors, up to 4 elements, but this is not important here. cv :: Vec是一个模板类,表示短的数字矢量,最多4个元素,但这在这里并不重要。

A Vec3b is usually used in OpenCV to store the color for a pixel, usually a B,G,R triplet. Vec3b通常在OpenCV中用于存储像素的颜色,通常是B,G,R三元组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM