How to reduce valid coin mask true pixels outside valid coins?

3 vues (au cours des 30 derniers jours)
Natalie
Natalie le 25 Mai 2023
Commenté : Ariba le 28 Juil 2023
Hi, I need help for the valid coins segementation. I struggle to resolve the error: Your valid coin mask has one or more true pixels outside valid coins. I have try more than 30 attempts but still don't get to resolve the error. I don' t know where is my code went wrong. I even try many times to adjust the dilate and erode values and find circles values, but still not resolve the error.
[testcoinMask,MaskedtestCoin] = segmentCoinFace(testCoinImage);
se = strel("disk", 25, );
testcoinMask = imfill(testcoinMask, "holes");
testcoinMask = imerode(testcoinMask, se);
imgFilt = imgaussfilt(MaskedtestCoin, 1, "Padding", "circular","FiltterDomain,"Frequency","FilterSize",3);
faceEdgeMask = edge(imgFilt, "sobel", 0.04, "both");
faceEdgeMask(~testcoinMask) = false;
seFE = strel("disk",60,0);
fEdgeMask = imfill(faceEdgeMask, "holes");
BW2 = imdilate(fEdgeMask,seFE);
validCoinMask = BW2 & testcoinMask;
se2 = strel("disk",65,0);
validCoinMask = imdilate(validCoinMask, se2);
imshow(validCoinMask)
[centers,radii] = imfindcircles(validCoinMask,[105,150]);
imshow(validCoinMask);
viscircles(centers,radii,"Edgecolor','b');
coinProps = regionprops("table",validCoinMask,"Area","Perimeter","Centroid");
disp(coinProps)

Réponse acceptée

Image Analyst
Image Analyst le 25 Mai 2023
Don't use imfindcircles. Use bwareafilt to select only a certain number of blobs, or blobs in a certain size range.
  5 commentaires
Image Analyst
Image Analyst le 12 Juil 2023
@Ahsan please start your own new dicsussion thread and attach your "testCoinImage3.png" image and m-file with the paperclip icon. By the way, the call to imadjust is not needed and just slows it down.
Ariba
Ariba le 28 Juil 2023
@Natalie can you please share your code you used to pass the course?

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by