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

조회 수: 6 (최근 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
renit anthony
renit anthony 2020년 9월 29일
I just want to know how to get a greyscale images color back using the original image using colormap.
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