Search in sources :

Example 41 with ImageRectangle

use of boofcv.struct.ImageRectangle in project BoofCV by lessthanoptimal.

the class VisualizeTldDetectionApp method drawFerns.

private void drawFerns(Graphics2D g2, int shift) {
    double max = 0;
    double min = Double.MAX_VALUE;
    GrowQueue_F64 value = tracker.getDetection().getStorageMetric();
    java.util.List<ImageRectangle> rects = tracker.getDetection().getStorageRect();
    for (int i = 0; i < value.size; i++) {
        double r = -value.get(i);
        if (r > max) {
            max = r;
        }
        if (r < min) {
            min = r;
        }
    }
    double range = max - min;
    for (int i = 0; i < value.size; i++) {
        double r = value.get(i);
        ImageRectangle rect = rects.get(i);
        int v = (int) (255 * (r - min) / range);
        int rgb = v << shift;
        drawRectangle(g2, rect, new Color(rgb), 3);
    }
}
Also used : ImageRectangle(boofcv.struct.ImageRectangle) GrowQueue_F64(org.ddogleg.struct.GrowQueue_F64)

Example 42 with ImageRectangle

use of boofcv.struct.ImageRectangle in project BoofCV by lessthanoptimal.

the class TestBoofMiscOps method checkBound.

private void checkBound(int x0, int y0, int x1, int y1, int ex0, int ey0, int ex1, int ey1, ImageGray image) {
    ImageRectangle a = new ImageRectangle(x0, y0, x1, y1);
    BoofMiscOps.boundRectangleInside(image, a);
    assertEquals(ex0, a.x0);
    assertEquals(ey0, a.y0);
    assertEquals(ex1, a.x1);
    assertEquals(ey1, a.y1);
}
Also used : ImageRectangle(boofcv.struct.ImageRectangle)

Example 43 with ImageRectangle

use of boofcv.struct.ImageRectangle in project BoofCV by lessthanoptimal.

the class TestBoofMiscOps method checkInside_ImageRectangle.

@Test
public void checkInside_ImageRectangle() {
    GrayU8 image = new GrayU8(20, 25);
    assertTrue(BoofMiscOps.checkInside(image, new ImageRectangle(0, 0, 20, 25)));
    assertTrue(BoofMiscOps.checkInside(image, new ImageRectangle(2, 4, 15, 23)));
    assertFalse(BoofMiscOps.checkInside(image, new ImageRectangle(-1, 0, 20, 25)));
    assertFalse(BoofMiscOps.checkInside(image, new ImageRectangle(0, -1, 20, 25)));
    assertFalse(BoofMiscOps.checkInside(image, new ImageRectangle(0, 0, 21, 25)));
    assertFalse(BoofMiscOps.checkInside(image, new ImageRectangle(0, 0, 20, 26)));
}
Also used : ImageRectangle(boofcv.struct.ImageRectangle) GrayU8(boofcv.struct.image.GrayU8) Test(org.junit.Test)

Aggregations

ImageRectangle (boofcv.struct.ImageRectangle)43 Test (org.junit.Test)15 GrayU8 (boofcv.struct.image.GrayU8)10 IntegralKernel (boofcv.alg.transform.ii.IntegralKernel)3 FactoryGImageGray (boofcv.core.image.FactoryGImageGray)3 GImageGray (boofcv.core.image.GImageGray)3 ImageGray (boofcv.struct.image.ImageGray)3 ImageBorder_S32 (boofcv.core.image.border.ImageBorder_S32)2 Kernel2D_S32 (boofcv.struct.convolve.Kernel2D_S32)2 GrayS32 (boofcv.struct.image.GrayS32)2 Point2D_F32 (georegression.struct.point.Point2D_F32)2 Point2D_F64 (georegression.struct.point.Point2D_F64)2 Point2D_I32 (georegression.struct.point.Point2D_I32)2 Polygon2D_F64 (georegression.struct.shapes.Polygon2D_F64)2 Rectangle2D_F64 (georegression.struct.shapes.Rectangle2D_F64)1 FastQueue (org.ddogleg.struct.FastQueue)1 GrowQueue_F64 (org.ddogleg.struct.GrowQueue_F64)1