/Users/lyon/j4p/src/math/RgbStats.java
|
1 package math;
2
3 import j2d.ShortImageBean;
4
5 import java.awt.*;
6
7 /**
8 * GPL code by DocJava, Inc.
9 * User: lyon
10 * Date: Mar 5, 2003
11 * Time: 4:33:57 PM
12 *
13 */
14 public class RgbStats {
15 private Stats redStats = new Stats();
16 private Stats greenStats = new Stats();
17 private Stats blueStats = new Stats();
18
19 public RgbStats(Image img){
20 ShortImageBean sib = new ShortImageBean(img);
21 getRedStats().initStats(sib.getR());
22 getGreenStats().initStats(sib.getG());
23 getBlueStats().initStats(sib.getB());
24 }
25 public double [] getAverageCmf() {
26 double CMFr[] = redStats.getCMF();
27 double CMFg[] = greenStats.getCMF();
28 double CMFb[] = blueStats.getCMF();
29 return Mat2.getAverage(CMFr, CMFg, CMFb);
30 }
31
32 public Stats getRedStats() {
33 return redStats;
34 }
35
36 public Stats getGreenStats() {
37 return greenStats;
38 }
39
40 public Stats getBlueStats() {
41 return blueStats;
42 }
43 }
44