Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB At the end of the code, I'm trying to separate the coins based of radii but it ain't working properly, it's recording all 33

MATLAB At the end of the code, I'm trying to separate the coins based of radii but it ain't working properly, it's recording all 33 coins for each category. Please help!!!

clc; close all; clear all;

rgb = imread('coins.jpg'); figure imshow(rgb)

d = drawline; pos = d.Position; diffPos = diff(pos); diameter = hypot(diffPos(1),diffPos(2)) gray_image = rgb2gray(rgb); figure imshow(gray_image) [centers,radii] = imfindcircles(rgb,[20 40],'ObjectPolarity','dark') [centers,radii] = imfindcircles(rgb,[20 40],'ObjectPolarity','dark', ... 'Sensitivity',0.9) figure imshow(rgb) h = viscircles(centers,radii); [centers,radii] = imfindcircles(rgb,[20 40],'ObjectPolarity','dark', ... 'Sensitivity',0.92);

length(centers) delete(h) h = viscircles(centers,radii); [centers,radii] = imfindcircles(rgb,[20 40],'ObjectPolarity','dark', ... 'Sensitivity',0.92,'Method','twostage');

delete(h) h = viscircles(centers,radii); [centers,radii] = imfindcircles(rgb,[20 40],'ObjectPolarity','dark', ... 'Sensitivity',0.95);

delete(h) viscircles(centers,radii); figure imshow(gray_image) [centersBright,radiiBright] = imfindcircles(rgb,[20 40], ... 'ObjectPolarity','bright','Sensitivity',0.92); figure imshow(rgb)

hBright = viscircles(centersBright, radiiBright,'Color','b'); [centersBright,radiiBright,metricBright] = imfindcircles(rgb,[20 40], ... 'ObjectPolarity','bright','Sensitivity',0.92,'EdgeThreshold',0.05);

delete(hBright) hBright = viscircles(centersBright, radiiBright,'Color','b'); h = viscircles(centers,radii);

B = sort(radii); disp(B)

penny = (B >= 23.8086) & (B = 24.8442) & (B = 25.0321) & (B = 30.8523) & (B

disp(penny) numpennies = numel(penny); numfiver = numel(fiver); numdime = numel(dime); numquarter = numel(quarter);

totalvalue = (numpennies*1 + numfiver*5 + numdime*10 + numquarter*25); disp(totalvalue)

image text in transcribed

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

What are the objectives of Human resource planning ?

Answered: 1 week ago

Question

Explain the process of Human Resource Planning.

Answered: 1 week ago