From: yeom Date: Mon, 2 Aug 2010 04:53:32 +0000 (+0000) Subject: changes. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7f68d6935203b36cf1b7eda56fa0d204062e6bde;p=IRC.git changes. --- diff --git a/Robust/src/Benchmarks/oooJava/tracking/BlurPiece.java b/Robust/src/Benchmarks/oooJava/tracking/BlurPiece.java index 20bd359b..e5063e7e 100644 --- a/Robust/src/Benchmarks/oooJava/tracking/BlurPiece.java +++ b/Robust/src/Benchmarks/oooJava/tracking/BlurPiece.java @@ -14,16 +14,19 @@ public class BlurPiece { /* id indicating the piece # */ int m_id; int m_range; + int m_pnum; /* constructor */ public BlurPiece(int id, int range, - int[] data) { + int[] data, + int pnum) { this.m_id = id; this.m_range = range; this.m_image = data; this.m_rows = data[0]; this.m_cols = data[1]; + this.m_pnum = pnum; } public int getId() { @@ -69,6 +72,9 @@ public class BlurPiece { cols = this.m_cols; this.m_rows_rs = this.m_id * this.m_range; this.m_rows_re = (this.m_id + 1) * this.m_range; + if(this.m_id == this.m_pnum - 1) { + this.m_rows_re = rows; + } if(rows < this.m_rows_re) { this.m_rows_re = rows; } @@ -98,13 +104,15 @@ public class BlurPiece { startRow = (2>this.m_rows_rs)?2:(this.m_rows_rs); //(kernelSize)/2; endRow = ((rows-2) 0.0) { +// System.out.println("index: " + i + " " + interestPnts[i]); +// } +// } // fTranspose(interestPnts) float[] trans; @@ -658,15 +665,21 @@ public class TrackDemo { int n, i, j, k, validCount, cnt, end, iter, rows, cols; int supIdPtr = 0; + // TODO +// for(i = 0; i < rows_f1; i++) { +// System.out.println("++ " + f1[i] + " " + f2[i] + " " + f3[i]); +// } + r_sq = (float) (this.SUPPRESION_RADIUS ^ 2); points = this.horzcat(f1, rows_f1, cols_f1, f2, rows_f2, cols_f2, f3, rows_f3, cols_f3); rows_p = rows_f3; cols_p = cols_f1 + cols_f2 + cols_f3; n = rows_f3; + // TODO - for(i = 0; i < rows_p*cols_p; i++) { - System.out.println("++ " + points[i]); - } +// for(i = 0; i < points.length; i++) { +// System.out.println(points[i]); +// } /** sort() arg 2 is for descend = 1, arg3 = indices. Returns sorted values **/ @@ -712,8 +725,7 @@ public class TrackDemo { if (suppressR[i] > r_sq) { supId[k++] = i; } - } - + } while (validCount > 0) { float[] tempp, temps; @@ -732,6 +744,7 @@ public class TrackDemo { rows_ip[0] = rows_ip[0] + rows_tmp; cols_ip[0] = cols_ip[0]; } + iter++; @@ -770,31 +783,28 @@ public class TrackDemo { for (i = 0; i < rows_sp; i++) { t = (float) 0; t1 = (float) 0; - System.out.println("HERE? length="+srtdPnts.length+" idx="+(supId[i] * cols_sp + 2)); - if ((C_ROBUST * interestPnts[rows1 * cols1 + 2]) >= srtdPnts[supId[i] * cols_sp + 2]) { - t = srtdPnts[supId[i] * cols_sp + 0] - interestPnts[rows1 * cols1 + 0]; - t1 = srtdPnts[supId[i] * cols_sp + 1] - interestPnts[rows1 * cols1 + 1]; + if ((C_ROBUST * interestPnts[rows1 * cols1 + 2]) >= srtdPnts[i * cols_sp + 2]) { + t = srtdPnts[i * cols_sp + 0] - interestPnts[rows1 * cols1 + 0]; + t1 = srtdPnts[i * cols_sp + 1] - interestPnts[rows1 * cols1 + 1]; t = t * t + t1 * t1; t1 = (float) 0; } - if ((C_ROBUST * interestPnts[rows1 * cols1 + 2]) < srtdPnts[supId[i] * cols_sp + 2]) { - t1 = (float) 1 * (float) MAX_LIMIT; + if ((C_ROBUST * interestPnts[rows1 * cols1 + 2]) < srtdPnts[i * cols_sp + 2]) { + t1 =/* (float) 1 **/ (float) MAX_LIMIT; } - if (suppressR[supId[i]] > (t + t1)) { - suppressR[supId[i]] = t + t1; + if (suppressR[i] > (t + t1)) { + suppressR[i] = t + t1; } } validCount = 0; for (i = 0; i < rows_sr; i++) { - System.out.println(suppressR[i]+"<->"+r_sq); if (suppressR[i] > r_sq) { validCount++; } } - System.out.println("validCount="+validCount); k = 0; rows_si = validCount; @@ -822,8 +832,8 @@ public class TrackDemo { float a, b, a11, a12, a21, a22; int i, j, srcIdxX, dstIdxX, srcIdy, dstIdy, dstIndex; - a = centerX - (float) (Math.floor(centerX)); - b = centerY - (float) (Math.floor(centerY)); + a = (float) (centerX - Math.floor(centerX)); + b = (float) (centerY - Math.floor(centerY)); a11 = (1 - a) * (1 - b); a12 = a * (1 - b); @@ -972,7 +982,8 @@ public class TrackDemo { break; } - if ((float) (c_det / (tr + (float) 0.00001)) < (float) this.accuracy) { + //System.out.println((float) (c_det / (tr + (float) 0.00001)) ); + if ((float) (c_det / (tr + 0.00001)) < (float) this.accuracy) { valid[i] = 0; break; } @@ -1008,8 +1019,8 @@ public class TrackDemo { mX = c_det * (eX * c_yy - eY * c_xy); mY = c_det * (-eX * c_xy + eY * c_xx); - // printf("mx = %d\t%d\t%f\t%f\t%f\t%f\t%f\n", i, level, mX, mY, - // c_det, eX, eY); +// printf("mx = %d\t%d\t%f\t%f\t%f\t%f\t%f\n", i, level, mX, mY, c_det, eX, eY); +// System.out.println(i+" "+level+" "+mX+" "+mY+" "+c_det+" "+eX+" "+eY); dX = dX + mX; dY = dY + mY; @@ -1027,7 +1038,7 @@ public class TrackDemo { return valid; } - public void calcTrack(IXLM ixlm, IYLM iylm, IXLMR ixlmr, IYLMR iylmr) { + public void calcTrack(float[] prevImage, float[] prevImageR,IXLM ixlm, IYLM iylm, IXLMR ixlmr, IYLMR iylmr) { float[][] Ipyrs = new float[6][]; int[] rows = new int[6]; int[] cols = new int[6]; @@ -1036,7 +1047,8 @@ public class TrackDemo { int[] status; int rows_s, cols_s; - Ipyrs[0] = ixlm.getImage(); +// Ipyrs[0] = ixlm.getImage(); + Ipyrs[0] = prevImage; rows[0] = ixlm.getRows(); cols[0] = ixlm.getCols(); Ipyrs[2] = ixlm.getResult(); @@ -1046,7 +1058,8 @@ public class TrackDemo { rows[3] = iylm.getRowsR(); cols[3] = iylm.getColsR(); - Ipyrs[1] = ixlmr.getImage(); +// Ipyrs[1] = ixlmr.getImage(); + Ipyrs[1]=prevImageR; rows[1] = ixlmr.getRows(); cols[1] = ixlmr.getCols(); Ipyrs[4] = ixlmr.getResult(); @@ -1065,6 +1078,12 @@ public class TrackDemo { status = this.calcPyrLKTrack(Ipyrs, rows, cols, newpoints); rows_s = 1; cols_s = this.m_cols_f; + +// //TODO +// System.out.println("###########"); +// for(i=0;i