Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 203 | chris | 1 | /* |
| 2 | * PROJECT: NyARToolkit |
||
| 3 | * -------------------------------------------------------------------------------- |
||
| 4 | * This work is based on the original ARToolKit developed by |
||
| 5 | * Hirokazu Kato |
||
| 6 | * Mark Billinghurst |
||
| 7 | * HITLab, University of Washington, Seattle |
||
| 8 | * http://www.hitl.washington.edu/artoolkit/ |
||
| 9 | * |
||
| 10 | * The NyARToolkit is Java version ARToolkit class library. |
||
| 11 | * Copyright (C)2008 R.Iizuka |
||
| 12 | * |
||
| 13 | * This program is free software; you can redistribute it and/or |
||
| 14 | * modify it under the terms of the GNU General Public License |
||
| 15 | * as published by the Free Software Foundation; either version 2 |
||
| 16 | * of the License, or (at your option) any later version. |
||
| 17 | * |
||
| 18 | * This program is distributed in the hope that it will be useful, |
||
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 21 | * GNU General Public License for more details. |
||
| 22 | * |
||
| 23 | * You should have received a copy of the GNU General Public License |
||
| 24 | * along with this framework; if not, write to the Free Software |
||
| 25 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
| 26 | * |
||
| 27 | * For further information please contact. |
||
| 28 | * http://nyatla.jp/nyatoolkit/ |
||
| 29 | * <airmail(at)ebony.plala.or.jp> |
||
| 30 | * |
||
| 31 | */ |
||
| 32 | package jp.nyatla.nyartoolkit.core; |
||
| 33 | |||
| 34 | import jp.nyatla.nyartoolkit.NyARException; |
||
| 35 | import jp.nyatla.nyartoolkit.core.raster.*; |
||
| 36 | |||
| 37 | |||
| 38 | |||
| 39 | public class NyARDetectSquare |
||
| 40 | { |
||
| 41 | private final NyARLabeling labeling; |
||
| 42 | private final NyARDetectMarker detect; |
||
| 43 | private NyARParam param; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * マーカー抽出インスタンスを作ります。 |
||
| 47 | * @param i_param |
||
| 48 | */ |
||
| 49 | public NyARDetectSquare(NyARParam i_param) |
||
| 50 | { |
||
| 51 | param=i_param; |
||
| 52 | //解析オブジェクトを作る |
||
| 53 | int width=i_param.getX(); |
||
| 54 | int height=i_param.getY(); |
||
| 55 | |||
| 56 | labeling=new NyARLabeling_O2(width,height); |
||
| 57 | detect=new NyARDetectMarker(width,height); |
||
| 58 | } |
||
| 59 | /** |
||
| 60 | * ラスタイメージから矩形を検出して、結果o_square_holderへ格納します。 |
||
| 61 | * @param i_marker |
||
| 62 | * @param i_number_of_marker |
||
| 63 | * @param i_square_holder |
||
| 64 | * @throws NyARException |
||
| 65 | */ |
||
| 66 | public void detectSquare(NyARRaster i_image,int i_thresh,NyARSquareList o_square_holder) throws NyARException |
||
| 67 | { |
||
| 68 | // number_of_square=0; |
||
| 69 | |||
| 70 | labeling.labeling(i_image, i_thresh); |
||
| 71 | if(labeling.getLabelNum()<1){ |
||
| 72 | return; |
||
| 73 | } |
||
| 74 | //ここでマーカー配列を作成する。 |
||
| 75 | detect.detectMarker(labeling,1.0,o_square_holder); |
||
| 76 | |||
| 77 | //マーカー情報をフィルタして、スクエア配列を更新する。 |
||
| 78 | o_square_holder.updateSquareArray(param); |
||
| 79 | |||
| 80 | // NyARSquare square; |
||
| 81 | // int j=0; |
||
| 82 | // for (int i = 0; i <number_of_marker; i++){ |
||
| 83 | // double[][] line =new double[4][3]; |
||
| 84 | // double[][] vertex =new double[4][2]; |
||
| 85 | // //NyARMarker marker=detect.getMarker(i); |
||
| 86 | // square=square_holder.getSquare(i); |
||
| 87 | // //・・・線の検出?? |
||
| 88 | // if (!square.getLine(param)) |
||
| 89 | // { |
||
| 90 | // continue; |
||
| 91 | // } |
||
| 92 | // ここで計算するのは良くないと思うんだ |
||
| 93 | // marker_infoL[j].id = id.get(); |
||
| 94 | // marker_infoL[j].dir = dir.get(); |
||
| 95 | // marker_infoL[j].cf = cf.get(); |
||
| 96 | // j++; |
||
| 97 | // //配列数こえたらドゴォォォンしないようにループを抜ける |
||
| 98 | // if(j>=marker_info.length){ |
||
| 99 | // break; |
||
| 100 | // } |
||
| 101 | // } |
||
| 102 | // number_of_square=j; |
||
| 103 | } |
||
| 104 | } |