|
| LineIterator (const Mat &img, Point pt1, Point pt2, int connectivity=8, bool leftToRight=false) |
| initializes the iterator More...
|
|
| LineIterator (Point pt1, Point pt2, int connectivity=8, bool leftToRight=false) |
|
| LineIterator (Size boundingAreaSize, Point pt1, Point pt2, int connectivity=8, bool leftToRight=false) |
|
| LineIterator (Rect boundingAreaRect, Point pt1, Point pt2, int connectivity=8, bool leftToRight=false) |
|
void | init (const Mat *img, Rect boundingAreaRect, Point pt1, Point pt2, int connectivity, bool leftToRight) |
|
uchar * | operator* () |
| returns pointer to the current pixel More...
|
|
LineIterator & | operator++ () |
| prefix increment operator (++it). shifts iterator to the next pixel More...
|
|
LineIterator | operator++ (int) |
| postfix increment operator (it++). shifts iterator to the next pixel More...
|
|
Point | pos () const |
| returns coordinates of the current pixel More...
|
|
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:
vector<Vec3b> buf(it.count);
for(int i = 0; i < it.count; i++, ++it)
buf[i] = *(
const Vec3b*)*it;
for(int i = 0; i < it2.count; i++, ++it2)
{
}