How to reduce valid coin mask true pixels outside valid coins?
Show older comments
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)

Accepted Answer
More Answers (0)
Categories
Find more on Image Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!