Find location of plotted circle on a binary image

have to findthe location of the circle, need to walk along the circle and get the pixel value. For example the answer will be almost like 000011111000001111.. when the circle pass through the white region shows "1" and if it pass through black region shows "0".

4 Comments

You should remember that this is a place where people voluntarily offer their advice. What is urgent to you is not urgent for us, and there is no reason why your question is more important than every other person with a homework assignment. People don't ask questions because they don't really care about the answer, and don't really care when they get one.
Sorry Mr John. I have been working on this task more than a months, i have tried to use pixelinfo and so many other matlab function yet m not able to get the correct ans, because of this task there are few more tasks in pending... M not so good in matlab codes hence as a last option i posted to this group. Cause of lack of time i put urgent. If its really annoying for u, i will remove the urgent. TQ.
The circle in the provided image appears to be computer generated. What function are you using to draw the circle? It is likely that you can pull the XData and YData from the circle object to get pixel values.
adjusted_theta = 0 : 0.01 : 2*pi;
x = round(radius*cos(adjusted_theta)+ mean(m));
y = round(radius*sin(adjusted_theta)+ mean(n));
plot(x,y);

Sign in to comment.

Answers (1)

for k = 1 : length(circleX)
row = circleY(k);
column = circleX(k);
pixelValue = binaryImage(row, column)
end
Is that what you want?

3 Comments

The circle is computer generated. I used this function adjusted_theta = 0 : 0.01 : 2*pi;
x = round(radius*cos(adjusted_theta)+ mean(m));
y = round(radius*sin(adjusted_theta)+ mean(n));
plot(x,y);
Im not able to get the pixel value
pixelValue = yourImage(y(someIndex), x(someIndex));
Note that this may double count some pixels depending on the resolution and rounding of your adjusted_theta vector. You may first want to do:
uniqueXY = unique([x' y'], 'rows');
xUnique = uniqueXY(:, 1);
yUnique = uniqueXY(:, 2);
And then you can use xUnique and yUnique in the loop suggested above.

Sign in to comment.

Asked:

on 5 Aug 2014

Edited:

on 25 Aug 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!