Effacer les filtres
Effacer les filtres

How to set radii in imfindingcircles function?

74 vues (au cours des 30 derniers jours)
Elisa
Elisa le 18 Juil 2024 à 9:25
Réponse apportée : Deepak le 18 Juil 2024 à 11:09
dear all, i'm trying to create a mask for this image based on the fuction imfindingcircles. I tried setting different thresholds but I didn't get the rigth result. Can anybody help me? than I would like to set NaN to the mask. Thank you in advance!
clear all
close all
clc
A= imread('image_1567.png');
[rows, columns, numberOfColorChannels] = size(A)
%imshow(A)
[centers,radii] = imfindcircles(A,[50 100],Sensitivity=0.9);
mask = circles2mask(centers,radii,size(A));
figure
montage({A,mask})
A(~(A == mask)) = nan
  2 commentaires
Shantanu Dixit
Shantanu Dixit le 18 Juil 2024 à 9:40
Hi Elisa, can you share the image you are working on?
Elisa
Elisa le 18 Juil 2024 à 9:59
yes sure, it was missed, sorry

Connectez-vous pour commenter.

Réponse acceptée

Deepak
Deepak le 18 Juil 2024 à 11:09
Hi,
The radius range set in the imfindcirclesmethod is "[50 100]". It needs to be in the range "[500 650]" to detect the circle present in the PNG image provided by you.
Also, the sensitivity parameters need to be set to “0.95” instead of “0.9” due to the low contrast difference between black background and grey circle.
Here is the updated code snippet that will detect the circle to mask –
[centers,radii] = imfindcircles(A,[500 650],Sensitivity=0.95);
Attaching the documentation of “imfindcircles for reference –

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by