@Namespace(value="cv") @NoOffset public static class opencv_imgproc.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
Constructor and Description |
---|
LineIterator(opencv_core.Mat img,
opencv_core.Point pt1,
opencv_core.Point pt2) |
LineIterator(opencv_core.Mat img,
opencv_core.Point pt1,
opencv_core.Point pt2,
int connectivity,
boolean leftToRight)
\brief intializes the iterator
|
LineIterator(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
count() |
opencv_imgproc.LineIterator |
count(int count) |
int |
elemSize() |
opencv_imgproc.LineIterator |
elemSize(int elemSize) |
int |
err() |
opencv_imgproc.LineIterator |
err(int err) |
opencv_imgproc.LineIterator |
increment()
\brief prefix increment operator (++it).
|
opencv_imgproc.LineIterator |
increment(int arg0)
\brief postfix increment operator (it++).
|
int |
minusDelta() |
opencv_imgproc.LineIterator |
minusDelta(int minusDelta) |
int |
minusStep() |
opencv_imgproc.LineIterator |
minusStep(int minusStep) |
BytePointer |
multiply()
\brief returns pointer to the current pixel
|
int |
plusDelta() |
opencv_imgproc.LineIterator |
plusDelta(int plusDelta) |
int |
plusStep() |
opencv_imgproc.LineIterator |
plusStep(int plusStep) |
opencv_core.Point |
pos()
\brief returns coordinates of the current pixel
|
BytePointer |
ptr() |
opencv_imgproc.LineIterator |
ptr(BytePointer ptr) |
BytePointer |
ptr0() |
int |
step() |
opencv_imgproc.LineIterator |
step(int step) |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, position, put, realloc, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zero
public LineIterator(Pointer p)
Pointer.Pointer(Pointer)
.public LineIterator(@Const @ByRef opencv_core.Mat img, @ByVal opencv_core.Point pt1, @ByVal opencv_core.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
public LineIterator(@Const @ByRef opencv_core.Mat img, @ByVal opencv_core.Point pt1, @ByVal opencv_core.Point pt2)
@Cast(value="uchar*") @Name(value="operator *") public BytePointer multiply()
@ByRef @Name(value="operator ++") public opencv_imgproc.LineIterator increment()
@ByVal @Name(value="operator ++") public opencv_imgproc.LineIterator increment(int arg0)
@ByVal public opencv_core.Point pos()
@Cast(value="uchar*") public BytePointer ptr()
public opencv_imgproc.LineIterator ptr(BytePointer ptr)
@MemberGetter @Cast(value="const uchar*") public BytePointer ptr0()
public int step()
public opencv_imgproc.LineIterator step(int step)
public int elemSize()
public opencv_imgproc.LineIterator elemSize(int elemSize)
public int err()
public opencv_imgproc.LineIterator err(int err)
public int count()
public opencv_imgproc.LineIterator count(int count)
public int minusDelta()
public opencv_imgproc.LineIterator minusDelta(int minusDelta)
public int plusDelta()
public opencv_imgproc.LineIterator plusDelta(int plusDelta)
public int minusStep()
public opencv_imgproc.LineIterator minusStep(int minusStep)
public int plusStep()
public opencv_imgproc.LineIterator plusStep(int plusStep)
Copyright © 2018. All rights reserved.