3 /* current processing image related */
14 /* id indicating the piece # */
19 public IXL(int id, int range, float[] data, int rows, int cols) {
31 public float[] getResult() {
35 public int getRowsRS() {
36 return this.m_rows_rs;
39 public int getRowsRE() {
40 return this.m_rows_re;
43 public int getColsR() {
47 public int getRows() {
51 public int getCols() {
55 public void calcSobel_dX() {
56 int rows_k1, cols_k1, rows_k2, cols_k2;
57 int[] kernel_1, kernel_2;
59 int kernelSize, startCol, endCol, halfKernel, startRow, endRow;
60 int k, i, j, kernelSum_1, kernelSum_2;
61 float[] result, image;
62 int rows = this.m_rows;
63 int cols = this.m_cols;
67 this.m_rows_rs = this.m_id * this.m_range;
68 this.m_rows_re = (this.m_id + 1) * this.m_range;
70 result = this.m_result = new float[(this.m_rows_re - this.m_rows_rs) * this.m_cols_r];
74 kernel_1 = new int[rows_k1 * cols_k1];
77 kernel_2 = new int[rows_k2 * cols_k2];
92 startCol = 1; // ((kernelSize)/2);
93 endCol = cols - 1; // (int)(cols - (kernelSize/2));
94 halfKernel = 1; // (kernelSize-1)/2;
96 if ((this.m_rows_re < 1) || (this.m_rows_rs > rows - 1)) {
99 startRow = (1 > this.m_rows_rs) ? 1 : (this.m_rows_rs); // (kernelSize)/2;
100 endRow = ((rows - 1) < this.m_rows_re) ? (rows - 1) : (this.m_rows_re); // (rows
104 int ii = startRow - this.m_rows_rs;
105 for (i = startRow; i < endRow; i++) {
106 for (j = startCol; j < endCol; j++) {
108 for (k = -halfKernel; k <= halfKernel; k++) {
109 temp += (float) (image[i * cols + (j + k)] * (float) (kernel_2[k + halfKernel]));
111 result[ii * cols + j] = (float) (temp / kernelSum_2);
117 public void printResult() {
119 System.printI(11111111);
120 for (int i = 0; i < this.m_rows_re - this.m_rows_rs; i++) {
121 for (int j = 0; j < this.m_cols_r; j++) {
122 System.printI((int) (this.m_result[i * this.m_cols_r + j] * 10));