Parcour Image Pixel par Pixel
Salut,
j'aimerais parcourir mon image pixel par pixel en effectuant un test mais je suis coince avec une exception :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| width=img.getWidth();//Recuperation de la largeur de l'image
height=img.getHeight();
for(int i=0;i<height;i++)
{
for(int j=0;j<width;j++)
{
if(img.getRGB(i,j)==-1)
{
corx.add(v,new Integer(i));
cory.add(v,new Integer(j));
v++;
}
}
} |
alors elle me génère cette exception:
Citation:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
at sun.awt.image.IntegerInterleavedRaster.getDataElements(IntegerInterleavedRaster.java:202)