Trait opencv::hub_prelude::LineIteratorTrait [−][src]
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); }
Required methods
fn as_raw_LineIterator(&self) -> *const c_void
[src]
fn as_raw_mut_LineIterator(&mut self) -> *mut c_void
[src]
Provided methods
fn ptr(&mut self) -> &mut u8
[src]
fn set_ptr(&mut self, val: &mut u8)
[src]
fn ptr0(&self) -> &u8
[src]
fn step(&self) -> i32
[src]
fn set_step(&mut self, val: i32)
[src]
fn elem_size(&self) -> i32
[src]
fn set_elem_size(&mut self, val: i32)
[src]
fn err(&self) -> i32
[src]
fn set_err(&mut self, val: i32)
[src]
fn count(&self) -> i32
[src]
fn set_count(&mut self, val: i32)
[src]
fn minus_delta(&self) -> i32
[src]
fn set_minus_delta(&mut self, val: i32)
[src]
fn plus_delta(&self) -> i32
[src]
fn set_plus_delta(&mut self, val: i32)
[src]
fn minus_step(&self) -> i32
[src]
fn set_minus_step(&mut self, val: i32)
[src]
fn plus_step(&self) -> i32
[src]
fn set_plus_step(&mut self, val: i32)
[src]
fn minus_shift(&self) -> i32
[src]
fn set_minus_shift(&mut self, val: i32)
[src]
fn plus_shift(&self) -> i32
[src]
fn set_plus_shift(&mut self, val: i32)
[src]
fn p(&self) -> Point
[src]
fn set_p(&mut self, val: Point)
[src]
fn ptmode(&self) -> bool
[src]
fn set_ptmode(&mut self, val: bool)
[src]
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<()>
fn try_deref_mut(&mut self) -> Result<&mut u8>
[src]
returns pointer to the current pixel
fn pos(&self) -> Result<Point>
[src]
returns coordinates of the current pixel