2 * PROJECT: NyARToolkit
\r
3 * --------------------------------------------------------------------------------
\r
4 * This work is based on the original ARToolKit developed by
\r
7 * HITLab, University of Washington, Seattle
\r
8 * http://www.hitl.washington.edu/artoolkit/
\r
10 * The NyARToolkit is Java version ARToolkit class library.
\r
11 * Copyright (C)2008 R.Iizuka
\r
13 * This program is free software; you can redistribute it and/or
\r
14 * modify it under the terms of the GNU General Public License
\r
15 * as published by the Free Software Foundation; either version 2
\r
16 * of the License, or (at your option) any later version.
\r
18 * This program is distributed in the hope that it will be useful,
\r
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
21 * GNU General Public License for more details.
\r
23 * You should have received a copy of the GNU General Public License
\r
24 * along with this framework; if not, write to the Free Software
\r
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
27 * For further information please contact.
\r
28 * http://nyatla.jp/nyatoolkit/
\r
29 * <airmail(at)ebony.plala.or.jp>
\r
32 package jp.nyatla.nyartoolkit.core.param;
\r
34 import jp.nyatla.nyartoolkit.core.types.NyARDoublePoint2d;
\r
35 import jp.nyatla.nyartoolkit.core.types.*;
\r
37 * 歪み成分マップを使用するINyARCameraDistortionFactor
\r
39 final public class NyARObserv2IdealMap
\r
41 private int _stride;
\r
42 private double[] _mapx;
\r
43 private double[] _mapy;
\r
44 public NyARObserv2IdealMap(NyARCameraDistortionFactor i_distfactor,NyARIntSize i_screen_size)
\r
46 NyARDoublePoint2d opoint=new NyARDoublePoint2d();
\r
47 this._mapx=new double[i_screen_size.w*i_screen_size.h];
\r
48 this._mapy=new double[i_screen_size.w*i_screen_size.h];
\r
49 this._stride=i_screen_size.w;
\r
50 int ptr=i_screen_size.h*i_screen_size.w-1;
\r
52 for(int i=i_screen_size.h-1;i>=0;i--)
\r
54 for(int i2=i_screen_size.w-1;i2>=0;i2--)
\r
56 i_distfactor.observ2Ideal(i2,i, opoint);
\r
57 this._mapx[ptr]=opoint.x;
\r
58 this._mapy[ptr]=opoint.y;
\r
64 public void observ2Ideal(double ix, double iy, NyARDoublePoint2d o_point)
\r
66 int idx=(int)ix+(int)iy*this._stride;
\r
67 o_point.x=this._mapx[idx];
\r
68 o_point.y=this._mapy[idx];
\r
71 public void observ2IdealBatch(int[] i_x_coord, int[] i_y_coord,int i_start, int i_num, double[] o_x_coord,double[] o_y_coord)
\r
75 for (int j = 0; j < i_num; j++) {
\r
76 idx=i_x_coord[i_start + j]+i_y_coord[i_start + j]*this._stride;
\r
77 o_x_coord[ptr]=this._mapx[idx];
\r
78 o_y_coord[ptr]=this._mapy[idx];
\r