Inflection points on grayscale image histogram

1 view (last 30 days)
I have a grayscale image, then plotted the histogram using imhist. Now, I need to find the first inflection point of the histogram. That point halfway up, when the bell-shape curve starts to change (see red line in attached jpg). I calculated first and second derivative of the histogram, but I'm stuck on how to get that point. My code looks something like this:
I = imread('dog3.jpg');
%figure; imshow(I)
%Calculating and plotting histogram of image
y = imhist(I);
f1 = diff(y);
f2 = diff(f1);
figure; imhist(I)
figure; plot(y)
figure; plot(f2)
image.jpeg

Accepted Answer

Star Strider
Star Strider on 24 Jan 2019
Use the gradient (link) function to calculate the numerical derivative, not the diff function.
See if the approach in my Answer to How to draw tangent line at infleciton point? (link) will work for you.
  12 Comments
Star Strider
Star Strider on 31 Jan 2019
I am still doing my best to figure out what you are doing in your code with respect to the inflection points.
Meanwhile, one way to find FWHM is to use the midcross (link) function. (It was introduced in R2012a.)
specifically:
mcy = midcross(y);
produces:
mcy =
23.4983
38.7014
So:
FWHM = diff(mcy)
FWHM =
15.2031
Those values are in terms of the ‘x’ variable being defined as:
x = 1:numel(y);
so essentially the indices of ‘y’.

Sign in to comment.

More Answers (1)

Veronica Morales
Veronica Morales on 25 Jan 2019
Whoa! Thanks for asking. Well my intension is automatization of a process. I need to select that value as the dark level, when the histogram start changing. Don't have more info of why it has to be that point. AS of today we are doing it manually, and want to get away from that, because I have to do the same with hundreds of images...kinda' tedious heh?! I have no clue about all those other methods you mentioned (well getting the FWHM I know). So based on what I was doing, selecting that point visually, I thought it was similar as selecting an inflection point.
  1 Comment
Veronica Morales
Veronica Morales on 25 Jan 2019
hum...you are right (obviously) maybe what I need is the FWHM...now I need to figure out how to do it.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!