-1

I'm working with this script. The issue is that the result is coloured and I want it in grayscale, but couldn't figure what to change in the script to do that. Do you know what changes I should perform to get the result as grayscale?

Thanks.

Simplicity
  • 47,404
  • 98
  • 256
  • 385
  • Which script? It contains five – Luis Mendo Nov 12 '13 at 22:24
  • If you are talking about the variable `Lrgb`, just use `rgb2gray(Lrgb)` to get a grayscale representation. – chappjc Nov 12 '13 at 22:36
  • @chappjc: Lrgb is eitger `[1,0,0]`,`[0,1,0]` or `[0,0,1]`. Other pixels do not exist. Not sure what rgb2gray really outputs, toolbox is not installed, but probably not a very useful image. – Daniel Nov 12 '13 at 22:40
  • @DanielR: In DemoFCM.m: `Lrgb=reshape(Lrgb,[size(im) 3]); subplot(1,2,2), imshow(Lrgb,[])`. Definitely an RGB image, assuming the input `im` is an image. – chappjc Nov 12 '13 at 22:42
  • @chappjc It is an image, which contains only pure red, green ore blue. The grayscale version will be something around .33 for each pixel (not sure how matlab converts). – Daniel Nov 12 '13 at 22:45
  • 1
    @DanielR Got you. Anyway, `rgb2gray` has a different formula based on visual perception of the intensity of colors, so it would be actually be more like 0.3, 0.59, 0.11 for those R, G, B values. So, I would actually go with your answer! +1 – chappjc Nov 12 '13 at 22:48

1 Answers1

1

Check the Demo, there is a variable "L". It contains a matrix which represents the clusters, thus only the values 1-3 exist. For example (L-1)./2 maps cluster 1 to gray value 0, cluster 2 to gray value 0.5 and cluster 3 to gray value 1.

Daniel
  • 36,610
  • 3
  • 36
  • 69