2 * PROJECT: NyARToolkit(Extension)
\r
3 * --------------------------------------------------------------------------------
\r
4 * The NyARToolkit is Java edition ARToolKit class library.
\r
5 * Copyright (C)2008-2009 Ryo Iizuka
\r
7 * This program is free software: you can redistribute it and/or modify
\r
8 * it under the terms of the GNU General Public License as published by
\r
9 * the Free Software Foundation, either version 3 of the License, or
\r
10 * (at your option) any later version.
\r
12 * This program is distributed in the hope that it will be useful,
\r
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 * GNU General Public License for more details.
\r
17 * You should have received a copy of the GNU General Public License
\r
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
\r
20 * For further information please contact.
\r
21 * http://nyatla.jp/nyatoolkit/
\r
22 * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
\r
25 package jp.nyatla.nyartoolkit.core.rasterfilter;
\r
27 import jp.nyatla.nyartoolkit.NyARException;
\r
30 * 色調テーブルを使用したフィルターです。
\r
31 * 基本的な関数テーブルで色調テーブルを作成できます。
\r
33 public class NyARRasterFilter_ToneTable extends NyARRasterFilter_CustomToneTable
\r
35 public NyARRasterFilter_ToneTable(int i_raster_type) throws NyARException
\r
37 super(i_raster_type);
\r
40 * 点x,yを通過する、傾きi_aの直線をテーブルに書き込みます。
\r
45 public void setLine(int i_x,int i_y,double i_a)
\r
49 for(i=0;i<=i_x;i++){
\r
56 int b=i_y-(int)(i_a*i_x);
\r
57 for(int i=0;i<256;i++){
\r
58 int v=(int)(i_a*i)+b;
\r
59 this.table[i]=v<0?0:v>255?255:v;
\r
64 * 点0,0を通過する、傾きaの直線をテーブルに書き込みます。
\r
65 * i_aの値をvとしたとき、以下のようになります。
\r
74 public void setLine(double i_a)
\r
79 * 点 i_x,i_yを中心とする、ゲインi_gainのシグモイド関数をテーブルに書き込みます。
\r
84 public void setSigmoid(int i_x,int i_y,double i_gain)
\r
86 for(int i=0;i<256;i++){
\r
87 int v=255*(int)(1/(1+Math.exp(i_gain*(i-i_x)))-0.5)+i_y;
\r
88 this.table[i]=v<0?0:v>255?255:v;
\r
92 * ガンマ補正値をテーブルに書き込みます。
\r
95 public void setGamma(double i_gamma)
\r
97 for(int i=0;i<256;i++){
\r
98 this.table[i]=(int)(Math.pow((double)i/255.0,i_gamma)*255.0);
\r