i want to draw an circle of radius 10 cm around the particular point defined in a circle !!!!

3 visualizaciones (últimos 30 días)
i already drawan a circle and defined the points in the circle now i want to draw an circle around that points in that circle.i also load that code here:
% M-file to place multiple points inside a big circle.
% Clean up
close all;
clc;
fontSize = 15;
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
% Initialize some parameters.
numberOfPoints = 25; % Number of small circles
bigImageWidth = 300;
bigImageHeight = 300; % square area 0f 500*500
bigCircleRadius = 150; % big circle radius
% Initialize an image to hold one single big circle.
bigCircleImage = zeros(bigImageHeight, bigImageWidth, 'uint8');
[x, y] = meshgrid(1:bigImageWidth, 1:bigImageHeight);
bigCircleImage((x - bigImageWidth/2).^2 + (y - bigImageHeight/2).^2 <= bigCircleRadius.^2) = 1;
clear('x', 'y'); % Release these variables, they're not needed anymore.
% Display it in the upper left plot.
subplot(2,2, 1);
imshow(bigCircleImage, []);
title('Big Circle Mask', 'FontSize', fontSize);
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
% Initialize an output image to hold many small overlapping circles.
pointsImage = zeros(bigImageHeight, bigImageWidth, 'uint8');
% Get linear indexes of 500 randomly located in the rectangle.
numberOfPointsToPlace =300;
linearIndexes = randi(numel(pointsImage), numberOfPointsToPlace, 1);
% Set those points in the image
pointsImage(linearIndexes) = 255;
% Get locations in terms of row and columns:
[rows, columns] = ind2sub(size(pointsImage), linearIndexes);
% Display it in the lower left plot.
subplot(2,2, 2);
imshow(pointsImage);
title('Many Points', 'FontSize', fontSize);
% Multiply the big circle mask by the points image to clip
% those points that lie outside the big circle.
maskedByBigCircle = bigCircleImage .* pointsImage;
% Display it in the lower right plot.
subplot(2,2, 3);
imshow(maskedByBigCircle);
title('Many Points Masked by Big Circle', 'FontSize', fontSize);
  5 comentarios
Jayesh Nakum
Jayesh Nakum el 6 de Nov. de 2015
i want to draw an circle for the purpose of showing an interfernce between two points in my project resource allocation of small cellular network
Walter Roberson
Walter Roberson el 7 de Nov. de 2015
Does the circle need to be 10 cm radius, or does it not need to be 10 cm radius?
Remember, a specification of 10 cm radius means that if you put a ruler to the screen, the circle should be 20 cm in diameter on the display. So, if, for example, you were to resize the plot, then the code would need to detect that and automatically change the size of the circle drawn relative to the other things on the screen so that it continued to be 10 cm radius.

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 7 de Nov. de 2015
To put circles at each point, not in the image but in the overlay above the image, you can do this:
hold on;
plot(columns, rows, 'bo', 'MarkerSize', 14);
Adjust MarkerSize as needed.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by