Question
Help with matlab please?
You are given an idealised test image with a single circular feature. You are to develop an algorithm and implement that algo
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The image is stored in the same directory as the file, under the name 'test.png'.

The required code, along with the description of the algorithm is given as under:

% Reeading up the image and preporcessing
% The image is firstly converted in grayscale. Then it is binarized so as
% to clearly separate out the circle from the image
img = imread('test.png');
img = rgb2gray(img);
[m,n] = size(img);
imshow(img);

imgb = zeros(m,n);
for i = 1:m
for j = 1:n
if img(i,j) > 100
imgb(i,j) = 255;
else
imgb(i,j) = 0;
end
end
end
imshow(imgb);

% The number of pixels in the circle is obtained, so as to find out the
% area of the circle

count = 0;
for i=1:m
for j=1:n
if imgb(i,j) == 255
count = count + 1;
end
end
end

dia = 0;
startx = 0;
starty = 0;
endx = 0;
endy = 0;

% The radius and the center is obtained by finding out the diameter line of
% the circle. Then its length is used to find out the radius, and the
% midpoint gives out the center of the circle.

for i=1:m
for j=2:n-1
if imgb(i,j) == 255 && imgb(i,j-1) == 0
startx = i;
starty = j;
end
if imgb(i,j) == 255 && imgb(i,j+1) == 0
endx = i;
endy = j;
end
end
x = endy - starty;
if x > dia
dia = x;
centerx = startx;
centery = (endy + starty)/2;
end
end
radius = dia/2;

% Display Data
fprintf('Center of Circle: (%.2f,%.2f)\n', centerx, centery);
fprintf('Radius of Circle: %.2f pixels\n', radius);
fprintf('Area of Circle: %.2f pixels\n', count);

======================================================================================

circle,m ×1+ % Reeading up the image and preporcessing % The image is firstly converted in grayscale. Then it is binarized so

% The radius and the center is obtained by finding out the diameter line of % the circle. Then its length is used to find out

--------------------------------------------------------------------------------------------------------------------------------------

The screenshot of the code execution and the binarized image is given as under:

Figure 1 Command Window Eile Edit View Insert Iools Desktop Window Help »> circle Center of Circle: (174.00, 189.50) Radius o

Add a comment
Know the answer?
Add Answer to:
Help with matlab please? You are given an idealised test image with a single circular feature. You are to develop an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • can you just help with the first 3 parts? 4.1 Tas 1 feature : Process a low resolution sensor image with an ideali...

    can you just help with the first 3 parts? 4.1 Tas 1 feature : Process a low resolution sensor image with an idealised You are given an idealised test image with a single circular feature. You are to develop an algorithm and implement that algorithmin the form of a MATLAB program that is capable of performing the following tasks Find the centre of the circular feature in pixels. 2. Calculate the radius of the feature in pixels. Calculate the area...

  • Task 2: (2 Marks) Noisy Image Restoration You have been provided with seven images named IMG-5698. JPG to IMG-5704. JPG...

    Task 2: (2 Marks) Noisy Image Restoration You have been provided with seven images named IMG-5698. JPG to IMG-5704. JPG. These images were taken in low light conditions with a very high ISO setting which results in "noise" on the image (random fluctuations in pixel intensity) and "bright pixels" (pixels which appear bright in every image, despite not being hit by light) In addition to the seven source images you are also provided with a "dark frame", dark.png. This is...

  • use MATLAB to upload the following: an image that you want to process (can be taken...

    use MATLAB to upload the following: an image that you want to process (can be taken yourself or downloaded from the internet) a script that processes the image in TWO ways. manipulates the colors averages pixels together Please make sure the script displays the images (like how I did with the 40 and 80 pixel averaging) so I can easily compare them to the original. Make sure to COMMENT your code as well. Homework 13 Please upload the following: an...

  • Evaluate using MATLAB. The problem has been solved arithmatically but MATLAB code is needed. Use Matlab...

    Evaluate using MATLAB. The problem has been solved arithmatically but MATLAB code is needed. Use Matlab to evaluate: A tube with length of 1 m is made from steel (k 15 W/m/K) having a square cross section with a circular hole through the center, as shown below Calculate the steady state temperature distribution across the cross section and the total rate of heat transfer if the inner surface is held at 20 °C, and the outer surface is held at...

  • I need help solving these questions,please don’t know how to solve it by using matlab.!

    i need help solving these questions,please don’t know how to solve it by using matlab.! Solve the following questions Ol: You are required to develop a script to calculate the volume of a pyramid, which is 1/3 *base *height, where the base is length *width. Prompt the user to enter values for the length, width, and height, and then calculate the volume of the pyramid. When the user enters each value, he or she will then also be prompted to...

  • Need help on this Matlab problem, I do not know how to do it Problem 2....

    Need help on this Matlab problem, I do not know how to do it Problem 2. (2D Sorting) The following table contains the scores for the 4 students A,B.C and D for four Homeworks HW1 50 20 85 65 HW2HW 45 80 30 95 HW4 75 35 15 80 Student A Student B Student C Student D 40 60 100 a) Create a matrix with the above data b) What is the minimum score of all four homework? (use the...

  • 3) You are in charge of the Aurora Project. Given the following project network, baseline, and...

    3) You are in charge of the Aurora Project. Given the following project network, baseline, and status information, (40 Points) B DI OA E • Develop status reports for periods 7 and complete the performance indices table. . Calculate the EAC, and VAC. Based on your data, what is the current status of the project? At completion? Rule 1 0% complete 2-50/50 3 - 0/100 ID LF SL Schedule information Total 0 1 2 PV 3 4 30 5 6...

  • This problem will introduce you the MATLAB (if you have not used it before). In this...

    This problem will introduce you the MATLAB (if you have not used it before). In this course we will use MATLAB in a limited fashion to give you a glimpse on how it is used to solve engineering problems. In your junior year, you will spend an entire semester in AEM 3101 becoming very proficient in using MATLAB for engineering modeling and simulation purposes. In this problem you will use MATLAB to accomplish the following tasks: (a) Write a function...

  • please I would like assistance with this which are question 1 and 2, thank you 2....

    please I would like assistance with this which are question 1 and 2, thank you 2. We have 5 objects, and the weights and values are No. 2 3 4 5 10 20 30 50 V 20 30 66 60 55 W 40 The knapsack can carry a weight not exceeding 90, find a subset items and give the total weight and value for following algorithms: 1) By using the algorithm of greedy of value for 0-1 knapsack problem? By...

  • Can you please answers these four questions as aoin as possible please and thank you! Given...

    Can you please answers these four questions as aoin as possible please and thank you! Given are five observations for two variables, z and y 5 13 20 18 48 57 11 27 a. Choose the corre rect scatter diagram for these data: A. B. 60+ 60 50 50 40 40 30+ 30 20 20 10 10- 10 20 30 40 50 60 x 10 20 30 40 50 60 57 x y 60 60 50+ 50- 40- 40+ 30-...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT