Table of Contents

Class LineIterator

Namespace
Emgu.CV
Assembly
Emgu.CV.dll

The class is used to iterate over all the pixels on the raster line segment connecting two specified points.

public class LineIterator : UnmanagedObject, IDisposable
Inheritance
LineIterator
Implements
Inherited Members

Constructors

LineIterator(Mat, Point, Point, int, bool)

Create a LineIterator that can be used to get each pixel of a raster line. The line will be clipped on the image boundaries

public LineIterator(Mat img, Point p1, Point p2, int connectivity = 8, bool leftToRight = false)

Parameters

img Mat

The image

p1 Point

The first point

p2 Point

The second point

connectivity int

8-connected or 4-connected

leftToRight bool

If true, then the iteration is always done from the left-most point to the right most, not to depend on the ordering of pt1 and pt2 parameters

Properties

Count

The total number of pixels in the line

public int Count { get; set; }

Property Value

int

Data

Get or set the pixel data in the current position

public Array Data { get; set; }

Property Value

Array

DataPtr

Native pointer to the pixel data at the current position

public nint DataPtr { get; }

Property Value

nint

Pos

returns the current position in the image

public Point Pos { get; }

Property Value

Point

Methods

DisposeObject()

Release unmanaged resources

protected override void DisposeObject()

MoveNext()

Move to the next point

public void MoveNext()

SampleLine(Mat, Point, Point, int, bool)

Copy the pixel data in the line to a new Mat that is of the same type.

public static Mat SampleLine(Mat img, Point p1, Point p2, int connectivity = 8, bool leftToRight = false)

Parameters

img Mat

The image to sample from

p1 Point

The first point

p2 Point

The second point

connectivity int

8-connected or 4-connected

leftToRight bool

If true, then the iteration is always done from the left-most point to the right most, not to depend on the ordering of pt1 and pt2 parameters

Returns

Mat

A new single column Mat of the same data type. The number of rows equals to the number of points on the sample line.