3 /* current processing image related */
11 /* benchmark constants */
16 public Lambda(int winsz,
25 public int getNumP() {
33 public int getRows() {
37 public int getCols() {
41 public float[] getImage() {
45 public void calcGoodFeature(ImageXM imxm,
48 int sizeX, sizeY, rowY, colY;
50 float[] xx, yy, xy, image;
51 int rows_xx, cols_xx, rows_yy, cols_yy, rows_xy, cols_xy;
52 float[] tr, det, c_xx, c_xy, c_yy;
53 int rows_tr, cols_tr, rows_det, cols_det, rows_cxx, cols_cxx;
54 int rows_cxy, cols_cxyrows_cyy, cols_cyy;
58 sizeX = imxm.getRows();
59 sizeY = imxm.getCols();
60 rowY = imym.getRows();
61 colY = imym.getCols();
65 xx = new float[rows_xx * cols_xx];
68 xy = new float[rows_xy * cols_xy];
71 yy = new float[rows_yy * cols_yy];
73 for( i=0; i<sizeX; i++) {
74 for( j=0; j<sizeY; j++) {
75 xx[i * sizeY + j] = (float)(dX[i * sizeY + j] * dX[i * sizeY + j]);
76 xy[i * sizeY + j] = (float)(dX[i * sizeY + j] * dY[i * sizeY + j]);
77 yy[i * sizeY + j] = (float)(dY[i * sizeY + j] * dY[i * sizeY + j]);
81 c_xx = calcAreaSum(xx, sizeY, sizeX);
82 c_xy = calcAreaSum(xy, sizeY, sizeX);
83 c_yy = calcAreaSum(yy, sizeY, sizeX);
87 tr = new float[rows_tr * cols_tr];
90 det = new float[rows_det * cols_det];
93 image = this.m_image = new float[this.m_rows * this.m_cols];
95 for( i=0; i<sizeX; i++) {
96 for( j=0; j<sizeY; j++) {
97 tr[i * sizeY + j] = c_xx[i * sizeY + j] + c_yy[i * sizeY + j];
98 det[i * sizeY + j] = c_xx[i * sizeY + j] * c_yy[i * sizeY + j]
99 - c_xy[i * sizeY + j] * c_xy[i * sizeY + j];
100 // lambda[i * sizeY + j] = (float)(det[i * sizeY + j]/(tr[i * sizeY + j]) + 0.00001);
101 image[i * sizeY + j] = (float)((det[i * sizeY + j]*100000)
102 /((tr[i * sizeY + j]*100000) + 0.1));
107 public float[] calcAreaSum(float[] src,
110 int nave, nave_half, i, j, k;
112 int rows_ret, cols_ret, rows_a1, cols_a1;
116 nave_half = (int)(Math.floor((nave+1)/2))-1;
120 ret = new float[rows_ret * cols_ret];
122 for(i=0; i<sizeX; i++) {
124 cols_a1 = sizeY+nave;
125 a1 = new float[rows_a1 * cols_a1];
127 for(j=0; j<sizeY; j++) {
128 a1[j+nave_half] = src[i*sizeY+j];
132 for(k=0; k<nave; k++) {
136 for(j=0; j<sizeY; j++) {
137 ret[i*sizeY+j] = a1sum;
138 a1sum += a1[j+nave] - a1[j];
143 for(i=0; i<sizeY; i++) {
145 cols_a1 = sizeX+nave;
146 a1 = new float[rows_a1 * cols_a1];
148 for(j=0; j<sizeX; j++) {
149 a1[j+nave_half] = ret[j*sizeY+i];
153 for(k=0; k<nave; k++) {
157 for(j=0; j<sizeX; j++) {
158 ret[j*sizeY+i] = a1sum;
159 a1sum += a1[j+nave] - a1[j];
167 public void reshape() {
172 image = this.m_image;
176 out = new float[r * c];
181 out[k++] = image[j * c + i];
191 public void printImage() {
193 for(int i=0; i<this.m_rows; i++) {
194 for(int j=0; j<this.m_cols; j++) {
195 System.printI((int)(this.m_image[i * this.m_cols + j]*10));