From: Tim Perkins on
Hello,

I'm writing a Matlab driver for a 3D LIDAR, which spits out images as requested.

I'm trying to plot images, with a custom colormap. Each pixel is a single, and ranges from 0 to 200, or is -1 if "too close", or -2 for "too distant".

I've tried creating a colormap as follows:

colormap([0,0,0; 1,1,1; hsv(200)]);
caxis([-2, 200]);

But this doesn't work. Anything below 2 is black, 2 is white, 3 and above is HSV. Am I doing something wrong? I've been searching for awhile, but I haven't made any progress.

Thanks in advance for any help.
From: us on
"Tim Perkins" <tprk77(a)gmail.com> wrote in message <hvqste$k94$1(a)fred.mathworks.com>...
> Hello,
>
> I'm writing a Matlab driver for a 3D LIDAR, which spits out images as requested.
>
> I'm trying to plot images, with a custom colormap. Each pixel is a single, and ranges from 0 to 200, or is -1 if "too close", or -2 for "too distant".
>
> I've tried creating a colormap as follows:
>
> colormap([0,0,0; 1,1,1; hsv(200)]);
> caxis([-2, 200]);
>
> But this doesn't work. Anything below 2 is black, 2 is white, 3 and above is HSV. Am I doing something wrong? I've been searching for awhile, but I haven't made any progress.
>
> Thanks in advance for any help.

which function do you use to plot the images(?)...

help image;
% or
help imagesc;

us
From: Tim Perkins on
"us " <us(a)neurol.unizh.ch> wrote in message <hvr0mt$1sq$1(a)fred.mathworks.com>...
> "Tim Perkins" <tprk77(a)gmail.com> wrote in message <hvqste$k94$1(a)fred.mathworks.com>...
> > Hello,
> >
> > I'm writing a Matlab driver for a 3D LIDAR, which spits out images as requested.
> >
> > I'm trying to plot images, with a custom colormap. Each pixel is a single, and ranges from 0 to 200, or is -1 if "too close", or -2 for "too distant".
> >
> > I've tried creating a colormap as follows:
> >
> > colormap([0,0,0; 1,1,1; hsv(200)]);
> > caxis([-2, 200]);
> >
> > But this doesn't work. Anything below 2 is black, 2 is white, 3 and above is HSV. Am I doing something wrong? I've been searching for awhile, but I haven't made any progress.
> >
> > Thanks in advance for any help.
>
> which function do you use to plot the images(?)...
>
> help image;
> % or
> help imagesc;
>
> us

I was able to solve my problem. I was using image, but I got things to work using imagesc. Here's what I did:

colormap([0, 0, 0; 1, 1, 1; hsv(200)]);
ih = imagesc(i, [-2, 200]);
axis image;
colorbar;