/Users/lyon/j4p/src/j2d/hpp/EqualizationFilter.java
|
1 /*
2 * Created by DocJava, Inc.
3 * User: lyon
4 * Date: Feb 28, 2003
5 * Time: 7:44:33 AM
6 */
7 package j2d.hpp;
8
9 import math.RgbStats;
10
11 import java.awt.*;
12
13
14 public class EqualizationFilter
15 implements HppFilterInterface {
16 /*
17 short lut[] = tt.getLut();
18 RgbStats rgbStats = new RgbStats(ib.getImage());
19 double averageCmf[] = rgbStats.getAverageCmf();
20 for (short i = 0; i < lut.length; i++)
21 lut[i] = (short) (255 * averageCmf[i]);
22 applyLut(lut);
23 */
24 double averageCmf[] = null;
25
26 public EqualizationFilter(Image img) {
27 RgbStats rgbStats = new RgbStats(img);
28 this.averageCmf = rgbStats.getAverageCmf();
29 }
30
31 public short getR(int r) {
32 return (short) (255 * averageCmf[r]);
33 }
34
35 public short getG(int g) {
36 return getR(g);
37 }
38
39 public short getB(int b) {
40 return getR(b);
41 }
42
43 }
44