1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
// blur.
float ninth = 1.f/9.0f;
float blurKernel = {
ninth, ninth, ninth,
ninth, ninth, ninth,
ninth, ninth, ninth
};
ConvolOp blurOp = new ConvoleOp( new Kernel(3, 3, blurKernel), ConvoleOp.EDGE_NO_OP, null);
// Edge detect.
float edgeKernel = {
0f, -1f, 0f,
-1f, 4f, -1f,
0f, -1f, 0f
};
ConvoleOp edgeOp = new ConvoleOp(new Kernet(3, 3, edgeKernel), ConvoleOp.EDGE_NO_OP, null);
// Sharpen.
float sharpKernel = {
0f, -1f, 0f,
-1f, 5f, -1f,
0f, -1f, 0f
};
ConvoleOp edgeOp = new ConvoleOp(new Kernet(3, 3, sharpKernel));
short brightenTable = new short[256];
short betterBrightenTable = new short[256];
short posterizeTable = new short[256];
short invertTable = new short[256];
short straightTable = new short[256];
short zeroTable = new short[256];
for (in i = 0; i < 256 ; i++) {
brightenTable[i] = (short) (128 + i/2);
betterBrightenTable[i] = (short) (Math.sqrt((double) i / 255.0) * 255.0);
posterizeTable[i] = (short) (i- (i % 32));
invertTable[i] = (short) (255 - i);
straightTable[i] = (short) i;
zeroTable[i] = (short) 0;
}
// Toutes couleurs.
LookupOp brightenOp = new LookupOp(new ShortLookupTable(0, brightenTable), null);
LookupOp betterBrightenOp = new LookupOp(new ShortLookupTable(0, betterBrightenTable), null);
LookupOp posterizeOp = new LookupOp(new ShortLookupTable(0, posterizeTable), null);
LookupOp invertOp = new LookupOp(new ShortLookupTable(0, invertTable), null);
// Uniquement sur certaines channels.
short[][] redOnlyInvertTable = {invertTable, straightTable, straightTable};
short[][] greenOnlyInvertTable = {straightTable, invertTable, straightTable};
short[][] greeOnlyInvertTable = {straightTable, straightTable, invertTable};
LookupOp redOnlyInvertOp = new LookupOp(new ShortLookupTable(0, redOnlyInvertTable), null);
LookupOp greenOnlyInvertOp = new LookupOp(new ShortLookupTable(0, greenOnlyInvertTable), null);
LookupOp blueOnlyInvertOp = new LookupOp(new ShortLookupTable(0, blueOnlyInvertTable), null);
short[][] redOnlyRemoveTable = {zeroTable, straightTable, straightTable};
short[][] greenOnlyRemoveTable = {straightTable, zeroTable, straightTable};
short[][] greeOnlyRemoveTable = {straightTable, straightTable, zeroTable};
LookupOp redOnlyRemoveOp = new LookupOp(new ShortLookupTable(0, redOnlyRemoveTable), null);
LookupOp greenOnlyRemoveOp = new LookupOp(new ShortLookupTable(0, greenOnlyRemoveTable), null);
LookupOp blueOnlyRemoveOp = new LookupOp(new ShortLookupTable(0, blueOnlyRemoveTable), null);
RescaleOp rescale_0_5 = new RescaleOp(.5f, 0, null);
.... |
Partager