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;
\r
34 import jp.nyatla.nyartoolkit.NyARException;
\r
35 import jp.nyatla.nyartoolkit.core.raster.*;
\r
39 public class NyARDetectSquare
\r
41 private final NyARLabeling labeling;
\r
42 private final NyARDetectMarker detect;
\r
43 private NyARParam param;
\r
46 * マーカー抽出インスタンスを作ります。
\r
49 public NyARDetectSquare(NyARParam i_param)
\r
53 int width=i_param.getX();
\r
54 int height=i_param.getY();
\r
56 labeling=new NyARLabeling_O2(width,height);
\r
57 detect=new NyARDetectMarker(width,height);
\r
60 * ラスタイメージから矩形を検出して、結果o_square_holderへ格納します。
\r
62 * @param i_number_of_marker
\r
63 * @param i_square_holder
\r
64 * @throws NyARException
\r
66 public void detectSquare(NyARRaster i_image,int i_thresh,NyARSquareList o_square_holder) throws NyARException
\r
68 // number_of_square=0;
\r
69 labeling.labeling(i_image, i_thresh);
\r
70 if(labeling.getLabelNum()<1){
\r
74 detect.detectMarker(labeling,1.0,o_square_holder);
\r
76 //マーカー情報をフィルタして、スクエア配列を更新する。
\r
77 o_square_holder.updateSquareArray(param);
\r
79 // NyARSquare square;
\r
81 // for (int i = 0; i <number_of_marker; i++){
\r
82 // double[][] line =new double[4][3];
\r
83 // double[][] vertex =new double[4][2];
\r
84 // //NyARMarker marker=detect.getMarker(i);
\r
85 // square=square_holder.getSquare(i);
\r
87 // if (!square.getLine(param))
\r
91 // ここで計算するのは良くないと思うんだ
\r
92 // marker_infoL[j].id = id.get();
\r
93 // marker_infoL[j].dir = dir.get();
\r
94 // marker_infoL[j].cf = cf.get();
\r
96 // //配列数こえたらドゴォォォンしないようにループを抜ける
\r
97 // if(j>=marker_info.length){
\r
101 // number_of_square=j;
\r