public class SmoothMinifier extends Object implements PushbroomScaler
SmoothMinifier downscaler = new SmoothMinifier(sourceWidth, sourceHeight, numBands, destWidth, destHeight); for(int i = 0; i < sourceHeight; i++) { byte[] b = source.getLine(i); if (shrinker.putSourceScanline(b, 0)) { break; } } NIOBuffer destBuf = downscaler.getDestination();The algorithm used calculates the destination sample in each band by averaging over a box centered on the backward mapped location of the destination pixel. The box has dimensions
ceil(sourceWidth/destWidth) x ceil(sourceHeight/destHeight)
.Modifier and Type | Field and Description |
---|---|
protected int[] |
bottomPoints |
protected int |
boxHeight |
protected ByteBuffer |
destBuf |
protected int |
destHeight |
protected int |
destLine |
protected int |
destWidth |
protected int[] |
leftPoints |
protected int |
numBands |
protected int[] |
rightPoints |
protected double |
scaleY |
protected byte[][] |
sourceData |
protected int |
sourceDataLine |
protected int |
sourceHeight |
protected int |
sourceLine |
protected int |
sourceWidth |
protected int[] |
tmpBuf |
protected int[] |
topPoints |
Modifier and Type | Method and Description |
---|---|
ByteBuffer |
getDestination()
Retrieves the destination buffer.
|
boolean |
putSourceScanline(byte[] scanline,
int off)
Push one scanline of source pixels into the downscaling engine.
|
protected int sourceWidth
protected int sourceHeight
protected int numBands
protected int destWidth
protected int destHeight
protected double scaleY
protected ByteBuffer destBuf
protected int boxHeight
protected byte[][] sourceData
protected int[] leftPoints
protected int[] rightPoints
protected int[] topPoints
protected int[] bottomPoints
protected int sourceLine
protected int sourceDataLine
protected int destLine
protected int[] tmpBuf
public ByteBuffer getDestination()
getDestination
in interface PushbroomScaler
public boolean putSourceScanline(byte[] scanline, int off)
putSourceScanline
in interface PushbroomScaler
scanline
- One scanline of source data.off
- The offline into the buffer.IllegalArgumentException
- if off < 0
.Copyright © 2020. All rights reserved.