Search in sources :

Example 1 with Polygon

use of com.amplifyframework.predictions.models.Polygon in project amplify-android by aws-amplify.

the class RekognitionResultTransformersTest method testPolygonConversion.

/**
 * Tests that the polygonal boundary from Textract in the form
 * of list of points is converted to an Amplify shape for polygons.
 */
@Test
public void testPolygonConversion() {
    List<Point> randomPolygon = randomPolygon();
    Polygon polygon = RekognitionResultTransformers.fromPoints(randomPolygon);
    List<PointF> actualPoints = polygon.getPoints();
    List<PointF> expectedPoints = new ArrayList<>();
    for (Point point : randomPolygon) {
        expectedPoints.add(new PointF(point.getX(), point.getY()));
    }
    assertEquals(expectedPoints, actualPoints);
}
Also used : PointF(android.graphics.PointF) ArrayList(java.util.ArrayList) Point(com.amazonaws.services.rekognition.model.Point) Polygon(com.amplifyframework.predictions.models.Polygon) Test(org.junit.Test)

Example 2 with Polygon

use of com.amplifyframework.predictions.models.Polygon in project amplify-android by aws-amplify.

the class TextractResultTransformersTest method testPolygonConversion.

/**
 * Tests that the polygonal boundary from Textract in the form
 * of list of points is converted to an Amplify shape for polygons.
 */
@Test
public void testPolygonConversion() {
    List<Point> randomPolygon = randomPolygon();
    Polygon polygon = TextractResultTransformers.fromPoints(randomPolygon);
    List<PointF> actualPoints = polygon.getPoints();
    List<PointF> expectedPoints = new ArrayList<>();
    for (Point point : randomPolygon) {
        expectedPoints.add(new PointF(point.getX(), point.getY()));
    }
    assertEquals(expectedPoints, actualPoints);
}
Also used : PointF(android.graphics.PointF) ArrayList(java.util.ArrayList) Point(com.amazonaws.services.textract.model.Point) Polygon(com.amplifyframework.predictions.models.Polygon) Test(org.junit.Test)

Aggregations

PointF (android.graphics.PointF)2 Polygon (com.amplifyframework.predictions.models.Polygon)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 Point (com.amazonaws.services.rekognition.model.Point)1 Point (com.amazonaws.services.textract.model.Point)1