hey in my code im processing 2 imgs....both around 200x200....while processing d first one i dont ve ne prob......but wen aplyin d same steps on other img its giving ArrayIndexOutOfBoundsException....
the grayScale function is i think d source of problemCode:byte[][] R = new byte[200][200]; byte[][] s = new byte[200][200]; double m1[] = new double[FP_TEMPLATE_MAX_SIZE]; double m2[] = new double[FP_TEMPLATE_MAX_SIZE]; R = grayScale(ip); R = ThinningHilditch(R,ip); R = ThinningHitAndMiss(R,ip); m1 = getFingerPrintTemplate(R,ip); printFeatures(m1); s = grayScale(ip2); s = ThinningHilditch(s,ip2); s = ThinningHitAndMiss(s,ip2); m2 = getFingerPrintTemplate(s,ip2);
here is d stack traceCode:public byte[][] grayScale(Image img) { byte P[][] = new byte[200][200]; int red1,green1,blue1,cl,clr,clg,clb; //int[]rgbData = new int[img.getWidth() * img.getHeight()]; //array containin rgb of each pixel img.getRGB(rgbData, 0, img.getWidth(), 0, 0, img.getWidth(), img.getHeight()); //rgb of each pixel goin in the array int [][]rgbData_two_d = new int [img.getWidth()][img.getHeight()]; for(i1 = 0; i1 < img.getWidth(); i1++) { for(j1= 0; j1 <img.getHeight(); j1++) { rgbData_two_d[i1][j1] = rgbData[temp]; temp++; } System.out.println(""); } for(i1 = 0; i1 < img.getWidth(); i1++) { for(j1= 0; j1 <img.getHeight(); j1++) { cl= rgbData_two_d[i1][j1]; clr= rgbData_two_d[i1][j1]; clb= rgbData_two_d[i1][j1]; clg= rgbData_two_d[i1][j1]; clr= clr & 0x00ff0000; red1= clr>>16; clg= clg & 0x0000ff00; green1= clg>>8; clb= clb & 0x000000ff; blue1= clb; if ((blue1<= 127) && (red1<= 127) && (green1 <= 127)) { P[i1][j1] = 1; } else { P[i1][j1] = 0; } } } for( i1 = 0; i1<= img.getWidth() - 1;i1++) { P[i1][0] = 0; P[i1][img.getHeight()- 1] = 0; } for( j1 = 0 ; j1<= img.getHeight() - 1 ; j1++) { P[0][j1] = 0; P[ img.getWidth() - 1][j1] = 0; } return P; }
java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
at LoginMIDlet.grayScale(+99)
at LoginMIDlet.allFun(+87)
at LoginMIDlet.startApp(+12)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+270)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+116)
plzzzzz help!!!!

Reply With Quote

