Update LineIterator documentation

pull/21573/head
lamm45 3 years ago
parent a00a0dbfcd
commit 5064b6f747
  1. 47
      modules/imgproc/include/opencv2/imgproc.hpp

@ -4898,13 +4898,11 @@ CV_EXPORTS_W double getFontScaleFromHeight(const int fontFace,
const int pixelHeight, const int pixelHeight,
const int thickness = 1); const int thickness = 1);
/** @brief Line iterator /** @brief Class for iterating over all pixels on a raster line segment.
The class is used to iterate over all the pixels on the raster line The class LineIterator is used to get each pixel of a raster line connecting
segment connecting two specified points. two specified points.
It can be treated as a versatile implementation of the Bresenham algorithm
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 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 example, grab pixel values along the line or draw a line with an effect
(for example, with XOR operation). (for example, with XOR operation).
@ -4933,27 +4931,40 @@ for(int i = 0; i < it2.count; i++, ++it2)
class CV_EXPORTS LineIterator class CV_EXPORTS LineIterator
{ {
public: public:
/** @brief initializes the iterator /** @brief Initializes iterator object for the given line and image.
creates iterators for the line connecting pt1 and pt2 The returned iterator can be used to traverse all pixels on a line that
the line will be clipped on the image boundaries connects the given two points.
the line is 8-connected or 4-connected The line will be clipped on the image boundaries.
If leftToRight=true, then the iteration is always done
from the left-most point to the right most, @param img Underlying image.
not to depend on the ordering of pt1 and pt2 parameters @param pt1 First endpoint of the line.
@param pt2 The other endpoint of the line.
@param 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).
@param leftToRight If true, the line is traversed from the leftmost endpoint to the rightmost
endpoint. Otherwise, the line is traversed from \p pt1 to \p pt2.
*/ */
LineIterator( const Mat& img, Point pt1, Point pt2, LineIterator( const Mat& img, Point pt1, Point pt2,
int connectivity = 8, bool leftToRight = false ); int connectivity = 8, bool leftToRight = false );
/** @brief returns pointer to the current pixel
/** @brief Returns pointer to the current pixel.
*/ */
uchar* operator *(); uchar* operator *();
/** @brief prefix increment operator (++it). shifts iterator to the next pixel
/** @brief Moves iterator to the next pixel on the line.
This is the prefix version (++it).
*/ */
LineIterator& operator ++(); LineIterator& operator ++();
/** @brief postfix increment operator (it++). shifts iterator to the next pixel
/** @brief Moves iterator to the next pixel on the line.
This is the postfix version (it++).
*/ */
LineIterator operator ++(int); LineIterator operator ++(int);
/** @brief returns coordinates of the current pixel
/** @brief Returns coordinates of the current pixel.
*/ */
Point pos() const; Point pos() const;

Loading…
Cancel
Save