{\r
public final static int DIRECTION_UNKNOWN=-1;\r
public int direction;\r
- public NyARLinear[] line = new NyARLinear[4];\r
- public NyARDoublePoint2d[] sqvertex = new NyARDoublePoint2d[4];\r
- public NyARIntPoint2d[] imvertex = new NyARIntPoint2d[4];\r
- public NyARSquare()\r
- {\r
- this.direction=DIRECTION_UNKNOWN;\r
- for(int i=0;i<4;i++){\r
- this.sqvertex[i]=new NyARDoublePoint2d();\r
- this.imvertex[i]=new NyARIntPoint2d();\r
- this.line[i]=new NyARLinear();\r
- }\r
- }\r
+ public NyARLinear[] line = NyARLinear.createArray(4);\r
+ public NyARDoublePoint2d[] sqvertex = NyARDoublePoint2d.createArray(4);\r
+ public NyARIntPoint2d[] imvertex = NyARIntPoint2d.createArray(4);\r
+ public NyARSquare()\r
+ {\r
+ for (int i = 0; i < 4; i++)\r
+ {\r
+ this.line[i] = new NyARLinear();\r
+ }\r
+ }\r
+\r
}
\ No newline at end of file
*/\r
public class NyARMatchPattDeviationColorData\r
{\r
- private int _data[];\r
+ private int[] _data;\r
private double _pow;\r
//\r
private int _number_of_pixels;\r
* \r
*/\r
package jp.nyatla.nyartoolkit.core.match;\r
-\r
+/**\r
+ * [[Strage class]]\r
+ *\r
+ */\r
public class NyARMatchPattResult\r
{\r
public double confidence;\r
\r
private final NyARMat __get_cpara_a = new NyARMat(8, 8);\r
private final NyARMat __get_cpara_b = new NyARMat(8, 1);\r
- private final double[][] __get__cpara_world = {{ 100.0, 100.0 }, { 100.0 + 10.0, 100.0 }, { 100.0 + 10.0, 100.0 + 10.0 },{ 100.0, 100.0 + 10.0 } };\r
+ private final static double[][] __get__cpara_world = {{ 100.0, 100.0 }, { 100.0 + 10.0, 100.0 }, { 100.0 + 10.0, 100.0 + 10.0 },{ 100.0, 100.0 + 10.0 } };\r
\r
final protected boolean get_cpara(final NyARIntPoint2d[] i_vertex, NyARMat o_para)throws NyARException\r
{\r
- double[][] world = this.__get__cpara_world;\r
+ double[][] world = __get__cpara_world;\r
NyARMat a = __get_cpara_a;// 次処理で値を設定するので、初期化不要// new NyARMat( 8, 8 );\r
double[][] a_array = a.getArray();\r
NyARMat b = __get_cpara_b;// 次処理で値を設定するので、初期化不要// new NyARMat( 8, 1 );\r
private NyARBufferReader _buf_reader;\r
private NyARIntSize _size;\r
private NyARRgbPixelReader_INT1D_X8R8G8B8_32 _pixelreader;\r
- private double _edge_percent;\r
\r
public NyARColorPatt_O3(int i_width, int i_height)\r
{\r
this._patdata = new int[i_height*i_width];\r
this._buf_reader=new NyARBufferReader(this._patdata,NyARBufferReader.BUFFERFORMAT_INT1D_X8R8G8B8_32);\r
this._pixelreader=new NyARRgbPixelReader_INT1D_X8R8G8B8_32(this._patdata,this._size);\r
- this._edge_percent=50.0/100;\r
}\r
public int getWidth()\r
{\r
*/\r
private boolean get_cpara(final NyARIntPoint2d[] i_vertex, NyARMat o_para)throws NyARException\r
{\r
- int[][] world = this.wk_pickFromRaster_world;\r
+ int[][] world = wk_pickFromRaster_world;\r
NyARMat a = wk_get_cpara_a;// 次処理で値を設定するので、初期化不要// new NyARMat( 8, 8 );\r
double[][] a_array = a.getArray();\r
NyARMat b = wk_get_cpara_b;// 次処理で値を設定するので、初期化不要// new NyARMat( 8, 1 );\r
}\r
\r
// private final double[] wk_pickFromRaster_para=new double[9];//[3][3];\r
- private final int[][] wk_pickFromRaster_world = {// double world[4][2];\r
+ private final static int[][] wk_pickFromRaster_world = {// double world[4][2];\r
{ 100, 100 }, { 100 + 10, 100 }, { 100 + 10, 100 + 10 }, { 100, 100 + 10 } };\r
\r
\r
this.__updateExtpat_rgbset=new int[i_xdiv*i_ydiv*3];\r
}\r
return;\r
- } \r
+ }\r
+ private static double LT_POS=102.5;\r
+ private static double SQ_SIZE=5.0;\r
\r
//分割数16未満になると少し遅くなるかも。\r
private void updateExtpat(INyARRgbRaster image, NyARMat i_cpara, int i_xdiv2,int i_ydiv2) throws NyARException\r
\r
//ワークバッファの準備\r
reservWorkBuffers(xdiv,ydiv);\r
- final double xw[]=this.__updateExtpat_xw;\r
- final double yw[]=this.__updateExtpat_yw;\r
+ final double[] xw=this.__updateExtpat_xw;\r
+ final double[] yw=this.__updateExtpat_yw;\r
final int[] xc=this.__updateExtpat_xc;\r
final int[] yc=this.__updateExtpat_yc;\r
int[] rgb_set = this.__updateExtpat_rgbset;\r
//xw,ywマップを作成\r
reciprocal= 1.0 / i_xdiv2;\r
for(i=xdiv-1;i>=0;i--){\r
- xw[i]=100 + 10.0 * (ix*xdiv+i + 0.5) * reciprocal;\r
+ xw[i]=LT_POS + SQ_SIZE * (ix*xdiv+i + 0.5) * reciprocal;\r
}\r
reciprocal= 1.0 / i_ydiv2;\r
for(i=ydiv-1;i>=0;i--){\r
- yw[i]=100 + 10.0 * (iy*ydiv+i + 0.5) * reciprocal;\r
+ yw[i]=LT_POS + SQ_SIZE * (iy*ydiv+i + 0.5) * reciprocal;\r
}\r
//1ピクセルを構成するピクセル座標の集合をxc,yc配列に取得\r
int number_of_pix=0;\r
{\r
this._size= i_size;\r
}\r
- public INyARRgbPixelReader getRgbPixcelReader() throws NyARException\r
+ public INyARRgbPixelReader getRgbPixelReader() throws NyARException\r
{\r
NyARException.notImplement();\r
return null;\r
public double rise;//y軸の増加量\r
public double run;//x軸の増加量\r
public double intercept;//切片\r
+ public static NyARLinear[] createArray(int i_number)\r
+ {\r
+ NyARLinear[] ret=new NyARLinear[i_number];\r
+ for(int i=0;i<i_number;i++)\r
+ {\r
+ ret[i]=new NyARLinear();\r
+ }\r
+ return ret;\r
+ } \r
public final void copyFrom(NyARLinear i_source)\r
{\r
this.rise=i_source.rise;\r
+/* \r
+ * PROJECT: NyARToolkit\r
+ * --------------------------------------------------------------------------------\r
+ * This work is based on the original ARToolKit developed by\r
+ * Hirokazu Kato\r
+ * Mark Billinghurst\r
+ * HITLab, University of Washington, Seattle\r
+ * http://www.hitl.washington.edu/artoolkit/\r
+ *\r
+ * The NyARToolkit is Java version ARToolkit class library.\r
+ * Copyright (C)2008 R.Iizuka\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ * \r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this framework; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+ * \r
+ * For further information please contact.\r
+ * http://nyatla.jp/nyatoolkit/\r
+ * <airmail(at)ebony.plala.or.jp>\r
+ * \r
+ */\r
package jp.nyatla.nyartoolkit.core.types.matrix;\r
\r
\r
final double p=i_left[i][i2]*s;\r
dest_l_n[i2]=dest_l_n[i2]-p;\r
}\r
- final double p=i_right[i]*s;\r
- i_right[solve_row]=i_right[solve_row]-p;\r
+ final double k=i_right[i]*s;\r
+ i_right[solve_row]=i_right[solve_row]-k;\r
\r
}\r
//消去法の実行(割り算)\r
return;//未実装一号\r
}\r
\r
-\r
- private int createHistgram(INyARBufferReader i_reader,NyARIntSize i_size, int[] o_histgram) throws NyARException\r
+ private int[] _histgram_buf=new int[256];\r
+ public void analyzeRaster(INyARRaster i_input) throws NyARException\r
{\r
- //最大画像サイズの制限\r
- assert i_size.w*i_size.h<0x40000000;\r
+ final INyARBufferReader buffer_reader=i_input.getBufferReader(); \r
+ assert (buffer_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GLAY_8));\r
\r
- int[] histgram = o_histgram;\r
+ final int[] histgram = this._histgram_buf;\r
+ final NyARIntSize size=i_input.getSize();\r
\r
- //ヒストグラム作成 \r
+ //最大画像サイズの制限\r
+ assert size.w*size.h<0x40000000;\r
+\r
+ //ヒストグラム初期化\r
for (int i = 0; i < 256; i++) {\r
- o_histgram[i] = 0;\r
+ histgram[i] = 0;\r
}\r
- int sum_of_pixel=this._histgram.createHistgramImpl(i_reader, i_size, o_histgram);\r
+ int sum_of_pixel=this._histgram.createHistgramImpl(i_input.getBufferReader(), size, histgram);\r
\r
// 閾値ピクセル数確定\r
final int th_pixcels = sum_of_pixel * this._persentage / 100;\r
}\r
}\r
// 閾値の保存\r
- return (th_w + th_b) / 2;\r
- }\r
-\r
- public void analyzeRaster(INyARRaster i_input) throws NyARException\r
- {\r
- final INyARBufferReader buffer_reader=i_input.getBufferReader(); \r
- assert (buffer_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GLAY_8));\r
-\r
- int[] histgram = new int[256];\r
- // 閾値の基準値を出す。\r
- this._threshold = createHistgram(buffer_reader,i_input.getSize(), histgram);\r
- return;\r
- }\r
-\r
- /**\r
- * ヒストグラムをラスタに書き出す。\r
- * \r
- * @param i_output\r
- */\r
- public void debugDrawHistgramMap(INyARRaster i_input, INyARRaster i_output) throws NyARException\r
- {\r
- INyARBufferReader in_buffer_reader=i_input.getBufferReader(); \r
- INyARBufferReader out_buffer_reader=i_output.getBufferReader(); \r
- assert (in_buffer_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GLAY_8));\r
- assert (out_buffer_reader.isEqualBufferType(INyARBufferReader.BUFFERFORMAT_INT1D_GLAY_8));\r
-\r
- NyARIntSize size = i_output.getSize();\r
-\r
- int[] out_buf = (int[]) out_buffer_reader.getBuffer();\r
- // 0で塗りつぶし\r
- for (int y = 0; y < size.h; y++) {\r
- for (int x = 0; x < size.w; x++) {\r
- out_buf[y* size.w+x] = 0;\r
- }\r
- }\r
- // ヒストグラムを計算\r
- int[] histgram = new int[256];\r
- int threshold = createHistgram(in_buffer_reader,i_input.getSize(), histgram);\r
- for (int i = 255; i > 0; i--) {\r
- histgram[i] = Math.abs(histgram[i]);\r
- }\r
-\r
- // ヒストグラムの最大値を出す\r
- int max_v = 0;\r
- for (int i = 0; i < 255; i++) {\r
- if (max_v < histgram[i]) {\r
- max_v = histgram[i];\r
- }\r
- }\r
- // 目盛り\r
- for (int i = 0; i < size.h; i++) {\r
- out_buf[i* size.w+0] = 128;\r
- out_buf[i* size.w+128] = 128;\r
- out_buf[i* size.w+255] = 128;\r
- }\r
- // スケーリングしながら描画\r
- for (int i = 0; i < 255; i++) {\r
- out_buf[(histgram[i] * (size.h - 1) / max_v)* size.w+i] = 255;\r
- }\r
- // 値\r
- for (int i = 0; i < size.h; i++) {\r
- out_buf[i* size.w+threshold] = 255;\r
- }\r
+ this._threshold = (th_w + th_b) / 2;\r
return;\r
}\r
-\r
public int getThreshold()\r
{\r
return this._threshold;\r
package jp.nyatla.nyartoolkit.nyidmarker;\r
\r
/**\r
+ * [[Strage class]]\r
* マーカを抽出した時のパラメータを格納するクラスです。\r
*\r
*/\r
*/\r
package jp.nyatla.nyartoolkit.nyidmarker;\r
/**\r
+ * [[Strage class]]\r
* IDマーカパターン値を格納するクラスです。\r
* クラスは、未整形のマーカデータを格納しています。\r
*\r
for(int i=0;i<10;i++){\r
freq_count_table[i]=0;\r
}\r
- final int freq_table[]=this._freq_table;\r
+ final int[] freq_table=this._freq_table;\r
for(int i=0;i<110;i++){\r
freq_table[i]=0;\r
}\r
} \r
\r
class THighAndLow{\r
- int h;\r
- int l;\r
+ public int h;\r
+ public int l;\r
}\r
/**\r
* ピクセル配列の上位、下位の4ピクセルのピクセル値平均を求めます。\r
private int detectDataBitsIndex(PerspectivePixelReader.TThreshold i_th,double[] o_index_row,double[] o_index_col) throws NyARException\r
{\r
//周波数を測定\r
- final int freq_index1[]=this.__detectDataBitsIndex_freq_index1;\r
- final int freq_index2[]=this.__detectDataBitsIndex_freq_index2;\r
+ final int[] freq_index1=this.__detectDataBitsIndex_freq_index1;\r
+ final int[] freq_index2=this.__detectDataBitsIndex_freq_index2;\r
\r
\r
int frq_t=getRowFrequency(i_th.lt_y,i_th.th_h,i_th.th_l,freq_index1);\r
case 4:\r
case 5:\r
case 6:\r
- case 7:\r
+ case 7:\r
+ default:\r
+ break;\r
}\r
return -1;\r
}\r
case 4:\r
case 5:\r
case 6:\r
- case 7:\r
+ case 7:\r
+ default:\r
+ break;\r
}\r
return -1;\r
}\r
*/\r
package jp.nyatla.nyartoolkit.nyidmarker.data;\r
\r
-\r
+/**\r
+ * \r
+ * [[Strage class]]\r
+ *\r
+ */\r
public interface INyIdMarkerData\r
{\r
/**\r
public class NyIdMarkerDataEncoder_RawBit implements INyIdMarkerDataEncoder\r
{ \r
private final static int _DOMAIN_ID=0;\r
- private final static int _mod_data[]={7,31,127,511,2047,4095};\r
+ private final static int[] _mod_data={7,31,127,511,2047,4095};\r
public boolean encode(NyIdMarkerPattern i_data,INyIdMarkerData o_dest)\r
{\r
final NyIdMarkerData_RawBit dest=(NyIdMarkerData_RawBit)o_dest;\r
*/\r
package jp.nyatla.nyartoolkit.nyidmarker.data;\r
\r
+/**\r
+ * [[Strage class]]\r
+ *\r
+ */\r
public class NyIdMarkerData_RawBit implements INyIdMarkerData\r
{\r
public int[] packet=new int[22];\r
return (int) Math.sqrt((lx1 * lx1) + (ly1 * ly1)) * (int) Math.sqrt(((lx2 * lx2) + (ly2 * ly2)));\r
}\r
\r
- private INyARColorPatt _patt1 = new NyARColorPatt_O3(64, 64);\r
+ private INyARColorPatt _patt1 = new NyARColorPatt_O3(16, 16);\r
\r
private INyARColorPatt _patt2 = new NyARColorPatt_Perspective(100,100);\r
\r
g2.drawRect(this._patt3.vertex_x[i]-1,this._patt3.vertex_y[i]-1, 2, 2);\r
}\r
*/ g2.setColor(Color.red);\r
- for (int i = 0; i <4; i++) {\r
- g2.drawRect(this._patt3.vertex2_x[i]-1,this._patt3.vertex2_y[i]-1, 2, 2);\r
- }\r
}\r
g.drawImage(sink, ins.left + 320, ins.top, 128, 128, null);\r
g.drawImage(sink2, ins.left + 320, ins.top + 128, 400, 400, null);\r
Image img = b2i.createImage(i_buffer);\r
g.drawImage(img, ins.left, ins.top, this);\r
g.setColor(Color.blue);\r
- for (int i = 0; i < 225*4; i++) {\r
- g.drawRect(ins.left+this._patt3.vertex_x[i]-1,ins.top+this._patt3.vertex_y[i]-1, 2, 2);\r
- }\r
+\r
\r
}\r
/*\r