[−][src]Struct opencv::imgproc::LineIterator
Line iterator
The class is used to iterate over all the pixels on the raster line segment connecting two specified points.
The class LineIterator is used to get each pixel of a raster line. It can be treated as versatile implementation of the Bresenham algorithm where you can stop at each pixel and do some extra processing, for example, grab pixel values along the line or draw a line with an effect (for example, with XOR operation).
The number of pixels along the line is stored in LineIterator::count. The method LineIterator::pos returns the current position in the image:
// grabs pixels along the line (pt1, pt2) // from 8-bit 3-channel image to the buffer LineIterator it(img, pt1, pt2, 8); LineIterator it2 = it; vector<Vec3b> buf(it.count); for(int i = 0; i < it.count; i++, ++it) buf[i] = *(const Vec3b*)*it; // alternative way of iterating through the line for(int i = 0; i < it2.count; i++, ++it2) { Vec3b val = img.at<Vec3b>(it2.pos()); CV_Assert(buf[i] == val); }
Implementations
impl LineIterator
[src]
pub fn as_raw_LineIterator(&self) -> *const c_void
[src]
pub fn as_raw_mut_LineIterator(&mut self) -> *mut c_void
[src]
impl LineIterator
[src]
pub fn new(
img: &Mat,
pt1: Point,
pt2: Point,
connectivity: i32,
left_to_right: bool
) -> Result<LineIterator>
[src]
img: &Mat,
pt1: Point,
pt2: Point,
connectivity: i32,
left_to_right: bool
) -> Result<LineIterator>
initializes the iterator
creates iterators for the line connecting pt1 and pt2 the line will be clipped on the image boundaries the line is 8-connected or 4-connected If leftToRight=true, then the iteration is always done from the left-most point to the right most, not to depend on the ordering of pt1 and pt2 parameters;
C++ default parameters
- connectivity: 8
- left_to_right: false
pub fn new_1(
pt1: Point,
pt2: Point,
connectivity: i32,
left_to_right: bool
) -> Result<LineIterator>
[src]
pt1: Point,
pt2: Point,
connectivity: i32,
left_to_right: bool
) -> Result<LineIterator>
C++ default parameters
- connectivity: 8
- left_to_right: false
pub fn new_2(
bounding_area_size: Size,
pt1: Point,
pt2: Point,
connectivity: i32,
left_to_right: bool
) -> Result<LineIterator>
[src]
bounding_area_size: Size,
pt1: Point,
pt2: Point,
connectivity: i32,
left_to_right: bool
) -> Result<LineIterator>
C++ default parameters
- connectivity: 8
- left_to_right: false
pub fn new_3(
bounding_area_rect: Rect,
pt1: Point,
pt2: Point,
connectivity: i32,
left_to_right: bool
) -> Result<LineIterator>
[src]
bounding_area_rect: Rect,
pt1: Point,
pt2: Point,
connectivity: i32,
left_to_right: bool
) -> Result<LineIterator>
C++ default parameters
- connectivity: 8
- left_to_right: false
Trait Implementations
impl Boxed for LineIterator
[src]
pub unsafe fn from_raw(ptr: *mut c_void) -> Self
[src]
pub fn into_raw(self) -> *mut c_void
[src]
pub fn as_raw(&self) -> *const c_void
[src]
pub fn as_raw_mut(&mut self) -> *mut c_void
[src]
impl Drop for LineIterator
[src]
impl LineIteratorTrait for LineIterator
[src]
pub fn as_raw_LineIterator(&self) -> *const c_void
[src]
pub fn as_raw_mut_LineIterator(&mut self) -> *mut c_void
[src]
pub fn ptr(&mut self) -> &mut u8
[src]
pub fn set_ptr(&mut self, val: &mut u8)
[src]
pub fn ptr0(&self) -> &u8
[src]
pub fn step(&self) -> i32
[src]
pub fn set_step(&mut self, val: i32)
[src]
pub fn elem_size(&self) -> i32
[src]
pub fn set_elem_size(&mut self, val: i32)
[src]
pub fn err(&self) -> i32
[src]
pub fn set_err(&mut self, val: i32)
[src]
pub fn count(&self) -> i32
[src]
pub fn set_count(&mut self, val: i32)
[src]
pub fn minus_delta(&self) -> i32
[src]
pub fn set_minus_delta(&mut self, val: i32)
[src]
pub fn plus_delta(&self) -> i32
[src]
pub fn set_plus_delta(&mut self, val: i32)
[src]
pub fn minus_step(&self) -> i32
[src]
pub fn set_minus_step(&mut self, val: i32)
[src]
pub fn plus_step(&self) -> i32
[src]
pub fn set_plus_step(&mut self, val: i32)
[src]
pub fn minus_shift(&self) -> i32
[src]
pub fn set_minus_shift(&mut self, val: i32)
[src]
pub fn plus_shift(&self) -> i32
[src]
pub fn set_plus_shift(&mut self, val: i32)
[src]
pub fn p(&self) -> Point
[src]
pub fn set_p(&mut self, val: Point)
[src]
pub fn ptmode(&self) -> bool
[src]
pub fn set_ptmode(&mut self, val: bool)
[src]
pub fn init(
&mut self,
img: &Mat,
bounding_area_rect: Rect,
pt1: Point,
pt2: Point,
connectivity: i32,
left_to_right: bool
) -> Result<()>
[src]
&mut self,
img: &Mat,
bounding_area_rect: Rect,
pt1: Point,
pt2: Point,
connectivity: i32,
left_to_right: bool
) -> Result<()>
pub fn try_deref_mut(&mut self) -> Result<&mut u8>
[src]
pub fn pos(&self) -> Result<Point>
[src]
impl Send for LineIterator
[src]
Auto Trait Implementations
impl RefUnwindSafe for LineIterator
[src]
impl !Sync for LineIterator
[src]
impl Unpin for LineIterator
[src]
impl UnwindSafe for LineIterator
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,