Class for iterating over all pixels on a raster line segment. More...
#include <opencv2/imgproc.hpp>
Public Member Functions | |
| LineIterator (const Mat &img, Point pt1, Point pt2, int connectivity=8, bool leftToRight=false) | |
| Initializes iterator object for the given line and image. | |
| LineIterator (Point pt1, Point pt2, int connectivity=8, bool leftToRight=false) | |
| LineIterator (Rect boundingAreaRect, Point pt1, Point pt2, int connectivity=8, bool leftToRight=false) | |
| LineIterator (Size boundingAreaSize, 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. | |
| LineIterator & | operator++ () |
| Moves iterator to the next pixel on the line. | |
| LineIterator | operator++ (int) |
| Moves iterator to the next pixel on the line. | |
| Point | pos () const |
| Returns coordinates of the current pixel. | |
Public Attributes | |
| int | count |
| int | elemSize |
| int | err |
| int | minusDelta |
| int | minusShift |
| int | minusStep |
| Point | p |
| int | plusDelta |
| int | plusShift |
| int | plusStep |
| bool | ptmode |
| uchar * | ptr |
| const uchar * | ptr0 |
| int | step |
Detailed Description
Class for iterating over all pixels on a raster line segment.
The class LineIterator is used to get each pixel of a raster line connecting two specified points. It can be treated as a 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:
Constructor & Destructor Documentation
◆ LineIterator() [1/4]
|
inline |
Initializes iterator object for the given line and image.
The returned iterator can be used to traverse all pixels on a line that connects the given two points. The line will be clipped on the image boundaries.
- Parameters
-
img Underlying image. pt1 First endpoint of the line. pt2 The other endpoint of the line. connectivity Pixel connectivity of the iterator. Valid values are 4 (iterator can move up, down, left and right) and 8 (iterator can also move diagonally). leftToRight If true, the line is traversed from the leftmost endpoint to the rightmost endpoint. Otherwise, the line is traversed from pt1topt2.
◆ LineIterator() [2/4]
|
inline |
◆ LineIterator() [3/4]
|
inline |
◆ LineIterator() [4/4]
|
inline |
Member Function Documentation
◆ init()
| void cv::LineIterator::init | ( | const Mat * | img, |
| Rect | boundingAreaRect, | ||
| Point | pt1, | ||
| Point | pt2, | ||
| int | connectivity, | ||
| bool | leftToRight | ||
| ) |
◆ operator*()
| uchar * cv::LineIterator::operator* | ( | ) |
Returns pointer to the current pixel.
◆ operator++() [1/2]
| LineIterator & cv::LineIterator::operator++ | ( | ) |
Moves iterator to the next pixel on the line.
This is the prefix version (++it).
◆ operator++() [2/2]
| LineIterator cv::LineIterator::operator++ | ( | int | ) |
Moves iterator to the next pixel on the line.
This is the postfix version (it++).
◆ pos()
| Point cv::LineIterator::pos | ( | ) | const |
Returns coordinates of the current pixel.
Member Data Documentation
◆ count
| int cv::LineIterator::count |
◆ elemSize
| int cv::LineIterator::elemSize |
◆ err
| int cv::LineIterator::err |
◆ minusDelta
| int cv::LineIterator::minusDelta |
◆ minusShift
| int cv::LineIterator::minusShift |
◆ minusStep
| int cv::LineIterator::minusStep |
◆ p
| Point cv::LineIterator::p |
◆ plusDelta
| int cv::LineIterator::plusDelta |
◆ plusShift
| int cv::LineIterator::plusShift |
◆ plusStep
| int cv::LineIterator::plusStep |
◆ ptmode
| bool cv::LineIterator::ptmode |
◆ ptr
| uchar* cv::LineIterator::ptr |
◆ ptr0
| const uchar* cv::LineIterator::ptr0 |
◆ step
| int cv::LineIterator::step |
The documentation for this class was generated from the following file:
- opencv2/imgproc.hpp
1.9.6