本文整理汇总了Java中java.awt.image.ShortLookupTable类的典型用法代码示例。如果您正苦于以下问题:Java ShortLookupTable类的具体用法?Java ShortLookupTable怎么用?Java ShortLookupTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ShortLookupTable类属于java.awt.image包,在下文中一共展示了ShortLookupTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doTransform
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
@Override
public BufferedImage doTransform(BufferedImage src, BufferedImage dest) {
float cr = cyanRed.getValueAsFloat();
float mg = magentaGreen.getValueAsFloat();
float yb = yellowBlue.getValueAsFloat();
if ((cr == 0) && (mg == 0) && (yb == 0)) {
return src;
}
int affect = affectParam.getValue();
RGBLookup rgbLookup = new LookupCalculator(cr, mg, yb, affect).getLookup();
BufferedImageOp filterOp = new FastLookupOp((ShortLookupTable) rgbLookup.getLookupOp());
filterOp.filter(src, dest);
return dest;
}
示例2: toInverseVideo
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
/**
* For testing lookup tables
*/
public static Image toInverseVideo(Image source) {
//
BufferedImage src = new BufferedImage(source.getWidth(null), source
.getHeight(null), BufferedImage.TYPE_INT_ARGB);
Graphics g = src.getGraphics();
g.drawImage(source, 0, 0, null);
//
short[][] lookup = new short[4][256];
for (int c = 0; c < 4; c++) {
for (short b = 0; b < 256; b++) {
if (c == 3)
lookup[c][b] = b;
else
lookup[c][b] = (short)(255 - b);
}
}
LookupTable table = new ShortLookupTable(0, lookup);
LookupOp op = new LookupOp (table, null);
return op.filter(src, null);
}
示例3: gammaCorrection
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
/**
* Corrección gamma. Si 0 menor_que gamma menor_que 1 ilumina, si
* gamma_mayor_que 1 oscurece
*
* @param cteA double
* @param gamma double
* @return LookupTable
*/
public static LookupTable gammaCorrection(double cteA, double gamma) {
if (gamma <= 0) {
return null;
}
// K: constante de normalización
double K = ((double) MAX_LEVEL) / (cteA * Math.pow(((double) MAX_LEVEL), gamma));
short lt[] = new short[MAX_LEVEL + 1];
for (int l = 0; l <= MAX_LEVEL; l++) {
lt[l] = (short) (K * cteA * Math.pow((double) l, gamma));
}
ShortLookupTable slt = new ShortLookupTable(0, lt);
if (ECHO) {
plot(lt);
}
return slt;
}
示例4: invertImage
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
private static BufferedImage invertImage(final BufferedImage src) {
final int w = src.getWidth();
final int h = src.getHeight();
final BufferedImage dst = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
final BufferedImageOp invertOp = new LookupOp(new ShortLookupTable(0, invertTable), null);
return invertOp.filter(src, dst);
}
示例5: doTransform
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
@Override
public BufferedImage doTransform(BufferedImage src, BufferedImage dest) {
int numLevels = levels.getValue();
RGBLookup rgbLookup = new RGBLookup();
rgbLookup.initFromPosterize(numLevels);
BufferedImageOp filterOp = new FastLookupOp((ShortLookupTable) rgbLookup.getLookupOp());
filterOp.filter(src, dest);
return dest;
}
示例6: colorExtractChannel
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
private static BufferedImage colorExtractChannel(BufferedImage src, BufferedImage dest, int channel) {
LookupTable lookupTable;
switch (channel) {
case RED_CHANNEL:
lookupTable = LookupFactory.createLookupForOnlyRed();
break;
case REMOVE_RED_CHANNEL:
lookupTable = LookupFactory.createLookupForRemoveRed();
break;
case GREEN_CHANNEL:
lookupTable = LookupFactory.createLookupForOnlyGreen();
break;
case REMOVE_GREEN_CHANNEL:
lookupTable = LookupFactory.createLookupForRemoveGreen();
break;
case BLUE_CHANNEL:
lookupTable = LookupFactory.createLookupForOnlyBlue();
break;
case REMOVE_BLUE_CHANNEL:
lookupTable = LookupFactory.createLookupForRemoveBlue();
break;
default:
throw new IllegalStateException("should not het here");
}
BufferedImageOp filterOp = new FastLookupOp((ShortLookupTable) lookupTable);
filterOp.filter(src, dest);
return dest;
}
示例7: createLookupForRemoveRed
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
public static LookupTable createLookupForRemoveRed() {
short[][] lookupData = new short[3][256];
lookupData[0] = getNullMapping();
lookupData[1] = getDefaultMapping();
lookupData[2] = getDefaultMapping();
return new ShortLookupTable(0, lookupData);
}
示例8: createLookupForOnlyRed
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
public static LookupTable createLookupForOnlyRed() {
short[][] lookupData = new short[3][256];
lookupData[0] = getDefaultMapping();
lookupData[1] = getNullMapping();
lookupData[2] = getNullMapping();
return new ShortLookupTable(0, lookupData);
}
示例9: createLookupForRemoveGreen
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
public static LookupTable createLookupForRemoveGreen() {
short[][] lookupData = new short[3][256];
lookupData[0] = getDefaultMapping();
lookupData[1] = getNullMapping();
lookupData[2] = getDefaultMapping();
return new ShortLookupTable(0, lookupData);
}
示例10: createLookupForOnlyGreen
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
public static LookupTable createLookupForOnlyGreen() {
short[][] lookupData = new short[3][256];
lookupData[0] = getNullMapping();
lookupData[1] = getDefaultMapping();
lookupData[2] = getNullMapping();
return new ShortLookupTable(0, lookupData);
}
示例11: createLookupForRemoveBlue
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
public static LookupTable createLookupForRemoveBlue() {
short[][] lookupData = new short[3][256];
lookupData[0] = getDefaultMapping();
lookupData[1] = getDefaultMapping();
lookupData[2] = getNullMapping();
return new ShortLookupTable(0, lookupData);
}
示例12: createLookupForOnlyBlue
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
public static LookupTable createLookupForOnlyBlue() {
short[][] lookupData = new short[3][256];
lookupData[0] = getNullMapping();
lookupData[1] = getNullMapping();
lookupData[2] = getDefaultMapping();
return new ShortLookupTable(0, lookupData);
}
示例13: createLookupFrom3Arrays
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
public static LookupTable createLookupFrom3Arrays(short[] redMappings, short[] greenMappings, short[] blueMappings) {
short[][] lookupData = new short[3][256];
lookupData[0] = redMappings;
lookupData[1] = greenMappings;
lookupData[2] = blueMappings;
return new ShortLookupTable(0, lookupData);
}
示例14: transform
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
@Override
public BufferedImage transform(BufferedImage src, BufferedImage dest) {
if (rgbLookup == null) {
throw new IllegalStateException("rgbLookup not initialized in DynamicLookupOp");
}
BufferedImageOp filterOp = new FastLookupOp((ShortLookupTable) rgbLookup.getLookupOp());
filterOp.filter(src, dest);
return dest;
}
示例15: buildLookupOpTab
import java.awt.image.ShortLookupTable; //导入依赖的package包/类
private void buildLookupOpTab(JTabbedPane tabbedPane) {
BufferedImage dstImage = null;
short[] data = new short[256];
for (int i = 0; i < 256; i++) {
data[i] = (short) (255 - i);
}
LookupTable lookupTable = new ShortLookupTable(0, data);
LookupOp op = new LookupOp(lookupTable, null);
dstImage = op.filter(sourceImage, null);
tabbedPane.add("Lookup", new JLabel(new ImageIcon(dstImage)));
}