MATLAB Answers

how do I classify image based on smoothness and high frequency?

3 views (last 30 days)
nadia naji
nadia naji on 19 Apr 2021
Answered: Image Analyst on 19 Apr 2021
Hello,
I have some blocks of image and I need to find out the block is smooth or is full of edge, but I really do not know how I can do this. could you please help me with this issue or introduce me to a link or tutorial for this? does matlab have any function for this? thank you.
  3 Comments
Bjorn Gustavsson
Bjorn Gustavsson on 19 Apr 2021
@Jonas: Nah, no need to, it is a worthwhile suggestion. There are more steps towards a complete answer to this question, my suggestion is a "better step" - but more steps might be necessary - std of the laplacian, entropy of the laplacian etc...

Sign in to comment.

Answers (2)

Bjorn Gustavsson
Bjorn Gustavsson on 19 Apr 2021
For measure of smoothness I'd go with something like this:
d2I = del2(I); % laplacian of your image (grayscale, double).
From there we could do many calculations of the statistics of the second-derivative-variations:
avg_d2I = mean(d2I(:));
avg_d2I2 = mean(d2I(:).^2);
std_d2I = std(d2I(:));
mad_d2I = mad(d2I(:));
Just to mention a couple. You have to judge what values correspond to smooth and non-smooth in your data. You could also look at the gradients instead of the laplacian, but you can to doodle with that in the same way as I've sketched here...
HTH

Image Analyst
Image Analyst on 19 Apr 2021
nadia, you forgot to post the image. We don't know what it looks like, or how big the blocks are relative to the total image size. Please post the image in your original post.
In the meantime, I suggest you try sdtfilt() and take the mean and see if that works for you.
sdImage = stdfilt(grayImage, true(5));
smoothnessMetric = mean2(sdImage)
If it doesn't work well for you, then we can discuss other metrics, after we see the image(s).

Community Treasure Hunt

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

Start Hunting!

Translated by