Wants to input an rgb image and get the classified image as an rbg instead of greyscale

1 次查看(过去 30 天)
I am new to Matlab and I am finding it difficult to input a color image and give the classified output as color image. Instead I am only able to do for greyscale image. I have done the code for greyscale image. Please help me out. Can someone help me with the code to output as coloured image rather than a grayscale image. I have attached my code as well.

采纳的回答

Image Analyst
Image Analyst 2020-9-28
Have you tried colormap() and colorbar() to apply a colormap to the gray levels in the classified image?
  6 个评论
Image Analyst
Image Analyst 2020-9-29
You can't. Once an RGB true color image has been indexed into a monochrome (indexed) image plus a colormap, it's been quantized and you will lose some of the original colors. You'll get a posterized-looking image if you use ind2rgb(grayImage, map), though it might look reasonable if you chose enough colors to use in the colormap, like a hundred or more. If you have only 16 or fewer colors in your colormap, it will look like a cartoon - posterized.
This has nothing whatsoever with deep learning or classification though.
Saying that this particular image has a stop sign in it classifies that image as having a stop sign in it. But it does not classify every single pixel in the image. For example, it does not say this pixel is from a stop sign, that pixel is from a roadway, and the other pixel is from the sky (or car, or lawn, or whatever). For that you'd need something like SegNet rather than a classification CNN. SegNet will classify every pixel in an image but CNN just says if your image has an object from a predefined set of objects in it.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by