@Test public void testResizeUpscale1() throws Exception { ImageWritable srcImg = TestImageTransform.makeRandomImage(32, 32, 3); ResizeImageTransform transform = new ResizeImageTransform(200, 200); ImageWritable dstImg = transform.transform(srcImg); Frame f = dstImg.getFrame(); assertEquals(f.imageWidth, 200); assertEquals(f.imageHeight, 200); float[] coordinates = {100, 200}; float[] transformed = transform.query(coordinates); assertEquals(200f * 100 / 32, transformed[0], 0); assertEquals(200f * 200 / 32, transformed[1], 0); }
@Override public float[] query(float... coordinates) { float[] transformed = new float[coordinates.length]; for (int i = 0; i < coordinates.length; i += 2) { transformed[i ] = newWidth * coordinates[i ] / srcw; transformed[i + 1] = newHeight * coordinates[i + 1] / srch; } return transformed; }
ResizeImageTransform extends BaseImageTransform<Mat> { @Override public float[] query(float... coordinates) { float[] transformed = new float[coordinates.length]; for (int i = 0; i < coordinates.length; i += 2) { transformed[i ] = newWidth * coordinates[i ] / srcw; transformed[i + 1] = newHeight * coordinates[i + 1] / srch; } return transformed; } }
ResizeImageTransform extends BaseImageTransform<Mat> { @Override public float[] query(float... coordinates) { float[] transformed = new float[coordinates.length]; for (int i = 0; i < coordinates.length; i += 2) { transformed[i ] = newWidth * coordinates[i ] / srcw; transformed[i + 1] = newHeight * coordinates[i + 1] / srch; } return transformed; } ResizeImageTransform(@JsonProperty("newWidth") int newWidth, @JsonProperty("newHeight") int newHeight);  ResizeImageTransform(Random random, int newWidth, int newHeight); }
ResizeImageTransform extends BaseImageTransform<Mat> { @Override public float[] query(float... coordinates) { float[] transformed = new float[coordinates.length]; for (int i = 0; i < coordinates.length; i += 2) { transformed[i ] = newWidth * coordinates[i ] / srcw; transformed[i + 1] = newHeight * coordinates[i + 1] / srch; } return transformed; } ResizeImageTransform(@JsonProperty("newWidth") int newWidth, @JsonProperty("newHeight") int newHeight);  ResizeImageTransform(Random random, int newWidth, int newHeight); @Override float[] query(float... coordinates); }
ResizeImageTransform extends BaseImageTransform<Mat> { @Override public float[] query(float... coordinates) { float[] transformed = new float[coordinates.length]; for (int i = 0; i < coordinates.length; i += 2) { transformed[i ] = newWidth * coordinates[i ] / srcw; transformed[i + 1] = newHeight * coordinates[i + 1] / srch; } return transformed; } ResizeImageTransform(@JsonProperty("newWidth") int newWidth, @JsonProperty("newHeight") int newHeight);  ResizeImageTransform(Random random, int newWidth, int newHeight); @Override float[] query(float... coordinates);  }