regarding the conversion of rgb to gray scale
Show older comments
what does the code if(size(imagen,3)==3) mean ,why should we % it with RGBimage sir?
Answers (2)
Image Analyst
on 17 Jul 2013
2 votes
It's checking if the image variable "imagen" is indeed a 3D true color image. It makes for robust code to double check for things like that. Maybe it's not an rgb image, despite what you thought. Maybe it's really a grayscale, indexed, or multispectral (more than 3 color channels) image. It's always a good idea to double check in case it might make a difference, like if you need to pass the image into rgb2gray(), conv2(), or other functions that require the image to be a certain type of image.
Azzi Abdelmalek
on 17 Jul 2013
If you have an array A with dimension mxnx3
size(A,1)=m
size(A,2)=n
size(A,3)=3
To use rgb2gray your array should be mxnx3.
Categories
Find more on Introduction to Installation and Licensing 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!