#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# reading image in circle area

edited April 2016

Hi. i'm finding a way to read image in a circle area. I'm working with pixels from image and using their RGB values to create sound. In this moment i need to find some way how to read only some circle area from that image. I asked uncle Google, but i didn't find anything what worked for me. I found something with a function dist() and mouse position, but i don't know how to use it. Sorry, if my english is bad, i'm learning it.

Tagged:

• edited April 2016

now i'm using this. i don't know how to set if() for x and y for a circle

``````  x+=2;
if (x>500) {
x=0;
y+=2;
}
if (y>=490) {  //restart
x=0;
y=0;
}

int loc=x+y*500;
r=red(img.pixels[loc]);
g=green(img.pixels[loc]);
b=blue(img.pixels[loc]);
``````
• Thank you!

• well, i have this. it's there some way how to move the x and y only in the circle? i didn't find any solution.

``````int x, y, radius;

void setup() {
size(400, 400);
}

void draw() {
x+=1;
if (x>width) {
x=0;
y+=1;
}
if (dist(x, y, width/2, height/2)<radius) {
stroke(255, 0, 0);
} else {
stroke(0, 255, 0);
}
point(x, y);
println(x, y);
}
}
``````