MATLAB Answers

imadjust low_in high_in, why only in the range [0,1] ?

14 views (last 30 days)
Massimo Zanetti
Massimo Zanetti on 7 Feb 2020
Commented: Massimo Zanetti on 7 Feb 2020
Hello, it looks a bit strange that the function imadjust accepts, other than single/double numeric types, also integer types, but actually one is forced to put low_in and high_in values only in the range [0,1]. It seems one forcedly have to convert its input image to double (so increasing a lot memory usage) to adjust an integer valued image.
Am I wrong?
Max

  0 Comments

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 7 Feb 2020
You have misunderstood. You do not need to change the input image datatype. What you are looking at is the contrast limit specification, and contrast is always a relative factor, from no contrast permitted (0) to comple contrast permitted (1)

  4 Comments

Show 1 older comment
Massimo Zanetti
Massimo Zanetti on 7 Feb 2020
By reading documentation:
J = imadjust(I,[low_in high_in],[low_out high_out]) maps intensity values in I to new values in J such that values between low_in and high_in map to values between low_out and high_out.
It seems it works as I would imagine, but of course this cannot happen because
J = imadjust( A , [600, 30000] , [0, 65535] )
returns error!
Walter Roberson
Walter Roberson on 7 Feb 2020
J = imadjust( A , [600, 30000]/intmax(class(A)) , [0, 65535]/intmax(class(A)) );
Though you would probably use
J = imadjust(A, [600, 30000]/65535, [0 1]);
Massimo Zanetti
Massimo Zanetti on 7 Feb 2020
Thank you Walter.
I came up with the same. However, I think the documentation is misleading on how to use this function, simply because it is not true that values in I are mapped, if you have to scale them before mapping :)
Thanks again.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!