currently i am working on video files.Can you tell how to perform multilevel histogram thresholding on the gray scale images extracted from the video files?
because you pass a 1x1 x value and a 1x2 y value to line, it actually plots two points, not a line. One point at (thresholdLevel, y(1)) the other at (thresholdLevel, (y(2)).
graythresh return anormalised threshold in the range [0 1], so to plot your line on your histogram you need to scale the threshold back to the intensity range of your image
So the fix:
line(repelem(threshold * intmax('uint16'), 2), y, 'Color', 'r')
Best Answer