Table of Contents

Class LineIterator

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

Iterates over the pixels that lie on a line segment of an image, mirroring cv::LineIterator. The instance describes the scan (its length is available through Count immediately after construction); enumerating it walks the pixels from pt1 to pt2.

public sealed class LineIterator : CvObject, IDisposable, IEnumerable<LineIterator.Pixel>, IEnumerable
Inheritance
LineIterator
Implements
Inherited Members

Remarks

Enumeration is independent of the instance state, so a single LineIterator can be iterated more than once. Prefer AsValues<T>() to read pixel values safely: it dereferences each pixel while the source image is guaranteed to be alive. The raw Ptr exposed by GetEnumerator() points directly into the image buffer and is only valid while that image has not been disposed.

Constructors

LineIterator(Mat, Point, Point, PixelConnectivity, bool)

Constructor

Properties

Count

Number of pixels along the line.

ElemSize

Size of one pixel in bytes.

Err

Bresenham error term of the current position.

MinusDelta
MinusStep
PlusDelta
PlusStep
Ptr

Pointer to the current pixel (into the image buffer).

Ptr0

Pointer to the first pixel of the image.

Step

Number of bytes between two consecutive rows of the image.

Methods

AsValues<T>()

Enumerates the pixel values along the line as T. Each value is read while the source image is kept alive, so the result is safe to use after enumeration (unlike the raw Ptr).

GetEnumerator()

Enumerates the pixels along the line. Each LineIterator.Pixel carries its position and a raw pointer into the image buffer; that pointer is only valid while the source image is alive. Use AsValues<T>() for safe access.