I need to write a code in MATLAB that locate circles, finds the center for each
ID: 3865012 • Letter: I
Question
I need to write a code in MATLAB that locate circles, finds the center for each circle and then does that for 250 images and then plot all the centers at the end.
For example, this is one of the images that has three circles in it, the code would need to identify the three cicles, identify their centers and then do the same for 250 different images and the plot all the centers at the end to create another image.
Final rep1.pdf 873426-dt-content-rid-15631838 1/courses/BIEN 142.001 17W/HW4 pdf in imaging. The following image is a simulated example image of three di pen to be fluorescently activated using Betzig's approach to opy. 100 200 300 400 500 600 700 800 900 1000 ction in Matlab that will generate an image that shows the center and rel f each of the three "blobs The data used to generate this image is in the mat omit both your code and the resulting image. There are a number of diffe hat can be used to approach this problem Your score will be severely ma use a pre-written script to solve this problem: I would much rather see a elatively basic Matlab commands and to see some evidence that you rea a solution rather than purely looking up how other people have solved thiExplanation / Answer
inside = 1;
outside = 0;
width = 500;
height = 500;
radius = 250;
cx = 250;
cy = 250;
[x,y] = meshgrid(1:width,1:height
circ = repmat(outside, height, width);
circ((x - cx).^2 + (y - cy).^2 <= radius.^2) =
imagesc(circ); axis images
The code i was referring as follows
n=50; % no of small circle
outside = 0.2; inside = 0.8;
width = 500; height = 500; % square area 0f 500*500
radius = 50; % small circle radius
z=[];
for i=1:2*n
z= ceil(500.*rand(1000,1)); % selecting 2n no of random nos
between 1 to 500 for center coordinates of small circle
end
[x,y] = meshgrid(1:width,1:height);
circ = repmat(outside, height, width);
for i=1:n
circ((x - z(i)).^2 + (y - z(i+n)).^2 <= radius.^2) = inside;
figure(1);title('coverage area diagram --> white- covered area');
imagesc(circ); colormap(gray); axis image;hold on;
end
figure(2);
imhist(circ);grid on;axis([0 1 0 300000]);title('histogram of
image'); % histogram to get no of pixels