OpenCV  4.1.0
Open Source Computer Vision
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
cv::Range Class Reference

Template class specifying a continuous subsequence (slice) of a sequence. More...

#include <opencv2/core/types.hpp>

Inheritance diagram for cv::Range:
cv::dnn::_Range

Public Member Functions

 Range ()
 
 Range (int _start, int _end)
 
bool empty () const
 
int size () const
 

Static Public Member Functions

static Range all ()
 

Public Attributes

int end
 
int start
 

Detailed Description

Template class specifying a continuous subsequence (slice) of a sequence.

The class is used to specify a row or a column span in a matrix ( Mat ) and for many other purposes. Range(a,b) is basically the same as a:b in Matlab or a..b in Python. As in Python, start is an inclusive left boundary of the range and end is an exclusive right boundary of the range. Such a half-opened interval is usually denoted as \([start,end)\) .

The static method Range::all() returns a special variable that means "the whole sequence" or "the whole range", just like " : " in Matlab or " ... " in Python. All the methods and functions in OpenCV that take Range support this special Range::all() value. But, of course, in case of your own custom processing, you will probably have to check and handle it explicitly:

void my_function(..., const Range& r, ....)
{
if(r == Range::all()) {
// process all the data
}
else {
// process [r.start, r.end)
}
}

Constructor & Destructor Documentation

cv::Range::Range ( )
cv::Range::Range ( int  _start,
int  _end 
)

Member Function Documentation

static Range cv::Range::all ( )
static
bool cv::Range::empty ( ) const
int cv::Range::size ( ) const

Member Data Documentation

int cv::Range::end
int cv::Range::start

The documentation for this class was generated from the following file: