public void initImage() { System.out.println("INIT IMAGE function in topleftcanvas"); if(image!=null) { int w=image.getWidth(null); int h=image.getHeight(null); int pixels[]=controler.getPixelsOfImage(); float [][]imagearray=new float[w][h]; for(int x=0;x> 16; int blue = (c & 0x0000ff00) >> 8; int green = c & 0x000000ff; imagearray[x][y]=((float)(red+blue+green))/(3*255); } } for(int x=0;x> 16; int blue = (c & 0x0000ff00) >> 8; int green = c & 0x000000ff; */ int K=approximate(imagearray[x][y]); //Color kolorek = new Color(red,blue,green); color[0]=K; color[1]=K; color[2]=K; raster.setPixel(x, y, color); float error=imagearray[x][y]-K; int f_x=1; int f_y=1; if(filtervalue==2||filtervalue==3) f_x=2; if(filtervalue==3) f_y=2; for (int i=-f_x; i<+f_x; i++) for (int j=-f_y; j<+f_y; j++) if(x+i>=0&&y+j>=0&&x+i(0.5)) return 1; else return 0; }