use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class DescribePointBinaryCompare method setImage.
/**
* Specifies the image from which feature descriptions are to be created.
*
* @param image Image being examined.
*/
public void setImage(T image) {
this.image = image;
// precompute offsets for faster computing later on
for (int i = 0; i < definition.samplePoints.length; i++) {
Point2D_I32 a = definition.samplePoints[i];
offsets[i] = image.stride * a.y + a.x;
}
for (int i = 0; i < definition.compare.length; i++) {
Point2D_I32 p = definition.compare[i];
offsetsA[i] = offsets[p.x];
offsetsB[i] = offsets[p.y];
}
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class ImplDescribeBinaryCompare_F32 method processBorder.
@Override
public void processBorder(int c_x, int c_y, TupleDesc_B feature) {
Arrays.fill(feature.data, 0);
int index = image.startIndex + image.stride * c_y + c_x;
for (int i = 0; i < definition.compare.length; i += 32) {
int end = Math.min(definition.compare.length, i + 32);
int desc = 0;
for (int j = i; j < end; j++) {
Point2D_I32 c = definition.compare[j];
Point2D_I32 p_a = definition.samplePoints[c.x];
Point2D_I32 p_b = definition.samplePoints[c.y];
if (image.isInBounds(p_a.x + c_x, p_a.y + c_y) && image.isInBounds(p_b.x + c_x, p_b.y + c_y)) {
float valA = image.data[index + offsetsA[j]];
float valB = image.data[index + offsetsB[j]];
desc *= 2;
if (valA < valB) {
desc += 1;
}
}
}
feature.data[i / 32] = desc;
}
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class ImplDescribeBinaryCompare_U8 method processBorder.
@Override
public void processBorder(int c_x, int c_y, TupleDesc_B feature) {
Arrays.fill(feature.data, 0);
int index = image.startIndex + image.stride * c_y + c_x;
for (int i = 0; i < definition.compare.length; i += 32) {
int end = Math.min(definition.compare.length, i + 32);
int desc = 0;
for (int j = i; j < end; j++) {
Point2D_I32 c = definition.compare[j];
Point2D_I32 p_a = definition.samplePoints[c.x];
Point2D_I32 p_b = definition.samplePoints[c.y];
desc *= 2;
if (image.isInBounds(p_a.x + c_x, p_a.y + c_y) && image.isInBounds(p_b.x + c_x, p_b.y + c_y)) {
int valA = image.data[index + offsetsA[j]] & 0xFF;
int valB = image.data[index + offsetsB[j]] & 0xFF;
if (valA < valB) {
desc += 1;
}
}
}
feature.data[i / 32] = desc;
}
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class SplitMergeLineRefine_to_PointsToPolyline method process.
@Override
public boolean process(List<Point2D_I32> input, GrowQueue_I32 vertexes) {
if (!splitMerge.process(input, vertexes)) {
return false;
}
if (refine != null && !refine.fit(input, vertexes)) {
return false;
}
if (pruner != null && pruner.prune(input, vertexes, pruned)) {
vertexes.setTo(pruned);
}
if (vertexes.size > maxVertexes || vertexes.size < minVertexes)
return false;
tmp.vertexes.resize(vertexes.size);
for (int i = 0; i < vertexes.size; i++) {
Point2D_I32 p = input.get(vertexes.get(i));
tmp.set(i, p.x, p.y);
}
return !convex || UtilPolygons2D_F64.isConvex(tmp);
}
use of georegression.struct.point.Point2D_I32 in project BoofCV by lessthanoptimal.
the class BinaryEllipseDetectorPixel method touchesBorder.
protected final boolean touchesBorder(List<Point2D_I32> contour) {
int endX = labeled.width - 1;
int endY = labeled.height - 1;
for (int j = 0; j < contour.size(); j++) {
Point2D_I32 p = contour.get(j);
if (p.x == 0 || p.y == 0 || p.x == endX || p.y == endY) {
return true;
}
}
return false;
}
Aggregations