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);
}
}
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);
}
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)));
}
Aggregations