Hi,
I have a project where we need to scan each pixel from an image. Somewhere in the image there will be a 10x10 red pixel and we need to draw a circle around it. This is the code I have so far: (but I'm having trouble figureing out the code to scan each pixel?) Any help would be great! Thanks
public static void main(String[] args) {
TheMatrix picture = new TheMatrix(EasyInput.openFileDialog());
int width = picture.getWidth();
int height = picture.getHeight();
int[] pixels;
for (int x = 0; x < width; x++){
for (int y = 0; y < height; y++){
Color c = picture.getColor(x, y);
if (c == Color.RED){
for (int x = 0; x < 199; ++x) {
int y = (int) (Math.sqrt(200 * 200 - x * x));
picture.setColor(250 + x, 250 + y, Color.WHITE);
picture.setColor(250 - x, 250 + y, Color.WHITE);
picture.setColor(250 + x, 250 - y, Color.WHITE);
picture.setColor(250 - x, 250 - y, Color.WHITE);
picture.show();
}
Paula