0

I want to use the label2rgb function to construct a color image with a labeled image issued from a segmentation process.

So I compute a color map n-by-3 which contain the meanvalue of each region detected in the segmentation. and I make this:

Lrgb = label2rgb(L, coul);

where L is tha labeled image, but I got this error:

??? Error using ==> label2rgb>parse_inputs at 147
Invalid entry for MAP.

Error in ==> label2rgb at 50 [label,map,zerocolor,order,fcnflag] = parse_inputs(varargin{:});

Error in ==> test at 241 Lrgb = label2rgb(L, coul);

Thank you,

Shai
  • 111,146
  • 38
  • 238
  • 371
mariem
  • 11
  • 3

1 Answers1

0

Make sure max(L(:)) <= n and that min(L(:)) >= 0, otherwise you'll get into trouble.

Shai
  • 111,146
  • 38
  • 238
  • 371
  • 1
    @mariem - what do YOU mean by `n`: "I compute a color map n*3". This `n` should be the number of labels in `L`. – Shai May 22 '13 at 14:08
  • I find the problem, in fact, it seems that the map matrix must have element value between 0 and 1 – mariem May 22 '13 at 14:43
  • @mariem it should be a colormap - `n`-by-3 in range [0..1] of type `double`. – Shai May 22 '13 at 14:48