pub struct Range { /* private fields */ }
Expand 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 .
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)
}
}
Implementations§
Trait Implementations§
source§impl Boxed for Range
impl Boxed for Range
source§unsafe fn from_raw(ptr: <Range as OpenCVFromExtern>::ExternReceive) -> Self
unsafe fn from_raw(ptr: <Range as OpenCVFromExtern>::ExternReceive) -> Self
source§fn into_raw(self) -> <Range as OpenCVTypeExternContainer>::ExternSendMut
fn into_raw(self) -> <Range as OpenCVTypeExternContainer>::ExternSendMut
source§fn as_raw(&self) -> <Range as OpenCVTypeExternContainer>::ExternSend
fn as_raw(&self) -> <Range as OpenCVTypeExternContainer>::ExternSend
source§fn as_raw_mut(&mut self) -> <Range as OpenCVTypeExternContainer>::ExternSendMut
fn as_raw_mut(&mut self) -> <Range as OpenCVTypeExternContainer>::ExternSendMut
source§impl RangeTrait for Range
impl RangeTrait for Range
source§impl RangeTraitConst for Range
impl RangeTraitConst for Range
impl Send for Range
Auto Trait Implementations§
impl Freeze for Range
impl RefUnwindSafe for Range
impl !Sync for Range
impl Unpin for Range
impl UnwindSafe for Range
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
impl<Mat> ModifyInplace for Matwhere
Mat: Boxed,
source§unsafe fn modify_inplace<Res>(
&mut self,
f: impl FnOnce(&Mat, &mut Mat) -> Res
) -> Res
unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res ) -> Res
Mat
or another similar object. By passing
a mutable reference to the Mat
to this function your closure will get called with the read reference and a write references
to the same Mat
. This is of course unsafe as it breaks the Rust aliasing rules, but it might be useful for some performance
sensitive operations. One example of an OpenCV function that allows such in-place modification is imgproc::threshold
. Read more