チェンジセット 510
- コミット日時:
- 2008/05/25 23:37:27 (4 年前)
- ファイル:
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/FLARToolKit/trunk/src/com/libspark/flartoolkit/core/FLARColorPatt_O3.as
r481 r510 172 172 var y_coord:Array = i_marker.y_coord; 173 173 var vertex:Array = i_marker.mkvertex; 174 var local_0:Array = wk_pickFromRaster_local[0]; //double local[4][2];175 var local_1:Array = wk_pickFromRaster_local[1]; //double local[4][2];174 var local_0:Array = wk_pickFromRaster_local[0]; 175 var local_1:Array = wk_pickFromRaster_local[1]; 176 176 for (var i:int = 0; i < 4; i++) { 177 177 local_0[i] = x_coord[vertex[i]]; … … 186 186 w1 = local_0[0] - local_0[1]; 187 187 w2 = local_1[0] - local_1[1]; 188 l1 = int(w1*w1 +w2*w2);188 l1 = int(w1*w1 + w2*w2); 189 189 w1 = local_0[2] - local_0[3]; 190 190 w2 = local_1[2] - local_1[3]; 191 l2 = int(w1*w1 +w2*w2);191 l2 = int(w1*w1 + w2*w2); 192 192 if (l2 > l1) { 193 193 l1 = l2; … … 205 205 w1 = local_0[1] - local_0[2]; 206 206 w2 = local_1[1] - local_1[2]; 207 l1 = int(w1*w1 + w2*w2);207 l1 = int(w1*w1 + w2*w2); 208 208 w1 = local_0[3] - local_0[0]; 209 209 w2 = local_1[3] - local_1[0]; 210 l2 = int(w1*w1 + w2*w2);210 l2 = int(w1*w1 + w2*w2); 211 211 if (l2 > l1) { 212 212 l1 = l2; 213 213 } 214 ydiv2 = this.height;214 ydiv2 = this.height; 215 215 l1 = l1 / 4; 216 216 while (ydiv2*ydiv2 < l1) { 217 ydiv2 *=2;218 } 219 if (ydiv2 > AR_PATT_SAMPLE_NUM) {217 ydiv2 *= 2; 218 } 219 if (ydiv2 > AR_PATT_SAMPLE_NUM) { 220 220 ydiv2 = AR_PATT_SAMPLE_NUM; 221 221 } 222 222 223 223 //cparaの計算 224 if (!get_cpara(local_0, local_1,cpara)) {224 if (!get_cpara(local_0, local_1, cpara)) { 225 225 return false; 226 226 } 227 updateExtpat(image, cpara,xdiv2,ydiv2);227 updateExtpat(image, cpara, xdiv2, ydiv2); 228 228 229 229 return true; … … 343 343 } 344 344 // //ステップ2.ピクセル配列を取得 345 image.getPixelSet(x_rgb_index, y_rgb_index,index_num,rgb_buf);345 image.getPixelSet(x_rgb_index, y_rgb_index, index_num, rgb_buf); 346 346 // //ピクセル値の計算 347 347 for (i = index_num-1; i >= 0; i--) { as3/FLARToolKit/trunk/src/com/libspark/flartoolkit/core/FLARLabeling.as
r481 r510 35 35 36 36 import flash.display.BitmapData; 37 import flash.filters.BlurFilter; 37 38 import flash.filters.ColorMatrixFilter; 38 39 import flash.geom.Point; … … 41 42 public class FLARLabeling implements IFLARLabeling { 42 43 43 private static const WORK_SIZE:int = 1024*32;//#define WORK_SIZE 1024*32 44 // private var glabel_img:Array;//static ARInt16 l_imageL[HARDCODED_BUFFER_WIDTH*HARDCODED_BUFFER_HEIGHT]; 45 46 // private const work_holder:FLARWorkHolder = new FLARWorkHolder(WORK_SIZE); 47 // private const label_holder:FLARLabelHolder = new FLARLabelHolder(WORK_SIZE); 48 private const label_holder:Array = []; 49 44 private var label_holder:FLARLabelHolder; 50 45 private var label_num:int; 51 //46 52 47 private var width:int; 53 48 private var height:int; … … 55 50 private var label_img:BitmapData; 56 51 private var tmp_img:BitmapData; 52 private var hSearch:BitmapData; 53 private var hLineRect:Rectangle; 57 54 58 55 /** … … 65 62 width = i_width; 66 63 height = i_height; 67 // glabel_img = new int[height][width]; 68 // this.wk_reservLineBuffer_buf = new Array(width);//new int[width]; 64 this.label_img = new BitmapData(i_width, i_height, false, 0x0); 69 65 this.tmp_img = new BitmapData(i_width, i_height, false, 0x0); 66 this.hSearch = new BitmapData(i_width, 1, false, 0x000000); 67 this.hLineRect = new Rectangle(0, 0, 1, 1); 68 this.label_holder = new FLARLabelHolder(1024); 69 this.label_holder.init(1023, i_width, i_height); 70 70 label_num = 0; 71 72 // //ワークイメージに枠を書く73 // var label_img:Array = this.glabel_img;74 // for (var i:int = 0; i < i_width; i++) {75 // label_img[0][i] = 0;76 // label_img[i_height-1][i] = 0;77 // }78 // //</Optimize>79 // for (var i:int = 0; i < i_height; i++) {80 // label_img[i][0] = 0;81 // label_img[i][i_width-1] = 0;82 // }83 71 } 84 72 … … 100 88 throw new FLARException(); 101 89 } 102 return this.label_holder ;90 return this.label_holder.labels; 103 91 } 104 92 … … 124 112 } 125 113 126 //コンストラクタで作ること127 // private var wk_reservLineBuffer_buf:Array = null;128 129 114 /** 130 115 * static ARInt16 *labeling2(ARUint8 *image, int thresh,int *label_num, int **area, double **pos, int **clip,int **label_ref, int LorR) 131 116 * 関数の代替品 132 117 * ラスタimageをラベリングして、結果を保存します。 133 * Optimize:STEP[1514->1493]134 118 * @param image 135 119 * @param thresh 136 120 * @throws FLARException 137 121 */ 138 // public function labeling(image:FLARBitmapData, thresh:int):void {139 // int wk_max; /* work */140 // int m,n; /* work */141 // int lxsize, lysize;142 // int thresht3 = thresh * 3;143 // int i,j,k;144 // lxsize=image.getWidth();//lxsize = arUtil_c.arImXsize;145 // lysize=image.getHeight();//lysize = arUtil_c.arImYsize;146 // //画素数の一致チェック147 // if (lxsize!=this.width || lysize!=this.height) {148 // throw new FLARException();149 // }150 // //ラベル数を0に初期化151 // this.label_num=0;152 //153 //154 //155 // int[][] label_img=this.glabel_img;156 //157 //158 // //枠作成はインスタンスを作った直後にやってしまう。159 //160 // int[] work2_pt;161 // wk_max = 0;162 //163 // int label_pixel;164 //165 // int[] work=this.work_holder.work;166 // int[][] work2=this.work_holder.work2;167 // int[] line_bufferr=this.wk_reservLineBuffer_buf;168 //169 // int[] label_img_pt0,label_img_pt1;170 // for (j = 1; j < lysize - 1; j++) {//for (int j = 1; j < lysize - 1; j++, pnt += poff*2, pnt2 += 2) {171 // label_img_pt0=label_img[j];172 // label_img_pt1=label_img[j-1];173 // image.getPixelTotalRowLine(j,line_bufferr);174 //175 // for (i = 1; i < lxsize-1; i++) {//for (int i = 1; i < lxsize-1; i++, pnt+=poff, pnt2++) {176 // //RGBの合計値が閾値より大きいかな?177 // if (line_bufferr[i]<=thresht3) {178 // //pnt1 = ShortPointer.wrap(pnt2, -lxsize);//pnt1 = &(pnt2[-lxsize]);179 // if (label_img_pt1[i]>0) {//if (*pnt1 > 0) {180 // label_pixel=label_img_pt1[i];//*pnt2 = *pnt1;181 //182 //183 // work2_pt=work2[label_pixel-1];184 // work2_pt[0]++;//work2[((*pnt2)-1)*7+0] ++;185 // work2_pt[1]+=i;//work2[((*pnt2)-1)*7+1] += i;186 // work2_pt[2]+=j;//work2[((*pnt2)-1)*7+2] += j;187 // work2_pt[6]=j;//work2[((*pnt2)-1)*7+6] = j;188 // }else if (label_img_pt1[i+1]> 0) {//}else if (*(pnt1+1) > 0) {189 // if (label_img_pt1[i-1] > 0) {//if (*(pnt1-1) > 0) {190 // m = work[label_img_pt1[i+1]-1];//m = work[*(pnt1+1)-1];191 // n = work[label_img_pt1[i-1]-1];//n = work[*(pnt1-1)-1];192 // if (m > n) {193 // label_pixel=n;//*pnt2 = n;194 // //wk=IntPointer.wrap(work, 0);//wk = &(work[0]);195 // for (k = 0; k < wk_max; k++) {196 // if (work[k] == m) {//if (*wk == m)197 // work[k]=n;//*wk = n;198 // }199 // }200 // }else if (m < n) {201 // label_pixel=m;//*pnt2 = m;202 // //wk=IntPointer.wrap(work,0);//wk = &(work[0]);203 // for (k = 0; k < wk_max; k++) {204 // if (work[k]==n) {//if (*wk == n) {205 // work[k]=m;//*wk = m;206 // }207 // }208 // } else {209 // label_pixel=m;//*pnt2 = m;210 // }211 // work2_pt=work2[label_pixel-1];212 // work2_pt[0] ++;213 // work2_pt[1] += i;214 // work2_pt[2] += j;215 // work2_pt[6] = j;216 // }else if ((label_img_pt0[i-1]) > 0) {//}else if (*(pnt2-1) > 0) {217 // m = work[(label_img_pt1[i+1])-1];//m = work[*(pnt1+1)-1];218 // n = work[label_img_pt0[i-1]-1];//n = work[*(pnt2-1)-1];219 // if (m > n) {220 //221 // label_pixel=n;//*pnt2 = n;222 // for (k = 0; k < wk_max; k++) {223 // if (work[k]==m) {//if (*wk == m) {224 // work[k]=n;//*wk = n;225 // }226 // }227 // }else if (m < n) {228 // label_pixel=m;//*pnt2 = m;229 // for (k = 0; k < wk_max; k++) {230 // if (work[k]==n) {//if (*wk == n) {231 // work[k]=m;//*wk = m;232 // }233 // }234 // } else {235 // label_pixel=m;//*pnt2 = m;236 // }237 // work2_pt=work2[label_pixel-1];238 // work2_pt[0] ++;//work2[((*pnt2)-1)*7+0] ++;239 // work2_pt[1] += i;//work2[((*pnt2)-1)*7+1] += i;240 // work2_pt[2] += j;//work2[((*pnt2)-1)*7+2] += j;241 // } else {242 //243 // label_pixel=label_img_pt1[i+1];//*pnt2 = *(pnt1+1);244 //245 // work2_pt=work2[label_pixel-1];246 // work2_pt[0] ++;//work2[((*pnt2)-1)*7+0] ++;247 // work2_pt[1] += i;//work2[((*pnt2)-1)*7+1] += i;248 // work2_pt[2] += j;//work2[((*pnt2)-1)*7+2] += j;249 // if (work2_pt[3] > i) {//if (work2[((*pnt2)-1)*7+3] > i) {250 // work2_pt[3] = i;// work2[((*pnt2)-1)*7+3] = i;251 // }252 // work2_pt[6] = j;//work2[((*pnt2)-1)*7+6] = j;253 // }254 // }else if ((label_img_pt1[i-1]) > 0) {//}else if (*(pnt1-1) > 0) {255 // label_pixel=label_img_pt1[i-1];//*pnt2 = *(pnt1-1);256 //257 // work2_pt=work2[label_pixel-1];258 // work2_pt[0] ++;//work2[((*pnt2)-1)*7+0] ++;259 // work2_pt[1] += i;//work2[((*pnt2)-1)*7+1] += i;260 // work2_pt[2] += j;//work2[((*pnt2)-1)*7+2] += j;261 // if (work2_pt[4] < i) {//if (work2[((*pnt2)-1)*7+4] < i) {262 // work2_pt[4] = i;// work2[((*pnt2)-1)*7+4] = i;263 // }264 // work2_pt[6] = j;//work2[((*pnt2)-1)*7+6] = j;265 // }else if (label_img_pt0[i-1] > 0) {//}else if (*(pnt2-1) > 0) {266 // label_pixel=label_img_pt0[i-1];//*pnt2 = *(pnt2-1);267 //268 // work2_pt=work2[label_pixel-1];269 // work2_pt[0] ++;//work2[((*pnt2)-1)*7+0] ++;270 // work2_pt[1] += i;//work2[((*pnt2)-1)*7+1] += i;271 // work2_pt[2] += j;//work2[((*pnt2)-1)*7+2] += j;272 // if (work2_pt[4] < i) {//if (work2[((*pnt2)-1)*7+4] < i) {273 // work2_pt[4] = i;// work2[((*pnt2)-1)*7+4] = i;274 // }275 // } else {276 // //現在地までの領域を予約277 // this.work_holder.reserv(wk_max);278 // wk_max++;279 // work[wk_max-1] = wk_max;280 // label_pixel=wk_max;//work[wk_max-1] = *pnt2 = wk_max;281 // work2_pt=work2[wk_max-1];282 // work2_pt[0] = 1;283 // work2_pt[1] = i;284 // work2_pt[2] = j;285 // work2_pt[3] = i;286 // work2_pt[4] = i;287 // work2_pt[5] = j;288 // work2_pt[6] = j;289 // }290 // label_img_pt0[i]=label_pixel;291 // }else {292 // label_img_pt0[i]=0;//*pnt2 = 0;293 // }294 //295 // }296 // }297 // j = 1;298 // for (i = 0; i < wk_max; i++) {//for (int i = 1; i <= wk_max; i++, wk++) {299 // work[i]=(work[i]==i+1)? j++: work[work[i]-1];//*wk = (*wk==i)? j++: work[(*wk)-1];300 // }301 //302 // int wlabel_num=j - 1;//*label_num = *wlabel_num = j - 1;303 //304 // if (wlabel_num==0) {//if (*label_num == 0) {305 // //発見数0306 // return;307 // }308 //309 //310 //311 // //ラベルバッファを予約&初期化312 // this.label_holder.init(wlabel_num, lxsize, lysize);313 // //314 // // putZero(warea,wlabel_num);//put_zero((ARUint8 *)warea, *label_num * sizeof(int));315 // // for (i=0;i<wlabel_num;i++) {316 // // wpos[i*2+0]=0;317 // // wpos[i*2+1]=0;318 // // }319 // // for (i = 0; i < wlabel_num; i++) {//for (i = 0; i < *label_num; i++) {320 // // wclip[i][0] = lxsize;//wclip[i*4+0] = lxsize;321 // // wclip[i][1] = 0;//wclip[i*4+1] = 0;322 // // wclip[i][2] = lysize;//wclip[i*4+2] = lysize;323 // // wclip[i][3] = 0;//wclip[i*4+3] = 0;324 // // }325 // FLARLabel label_pt;326 // FLARLabel[] labels=this.label_holder.labels;327 //328 // for (i = 0; i < wk_max; i++) {329 // label_pt=labels[work[i] - 1];330 // work2_pt=work2[i];331 // label_pt.area += work2_pt[0];332 // label_pt.pos_x += work2_pt[1];333 // label_pt.pos_y += work2_pt[2];334 // if (label_pt.clip0 > work2_pt[3]) {335 // label_pt.clip0 = work2_pt[3];336 // }337 // if (label_pt.clip1 < work2_pt[4]) {338 // label_pt.clip1 = work2_pt[4];339 // }340 // if (label_pt.clip2 > work2_pt[5]) {341 // label_pt.clip2 = work2_pt[5];342 // }343 // if (label_pt.clip3 < work2_pt[6]) {344 // label_pt.clip3 = work2_pt[6];345 // }346 // }347 //348 // for (i = 0; i < wlabel_num; i++) {//for (int i = 0; i < *label_num; i++) {349 // label_pt=labels[i];350 // label_pt.pos_x /= label_pt.area;351 // label_pt.pos_y /= label_pt.area;352 // }353 //354 // label_num=wlabel_num;355 // return;356 // }357 358 359 360 122 private static const ZERO_POINT:Point = new Point(); 361 123 private static const ONE_POINT:Point = new Point(1, 1); 124 // private static const BLUR_FILTER:BlurFilter = new BlurFilter(2, 2, 1); 362 125 public function labeling(image:FLARBitmapData, thresh:int):void { 363 if (this.label_img) { 364 this.label_img.dispose(); 365 } 366 367 this.label_img = image.bitmapData.clone(); 368 this.tmp_img.applyFilter(this.label_img, this.label_img.rect, ZERO_POINT, new ColorMatrixFilter([ 126 this.tmp_img.applyFilter(image.bitmapData, image.bitmapData.rect, ZERO_POINT, new ColorMatrixFilter([ 369 127 0.2989, 0.5866, 0.1145, 0, 0, 370 128 0.2989, 0.5866, 0.1145, 0, 0, … … 372 130 0, 0, 0, 1, 0 373 131 ])); 132 // this.tmp_img.applyFilter(this.tmp_img, this.tmp_img.rect, ZERO_POINT, BLUR_FILTER); 374 133 this.label_img.fillRect(this.label_img.rect, 0x0); 375 134 var rect:Rectangle = this.tmp_img.rect; 376 135 rect.inflate(-1, -1); 377 136 this.label_img.threshold(this.tmp_img, rect, ONE_POINT, '<=', thresh, 0xffffffff, 0xff); 378 // this.label_img.threshold(this.tmp_img, rect, ONE_POINT, '>', thresh, 0xff00000, 0xff);379 137 380 138 this.label_num = 0; 381 this.label_holder.splice(0, this.label_holder.length); 382 // this.area = []; 383 // this.clip = []; 384 // this.pos = [] 139 var labels:Array = this.label_holder.labels; 385 140 386 var hSearch:BitmapData = new BitmapData(this.label_img.width, 1, false, 0x000000);387 141 var currentRect:Rectangle = this.label_img.getColorBoundsRect(0xffffff, 0xffffff, true); 388 var hLineRect:Rectangle = new Rectangle(0, 0, this.label_img.width, 1); 142 hLineRect.y = 0; 143 hLineRect.width = this.label_img.width; 389 144 var hSearchRect:Rectangle; 390 145 var labelRect:Rectangle; 146 var index:int = 0; 391 147 while (!currentRect.isEmpty()) { 392 148 hLineRect.y = currentRect.top; … … 394 150 hSearchRect = hSearch.getColorBoundsRect(0xffffff, 0xffffff, true); 395 151 396 var label:FLARLabel = new FLARLabel();//this.label_holder.labels[this.label_num];397 this.label_img.floodFill(hSearchRect.x, hLineRect.y, ++this.label_num);152 var label:FLARLabel = labels[this.label_num++]; 153 this.label_img.floodFill(hSearchRect.x, hLineRect.y, this.label_num); 398 154 labelRect = this.label_img.getColorBoundsRect(0xffffff, this.label_num, true); 399 155 label.area = labelRect.width * labelRect.height; … … 402 158 label.clip2 = labelRect.top; 403 159 label.clip3 = labelRect.bottom - 1; 404 label.pos_x = (labelRect.left + labelRect.right - 1) * 0.5;// / label.area; 405 label.pos_y = (labelRect.top + labelRect.bottom - 1) * 0.5;// / label.area; 406 this.label_holder.push(label); 407 // this.area.push(labelRect.width * labelRect.height); 408 // this.clip.push([labelRect.left, labelRect.right - 1, labelRect.top, labelRect.bottom - 1]); 409 // this.pos.push((labelRect.left + labelRect.right - 1) * 0.5, (labelRect.top + labelRect.bottom - 1) * 0.5); 160 label.pos_x = (labelRect.left + labelRect.right - 1) * 0.5; 161 label.pos_y = (labelRect.top + labelRect.bottom - 1) * 0.5; 410 162 currentRect = this.label_img.getColorBoundsRect(0xffffff, 0xffffff, true); 411 163 } 412 hSearch.dispose();413 164 } 414 165 … … 419 170 import com.libspark.flartoolkit.core.FLARLabel; 420 171 import com.libspark.flartoolkit.FLARException; 421 422 //class FLARWorkHolder423 //{424 // private final static int ARRAY_APPEND_STEP=256;425 // public final int[] work;426 // public final int[][] work2;427 // private int allocate_size;428 // /**429 // * 最大i_holder_size個の動的割り当てバッファを準備する。430 // * @param i_holder_size431 // */432 // public FLARWorkHolder(int i_holder_size)433 // {434 // //ポインタだけははじめに確保しておく435 // this.work=new int[i_holder_size];436 // this.work2=new int[i_holder_size][];437 // this.allocate_size=0;438 // }439 // /**440 // * i_indexで指定した番号までのバッファを準備する。441 // * @param i_index442 // */443 // public final void reserv(int i_index) throws FLARException444 // {445 // //アロケート済みなら即リターン446 // if (this.allocate_size>i_index) {447 // return;448 // }449 // //要求されたインデクスは範囲外450 // if (i_index>=this.work.length) {451 // throw new FLARException();452 // }453 // //追加アロケート範囲を計算454 // int range=i_index+ARRAY_APPEND_STEP;455 // if (range>=this.work.length) {456 // range=this.work.length;457 // }458 // //アロケート459 // for (int i=this.allocate_size;i<range;i++)460 // {461 // this.work2[i]=new int[7];462 // }463 // this.allocate_size=range;464 // }465 //}466 172 467 173 class FLARLabelHolder { … … 521 227 l.pos_x = 0; 522 228 l.pos_y = 0; 523 l.clip0 = i_lxsize; //wclip[i*4+0] = lxsize;524 l.clip1 = 0; //wclip[i*4+0] = lxsize;525 l.clip2 = i_lysize; //wclip[i*4+2] = lysize;526 l.clip3 = 0; //wclip[i*4+3] = 0;229 l.clip0 = i_lxsize; 230 l.clip1 = 0; 231 l.clip2 = i_lysize; 232 l.clip3 = 0; 527 233 } 528 234 } as3/FLARToolKit/trunk/src/com/libspark/flartoolkit/core/FLARMarkerDetector.as
r492 r510 45 45 public class FLARMarkerDetector { 46 46 47 private static const AR_AREA_MAX:int = 100000;//#define AR_AREA_MAX 100000 48 private static const AR_AREA_MIN:int = 70;//#define AR_AREA_MIN 70 49 50 // private final FLARMarker[] marker_holder; //マーカーデータの保持配列 51 // private final FLARMarker[] marker_info2_array;//マーカーデータのインデックス配列 52 // private int marker_num; 47 private static const AR_AREA_MAX:int = 100000; 48 private static const AR_AREA_MIN:int = 70; 49 53 50 private var width:int; 54 51 private var height:int; … … 61 58 this.width =i_width; 62 59 this.height=i_height; 63 64 // this.marker_holder=new FLARMarker[i_squre_max];65 // this.marker_info2_array=new FLARMarker[i_squre_max];66 // //先にマーカーホルダにオブジェクトを作っておく67 // for (int i=0;i<i_squre_max;i++) {68 // this.marker_holder[i]=new FLARMarker();69 // }70 60 } 71 61 … … 73 63 private const wk_arGetContour_xdir:Array = [0, 1, 1, 1, 0,-1,-1,-1]; 74 64 private const wk_arGetContour_ydir:Array = [-1,-1, 0, 1, 1, 1, 0,-1]; 75 private const wk_arGetContour_xcoord:Array = new Array(AR_CHAIN_MAX); //new int[AR_CHAIN_MAX];76 private const wk_arGetContour_ycoord:Array = new Array(AR_CHAIN_MAX); //new int[AR_CHAIN_MAX];65 private const wk_arGetContour_xcoord:Array = new Array(AR_CHAIN_MAX); 66 private const wk_arGetContour_ycoord:Array = new Array(AR_CHAIN_MAX); 77 67 /** 78 68 * int arGetContour(ARInt16 *limage, int *label_ref,int label, int clip[4], ARMarkerInfo2 *marker_info2) … … 92 82 var xcoord:Array = wk_arGetContour_xcoord; 93 83 var ycoord:Array = wk_arGetContour_ycoord; 94 var xdir:Array = wk_arGetContour_xdir; //static int xdir[8] = { 0, 1, 1, 1, 0,-1,-1,-1}; 95 var ydir:Array = wk_arGetContour_ydir;//static int ydir[8] = {-1,-1, 0, 1, 1, 1, 0,-1}; 96 //ShortPointer p1;//ARInt16 *p1; 84 var xdir:Array = wk_arGetContour_xdir; 85 var ydir:Array = wk_arGetContour_ydir; 97 86 var coord_num:int; 98 87 var sx:int = 0, sy:int = 0, dir:int; … … 134 123 c = xcoord[0]; 135 124 r = ycoord[0]; 136 dmax =0;125 dmax = 0; 137 126 //本家はdmaxの作成とxcoordの作成を別のループでやってるけど、非効率なので統合 138 127 for (;;) { … … 210 199 var xsize:int, ysize:int; 211 200 var labels:Array = i_labeling.getLabel(); 212 // int[] warea =i_labeling.getArea();213 201 var label_num:int = i_labeling.getLabelNum(); 214 202 var label_img:BitmapData = i_labeling.getLabelImg(); 215 // int[][] wclip =i_labeling.getClip();216 // double[] wpos =i_labeling.getPos();217 // var limage:Array = i_labeling.getLabelImg();218 // var label_ref:Array = i_labeling.getLabelRef();219 203 220 204 //マーカーホルダをリセット 221 205 o_marker_list.reset(); 222 // marker_num=0;206 // marker_num=0; 223 207 xsize = width; 224 208 ysize = height; 225 // マーカーをmarker_holderに蓄積する。209 // マーカーをmarker_holderに蓄積する。 226 210 var current_marker:FLARMarker = o_marker_list.getCurrentHolder(); 227 211 var label_pt:FLARLabel; … … 238 222 continue; 239 223 } 240 //ret = arGetContour(limage, label_ref, i+1,&(wclip[i*4]), &(marker_info2[marker_num2]));241 224 arGetContour(current_marker, label_img, i+1, label_pt); 242 225 … … 258 241 //マーカーリストを整理(重なり処理とかはマーカーリストに責務押し付け) 259 242 o_marker_list.updateMarkerArray(); 260 // 重なり処理かな?261 // double[] pos_j,pos_i;262 // for (i=0; i < marker_num2; i++) {263 // pos_i=marker_holder[i].pos;264 // for (j=i+1; j < marker_num2; j++) {265 // pos_j=marker_holder[j].pos;266 // d = (pos_i[0] - pos_j[0])*(pos_i[0] - pos_j[0])+267 // (pos_i[1] - pos_j[1])*(pos_i[1] - pos_j[1]);268 // if (marker_holder[i].area >marker_holder[j].area) {269 // if (d <marker_holder[i].area / 4) {270 // marker_holder[j].area = 0;271 // }272 // } else {273 // if (d < marker_holder[j].area / 4) {274 // marker_holder[i].area = 0;275 // }276 // }277 // }278 // }279 // みつかったマーカーを整理する。280 // エリアが0のマーカーを外した配列を作って、その数もついでに計算281 // for (i=0;i<marker_num2;i++) {282 // if (marker_holder[i].area==0.0) {283 // continue;284 // }285 // marker_info2_array[marker_num]=marker_holder[i];286 // marker_num++;287 // }288 // for (i=0; i < marker_num2; i++) {289 // if (marker_info2_array[i].area == 0.0) {290 // for (j=i+1; j < marker_num2; j++) {291 // marker_info2_array[j-1] = marker_info2_array[j];292 // }293 // marker_num2--;294 // }295 // }296 // 発見したマーカー数をセット297 // marker_num=marker_num2;//*marker_num = marker_num2;298 // return(&(marker_info2[0]));299 243 return; 300 244 }

