Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Maximums Intensities of an Image

lee_mylolee_mylo Posts: 18Member
Hi to all!

If I want to find the maximum intensity of an image I write

max_int = max(Image(:))

If I want to find the second maximum intensity of an image (or the third, fourth etc. ) how can I write it?

Thank you in advance

Comments

  • giuggiug Posts: 217Member
    If you have a uint8 image with values in the range [1 255] you can try to use the imhist function with the parameter n=256 (see the matlab help)
    In this way every luminance value of your image is "counted".
    [counts,x] = imhist(I,256)

    then the last values of x [u]x(end)[/u] is the maximum value of the image (you have to check that the corresponding count is not null) and [u]counts(end)[/u] is the number of pixels with that value. Then, if you want to find the positions of this values in your image:
    pos=find(Image==x(end));

    Then you can loop this procedure checking [u]x(end-1)[/u], [u]x(end-2)[/u], etc. Always checking if the corresponding count is not null.


Sign In or Register to comment.