sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johann Sorel (Jira)" <j...@apache.org>
Subject [jira] [Created] (SIS-495) Resampling trims one pixel when transform is identity and interpolation is nearest
Date Thu, 04 Jun 2020 07:37:00 GMT
Johann Sorel created SIS-495:
--------------------------------

             Summary: Resampling trims one pixel when transform is identity and interpolation
is nearest
                 Key: SIS-495
                 URL: https://issues.apache.org/jira/browse/SIS-495
             Project: Spatial Information Systems
          Issue Type: Bug
            Reporter: Johann Sorel
            Assignee: Martin Desruisseaux


The new resample removes the right most pixel when transform is identity and interpolation
is set to nearest.

 

Test case :
{code:java}
    /**
     * Tests resample with an identity transform and a coverage extent change.
     *
     * @throws TransformException if some coordinates can not be transformed to the target
grid geometry.
     */
    @Test
    @Ignore
    public void testExtentIdentity() throws TransformException {        final CoordinateReferenceSystem
crs = CommonCRS.WGS84.normalizedGeographic();
        final BufferedImage image = new BufferedImage(2, 2, BufferedImage.TYPE_BYTE_GRAY);
        final WritablePixelIterator ite = WritablePixelIterator.create(image);
        for (int x = 0; x < 2; x++) {
            for (int y = 0; y < 2; y++) {
                ite.moveTo(x, y);
                ite.setSample(0, 10);
            }
        }        final AffineTransform2D gridToCrs = new AffineTransform2D(1, 0, 0, -1, 0,
0);        final GridCoverageBuilder gcb = new GridCoverageBuilder();
        gcb.setValues(image);
        gcb.setDomain(new GridGeometry(null, CELL_CENTER, gridToCrs, crs));
        final GridCoverage coverage = gcb.build();        GridGeometry targetGrid = new GridGeometry(new
GridExtent(4, 4), CELL_CENTER, gridToCrs, crs);        final GridCoverage target = resample(coverage,
targetGrid);
        Raster data = target.render(null).getData();        Assert.assertEquals(10, data.getSample(0,
0, 0));
        Assert.assertEquals(10, data.getSample(1, 0, 0));
        Assert.assertEquals( 0, data.getSample(2, 0, 0));
        Assert.assertEquals( 0, data.getSample(3, 0, 0));
        Assert.assertEquals(10, data.getSample(0, 1, 0));
        Assert.assertEquals(10, data.getSample(1, 1, 0));
        Assert.assertEquals( 0, data.getSample(2, 1, 0));
        Assert.assertEquals( 0, data.getSample(3, 1, 0));
        Assert.assertEquals( 0, data.getSample(0, 2, 0));
        Assert.assertEquals( 0, data.getSample(1, 2, 0));
        Assert.assertEquals( 0, data.getSample(2, 2, 0));
        Assert.assertEquals( 0, data.getSample(3, 2, 0));
    }{code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message