bin2gray function's input is decimal.
Ältere Kommentare anzeigen
if dec2bin converts decimal to binary. and hex2dec converts hexadecimal to decimal. then how come bin2gray converts DECIMAL to gray?
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 29 Mai 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 Kommentare
Walter Roberson
am 30 Mai 2015
bin2gray() is part of the Communications Systems Toolbox
Elad
am 30 Mai 2015
Image Analyst
am 30 Mai 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.
Kategorien
Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!