OpenCV的源代码中的位置是大小类

Where in the Source code for OpenCV is the Size Class?

本文关键字:小类 源代码 OpenCV 位置      更新时间:2023-10-16

我在Opencv目录中翻遍了Size:: CV_EXPORTS SIZE Size::width,但我能找到的只是模板类Size_,与文档中相同。我想查看源代码,因为我正在向 OpenCV 库添加改进,这些信息会很有用。 在 Ubuntu Trusty 上,我像这样运行 grep:

grep -r 'CV_EXPORTS SIZE' . 

从根文件夹中的模块目录

提前感谢任何接受者。

,这是一个深层的源代码树。无论如何,opencv/modules/core/include/opencv2/core/types.hpp 有:

/*!
The 2D size class
The class represents the size of a 2D rectangle, image size, matrix size etc.
Normally, cv::Size ~ cv::Size_<int> is used.
*/
template<typename _Tp> class Size_
{
 //! various constructors
    Size_();
    Size_(_Tp _width, _Tp _height);
    Size_(const Size_& sz);
    Size_(const Point_<_Tp>& pt);
    Size_& operator = (const Size_& sz);
    //! the area (width*height)
    _Tp area() const;
    //! conversion of another data type.
    template<typename _Tp2> operator Size_<_Tp2>() const;
    _Tp width, height; // the width and the height
};
/*!
typedef
*/
typedef Size_<int> Size2i;
typedef Size_<float> Size2f;
typedef Size_<double> Size2d;
typedef Size2i Size;

所以,SizeSize2i的别名,是Size_<int>的别名。