Search in sources :

Example 16 with Point2D_I32

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];
    }
}
Also used : Point2D_I32(georegression.struct.point.Point2D_I32)

Example 17 with Point2D_I32

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;
    }
}
Also used : Point2D_I32(georegression.struct.point.Point2D_I32)

Example 18 with Point2D_I32

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;
    }
}
Also used : Point2D_I32(georegression.struct.point.Point2D_I32)

Example 19 with Point2D_I32

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);
}
Also used : Point2D_I32(georegression.struct.point.Point2D_I32)

Example 20 with Point2D_I32

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;
}
Also used : Point2D_I32(georegression.struct.point.Point2D_I32)

Aggregations

Point2D_I32 (georegression.struct.point.Point2D_I32)153 Test (org.junit.Test)64 ArrayList (java.util.ArrayList)41 GrowQueue_I32 (org.ddogleg.struct.GrowQueue_I32)21 Point2D_F64 (georegression.struct.point.Point2D_F64)11 EdgeContour (boofcv.alg.feature.detect.edge.EdgeContour)8 GrayF32 (boofcv.struct.image.GrayF32)8 GrayS32 (boofcv.struct.image.GrayS32)7 Contour (boofcv.alg.filter.binary.Contour)6 TupleDesc_F64 (boofcv.struct.feature.TupleDesc_F64)6 GrayU8 (boofcv.struct.image.GrayU8)6 PackedSetsPoint2D_I32 (boofcv.struct.PackedSetsPoint2D_I32)5 RectangleLength2D_I32 (georegression.struct.shapes.RectangleLength2D_I32)5 UtilPoint2D_I32 (georegression.geometry.UtilPoint2D_I32)4 Polygon2D_F64 (georegression.struct.shapes.Polygon2D_F64)4 EdgeSegment (boofcv.alg.feature.detect.edge.EdgeSegment)3 Corner (boofcv.alg.shapes.polyline.splitmerge.PolylineSplitMerge.Corner)3 FactoryDescribeImageDense (boofcv.factory.feature.dense.FactoryDescribeImageDense)3 PointIndex_I32 (boofcv.struct.PointIndex_I32)3 LineGeneral2D_F64 (georegression.struct.line.LineGeneral2D_F64)3