Any suggestions to calculate the threshold of pixel intensity (the dip represents low intensity)

1 vue (au cours des 30 derniers jours)
imshow(matrix(:,:,1))
[x ,y]= ginput(2);
I = matrix(:,:,1);
for i=1:size(matrix,3)
I=matrix(:,:,i);
test = improfile(I(:,:,1), [x(1) x(2)] , [y(1) y(2)]);
end
plot(test);
x1= xline(20, 'color', 'r');
x2=xline(29, 'color', 'b');
  2 commentaires
Image Analyst
Image Analyst le 1 Août 2022
What exactly are you looking for? The index where the intensity profile crosses 40? The halfway point from the max intensity to the min intensity?

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 1 Août 2022
Try this:
[cx, xy, profile] = improfile(matrix(:,:,1), [x(1), x(2)] , [y(1), y(2)]);
threshold = (max(profile) + min(profile)) / 2; % Half way point in intensity.
indexLeft = find(profile >= threshold, 1, 'first')
xLeft = cx(indexLeft);
yLeft = cy(indexLeft);
indexRight = find(profile >= threshold, 1, 'last')
xRight = cx(indexRight);
yRight = cy(indexRight);
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
  3 commentaires
Image Analyst
Image Analyst le 1 Août 2022
Give the complete code, not a snippet. And tell me where you clicked on the image.
Yes, I renamed your badly-named "test" variable to a more descriptively -named "profile". But that is not a problem. It will still work.
I don't know what "calculate the 'aperture'" means. I took the profile and found both the x and y location for the threshold at both the left side of the dip and the right side of the dip. What else do you want?
BA
BA le 1 Août 2022
Aperture that I need to calculate represents the distance between the tongue and the pharyngeal wall as attached in the image

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by