I am writing a function that can display an image and perform certain smoothing tasks. At the very beginning of my function, I convert the image to grayscale using pic = rgb2gray(pic);
I hope that the function will allow you to make any image (even if it already has shades of gray). In Matlab, if I pass him a grayscale image, it is currently erroneous because it cannot convert it (which is obvious).
Is there a built-in function or an easy way to test the image and determine its color format?
I read on google something about the isRGB and isGrayscale functions, but they were removed from later versions of Matlab ...
I think something like this would be great if it had a built-in function.
if (pic == RGB) do . . . elseif (pic == GrayScale) do . . . else do . . .
If not, maybe I could write a function that takes pixel x,y and checks its value?
if (p(x,y) == .... or something else? I'm not sure ... Thoughts?
source share