bin2gray function's input is decimal.
Show older comments
if dec2bin converts decimal to binary. and hex2dec converts hexadecimal to decimal. then how come bin2gray converts DECIMAL to gray?
Accepted Answer
More Answers (1)
Image Analyst
on 29 May 2015
You'll have to ask whomever wrote it. It's not part of MATLAB.
A built-in MATLAB function to convert floating point numbers in any range to grayscale is called mat2gray() . It scales the min to 0 and the max to 1. If you want a uint8 image, you can do
grayImage = uint8(255 * mat2gray(floatingPointMatrix));
3 Comments
Walter Roberson
on 30 May 2015
bin2gray() is part of the Communications Systems Toolbox
Elad
on 30 May 2015
Image Analyst
on 30 May 2015
Thanks Walter. I've added the Communications System Toolbox to the Products list for Elad. If he had put that there, I would have figured out where that function came from.
Elad, it's in a special toolbox that you have so that's why it shows up in your MATLAB help but not mine . I don't think it's a common toolbox - only 188 of 159,300 questions here in Answers deal with it. The most discussed toolboxes here are Imaging and Signal - #1 and 2 toolboxes respectively.
Categories
Find more on MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!