How to reduce valid coin mask true pixels outside valid coins?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Natalie
am 25 Mai 2023
Kommentiert: Ariba
am 28 Jul. 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)
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 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 Kommentare
Image Analyst
am 12 Jul. 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.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!