* @param expandImages
* @return
*/
public BufferedImage[] getLaplacianPyramid(BufferedImage[] reduceImages) {
BufferedImage[] laplaciImages = new BufferedImage[reduceImages.length -1];
for(int i=1; i
laplaciImages[i-1] = createCompatibleDestImage(expandImage, null);
int width = reduceImages[i-1].getWidth();
int height = reduceImages[i-1].getHeight();
int ewidth = expandImage.getWidth();
width = (width > ewidth) ewidth : width;
height = (height > expandImage.getHeight()) expandImage.getHeight():height;
System.out.println(" width = " + width + " expand width = " + ewidth);
int[] reducePixels = new int[width*height];
int[] expandPixels = new int[width*height];
int[] laPixels = new int[width*height];
getRGB( reduceImages[i-1], 0, 0, width, height, reducePixels);
getRGB( expandImage, 0, 0, width, height, expandPixels );
int index = 0;
int er = 0, eg = 0, eb = 0;
for(int row=0; row
for(int col=0; col
ta = (reducePixels[index] >> 24) & 0xff;
tr = (reducePixels[index] >> 16) & 0xff;
tg = (reducePixels[index] >> 8) & 0xff;
tb = reducePixels[index] & 0xff;
ta = (expandPixels[index] >> 24) & 0xff;
er = (expandPixels[index] >> 16) & 0xff;
eg = (expandPixels[index] >> 8) & 0xff;
eb = expandPixels[index] & 0xff;
tr = tr - er;
tg = tg - eg;
tb = tb - eb;
laPixels[index] = (ta << 24) | (clamp(tr) << 16) | (clamp(tg) << 8) | clamp(tb);
}
setRGB( laplaciImages[i-1], 0, 0, width, height, laPixels );
}
return laplaciImages;
}
private BufferedImage pyramidReduce(BufferedImage src) {
int width = src.getWidth();
int height = src.getHeight();
BufferedImage dest = createSubCompatibleDestImage(src, null);
int[] inPixels = new int[width*height];
int ow = width/2;
int oh = height/2;
int[] outPixels = new int[ow*oh];
getRGB(src, 0, 0, width, height, inPixels );
int inRow=0, inCol = 0, index = 0, oudex =0, ta = 0;
float[][] keneralData = this.getHVGaussianKeneral();
for(int row=0; row
inCol = 2* col;
if(inRow >= height) {
inRow = 0;
}
if(inCol >= width) {
inCol = 0;
}
float sumRed = 0, sumGreen = 0, sumBlue = 0;
for(int subRow = -2; subRow <= 2; subRow++) {
int inRowOff = inRow + subRow;
if(inRowOff >= height || inRowOff < 0) {
inRowOff = 0;
}
for(int subCol = -2; subCol <= 2; subCol++) {
int inColOff = inCol + subCol;
if(inColOff >= width || inColOff < 0) {
inColOff = 0;
}
index = inRowOff * width + inColOff;
ta = (inPixels[index] >> 24) & 0xff;
int red = (inPixels[index] >> 16) & 0xff;
int green = (inPixels[index] >> 8) & 0xff;
int blue = inPixels[index] & 0xff;
sumRed += keneralData[subRow + 2][subCol + 2] * red;
sumGreen += keneralData[subRow + 2][subCol