@Namespace(value="cv") @NoOffset @Properties(inherit=opencv_imgproc.class) public class LineIterator extends Pointer
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:
{.cpp}
// grabs pixels along the line (pt1, pt2)
// from 8-bit 3-channel image to the buffer
LineIterator it(img, pt1, pt2, 8);
LineIterator it2 = it;
vector<Vec3b> buf(it.count);
for(int i = 0; i < it.count; i++, ++it)
buf[i] = *(const Vec3b*)*it;
// alternative way of iterating through the line
for(int i = 0; i < it2.count; i++, ++it2)
{
Vec3b val = img.at<Vec3b>(it2.pos());
CV_Assert(buf[i] == val);
}
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
LineIterator(Mat img,
Point pt1,
Point pt2) |
LineIterator(Mat img,
Point pt1,
Point pt2,
int connectivity,
boolean leftToRight)
\brief initializes the iterator
|
LineIterator(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
count() |
LineIterator |
count(int setter) |
int |
elemSize() |
LineIterator |
elemSize(int setter) |
int |
err() |
LineIterator |
err(int setter) |
LineIterator |
increment()
\brief prefix increment operator (++it).
|
LineIterator |
increment(int arg0)
\brief postfix increment operator (it++).
|
int |
minusDelta() |
LineIterator |
minusDelta(int setter) |
int |
minusStep() |
LineIterator |
minusStep(int setter) |
BytePointer |
multiply()
\brief returns pointer to the current pixel
|
int |
plusDelta() |
LineIterator |
plusDelta(int setter) |
int |
plusStep() |
LineIterator |
plusStep(int setter) |
Point |
pos()
\brief returns coordinates of the current pixel
|
BytePointer |
ptr() |
LineIterator |
ptr(BytePointer setter) |
BytePointer |
ptr0() |
LineIterator |
ptr0(BytePointer setter) |
int |
step() |
LineIterator |
step(int setter) |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zero
public LineIterator(Pointer p)
Pointer.Pointer(Pointer)
.public LineIterator(@Const @ByRef Mat img, @ByVal Point pt1, @ByVal Point pt2, int connectivity, @Cast(value="bool") boolean leftToRight)
creates iterators for the line connecting pt1 and pt2 the line will be clipped on the image boundaries the line is 8-connected or 4-connected If leftToRight=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
@Cast(value="uchar*") @Name(value="operator *") public BytePointer multiply()
@ByRef @Name(value="operator ++") public LineIterator increment()
@ByVal @Name(value="operator ++") public LineIterator increment(int arg0)
@Cast(value="uchar*") public BytePointer ptr()
public LineIterator ptr(BytePointer setter)
@Cast(value="const uchar*") public BytePointer ptr0()
public LineIterator ptr0(BytePointer setter)
public int step()
public LineIterator step(int setter)
public int elemSize()
public LineIterator elemSize(int setter)
public int err()
public LineIterator err(int setter)
public int count()
public LineIterator count(int setter)
public int minusDelta()
public LineIterator minusDelta(int setter)
public int plusDelta()
public LineIterator plusDelta(int setter)
public int minusStep()
public LineIterator minusStep(int setter)
public int plusStep()
public LineIterator plusStep(int setter)
Copyright © 2020. All rights reserved.