rgbImage = grayImage / max(max(grayImage));
or
rgbImage = grayImage / 255;
Which of the above is right,and reason?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To convert a grayscale image to an RGB image, there are two issues you have to address:
doubledata type, the image pixel values should be floating point numbers in the range of 0 to 1. When stored as auint8data type, the image pixel values should be integers in the range of 0 to 255. You can check the data type of an image matrix using the functionclass.Here are 3 typical conditions you might encounter:
To convert a
uint8ordoublegrayscale image to an RGB image of the same data type, you can use the functionsrepmatorcat:To convert a
uint8grayscale image to adoubleRGB image, you should convert todoublefirst, then scale by 255:To convert a
doublegrayscale image to auint8RGB image, you should scale by 255 first, then convert touint8: