Find location of plotted circle on a binary image

조회 수: 1 (최근 30일)
Shasha Glow
Shasha Glow 2014년 8월 5일
편집: Shasha Glow 2014년 8월 25일
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
Nir Rattner
Nir Rattner 2014년 8월 5일
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.
Shasha Glow
Shasha Glow 2014년 8월 6일
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);

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2014년 8월 5일
편집: Image Analyst 2014년 8월 5일
for k = 1 : length(circleX)
row = circleY(k);
column = circleX(k);
pixelValue = binaryImage(row, column)
end
Is that what you want?
  댓글 수: 3
Image Analyst
Image Analyst 2014년 8월 6일
pixelValue = yourImage(y(someIndex), x(someIndex));
Nir Rattner
Nir Rattner 2014년 8월 6일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Scopes and Data Logging에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by