user3411335
user3411335

Reputation:

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

I grepped all over the Opencv directory for Size:: CV_EXPORTS SIZE Size::width but all I can find is the Template class Size_, Same as in the Documentation. I would like to view the source code because I'm adding improvements to the OpenCV library and this information would be useful. On Ubuntu Trusty I am running grep like this:

grep -r 'CV_EXPORTS SIZE' . 

from the modules directory in the root folder

Thanks in advance for any takers.

Upvotes: 0

Views: 1762

Answers (1)

unwind
unwind

Reputation: 399999

Ooh, that's a deep source tree. Anyway, opencv/modules/core/include/opencv2/core/types.hpp has:

/*!
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;

So, Size is an alias for Size2i, which is an alias for Size_<int>.

Upvotes: 2

Related Questions