Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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');

Risposta accettata

Image Analyst
Image Analyst il 1 Ago 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 Commenti
Image Analyst
Image Analyst il 1 Ago 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 il 1 Ago 2022
Aperture that I need to calculate represents the distance between the tongue and the pharyngeal wall as attached in the image

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by