Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, Please help me fill the circles with colors randomly on the following image using matlab, below is the code and the image, thank you

Hello, Please help me fill the circles with colors randomly on the following image using matlab, below is the code and the image, thank you for your help in advance

image text in transcribed

% initializing image with white background

img=255*ones(256,256);

% ring center

h=128;k=128;

t=210:30:540;

% circle max radius

r=22;

% ring radius

R=80+r;

% generating centres for circle

x=round(R*cosd(t)+h);

y=round(R*sind(t)+k);

% coloring circles

for n=1:12

r=10:22;

for i=x(n)-r(n):x(n)+r(n)

for j=y(n)-r(n):y(n)+r(n)

if sqrt((i-x(n))^2+(j-y(n))^2)

img(i,j)=200;

end

end

end

end

% converting matrix to image

img=uint8(img);

% displaying image

imshow(img)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions