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

1 次查看(过去 30 天)
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');

采纳的回答

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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by