Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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');

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by