Circle centers plot aren't in the same place as the circles in a figure
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Nadir Shakhshir
el 17 de Nov. de 2019
Comentada: Star Strider
el 17 de Nov. de 2019
Hello All,
I have a code that detects circles in an image of cells and then draws the circles around the cells, i am trying to plot the centers of the circles as Xs but they are being plotted in the left most side of the figure, any idea how can i shift them to be in the right location?
I = imread ( 'globules3.jpg');
BW = im2bw(I,.8);
BW=~BW;
[centers, radii, metric] = imfindcircles(BW,[15 30]);
centersStrong = centers(1:40,:);
radiiStrong = radii(1:40);
metricStrong = metric(1:40);
figure, imshow(I), hold on
viscircles(centersStrong, radiiStrong,'EdgeColor','b');
plot(centersStrong,'r*', 'MarkerSize', 4, 'LineWidth', 2);
0 comentarios
Respuesta aceptada
Star Strider
el 17 de Nov. de 2019
I cannot run your code.
However, since ‘centersStrong’ is a two-column matrix of the x and y coordinates, your plot call would need to separate them:
plot(centersStrong(:,1), centersStrong(:,2), 'r*', 'MarkerSize', 4, 'LineWidth', 2);
Since plot coordinates are different from image coordinates, you may also need to use:
set(gca, 'YDir','reverse')
As I mentioned, I cannot run your code, so I cannot experiment with this. I leave tht to you.
2 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!