3 /* current processing image related */
11 public ImageXM(int counter,
14 this.m_counter = counter;
17 this.m_image = new float[rows * cols];
20 public int getRows() {
24 public int getCols() {
28 public float[] getImage() {
32 public boolean addCalcSobelResult(ImageX imx) {
33 int startRow = imx.getRowsRS();
34 int endRow = imx.getRowsRE();
45 for(i = startRow; i < endRow; i++) {
46 for(j = 0; j < cols; j++) {
47 image[i * cols + j] = r[k * cols + j];
52 return (0 == this.m_counter);
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;
69 kernel_1 = new int[rows_k1 * cols_k1];
72 kernel_2 = new int[rows_k2 * cols_k2];
87 startCol = 1; //((kernelSize)/2);
88 endCol = cols - 1; //(int)(cols - (kernelSize/2));
89 halfKernel = 1; //(kernelSize-1)/2;
91 startRow = 1; //(kernelSize)/2;
92 endRow = (rows-1); //(rows - (kernelSize)/2);
94 for(i=startRow; i<endRow; i++) {
95 for(j=startCol; j<endCol; j++) {
97 for(k=-halfKernel; k<=halfKernel; k++) {
98 temp += (float)(image[(i+k) * cols + j]
99 * (float)(kernel_1[k+halfKernel]));
101 image[i * cols + j] = (float)(temp/kernelSum_1);
102 image[i * cols + j] = (float)(image[i * cols + j] + 128);
107 public void printImage() {
109 for(int i=0; i<this.m_rows; i++) {
110 for(int j=0; j<this.m_cols; j++) {
111 System.printI((int)(this.m_image[i * this.m_cols + j]*10));