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

2 Ansichten (letzte 30 Tage)
BA am 1 Aug. 2022
Kommentiert: BA am 1 Aug. 2022
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 KommentareKeine anzeigenKeine ausblenden
Image Analyst am 1 Aug. 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?
BA am 1 Aug. 2022
yes, exactly.

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

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 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
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 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.

### 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