/**
  * テーブル検索関数です。 {@link NyARRealityTarget}を元に{@link
  * NyARRealitySource}からパターンのサンプリングを行い、最も一致するマーカパターンをテーブルから検索します。 検索キーとなる{@link
  * NyARRealityTarget}は、{@link NyARReality}派生クラスから取得した物を指定します。
  *
  * @param i_target 検索キーとなる、Unknownステータスの{@link NyARRealityTarget}クラスのオブジェクトを指定します。
  * @param i_rtsorce i_targetを検出した{@link NyARRealitySource}のインスタンスを指定します。関数は、このソースからパターン取得を行います。
  * @param o_result 返却値を格納するインスタンスを設定します。
  * @return パターンのサンプリングに成功すると、trueを返します。 返却値がtrueの場合のみ、内容が更新されています。
  * @throws NyARException
  */
 public boolean getBestMatchTarget(
     NyARRealityTarget i_target, NyARRealitySource i_rtsorce, GetBestMatchTargetResult o_result)
     throws NyARException {
   // パターン抽出
   NyARMatchPattResult tmp_patt_result = this.__tmp_patt_result;
   NyARPerspectiveRasterReader r = i_rtsorce.refPerspectiveRasterReader();
   r.read4Point(
       i_rtsorce.refRgbSource(),
       i_target.refTargetVertex(),
       this._edge_x,
       this._edge_y,
       this._sample_per_pix,
       this._tmp_raster);
   // 比較パターン生成
   this._deviation_data.setRaster(this._tmp_raster);
   int ret = -1;
   int dir = -1;
   double cf = Double.MIN_VALUE;
   for (int i = this._table.getLength() - 1; i >= 0; i--) {
     this._match_patt.setARCode(this._table.getItem(i).code);
     this._match_patt.evaluate(this._deviation_data, tmp_patt_result);
     if (cf < tmp_patt_result.confidence) {
       ret = i;
       cf = tmp_patt_result.confidence;
       dir = tmp_patt_result.direction;
     }
   }
   if (ret < 0) {
     return false;
   }
   // 戻り値を設定
   MarkerTable.SerialTableRow row = this._table.getItem(ret);
   o_result.artk_direction = dir;
   o_result.confidence = cf;
   o_result.idtag = row.idtag;
   o_result.marker_height = row.marker_height;
   o_result.marker_width = row.marker_width;
   o_result.name = row.name;
   return true;
 }