[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Anybody have a prgram to write a .bmp file?

From: Robert A. Macy
Subject: Re: Anybody have a prgram to write a .bmp file?
Date: Tue, 06 Feb 2007 08:19:05 -0800


I don't understand what you said.

The X index matrix is square, the same siaxe as the r,g,b
matrices, and consists of integers going from one up to the
total size of the matrix: rows*columns

The map is the similar size of 
  rows*columns by 3
and the values in the matrix are between 0 and 1

colourmap appears to be 64 by 3 no matter what I do, even
if I clear the thing, it comes back after
>> [X,map]=rgb2ind(r,g,b);

It sounds like you're trying to limit the color from 24 bit
down to 256 color, but how do I do that using these

               - Robert -

On Mon, 5 Feb 2007 20:17:55 -0500
 Paul Kienzle <address@hidden> wrote:
> On Jan 30, 2007, at 10:01 PM, Robert A. Macy wrote:
> > Thanks for pointing that function out.  I did a bmp
> search
> > all through the octave manual and never found that
> > function, or any reference to it.
> >
> > However, it has the same flaw that all the image
> functions
> > are doing:
> >>> r=ones(256,1)*(0:255)/255;
> >>> g=.5*ones(256,256);b=.5*ones(256,256);
> >>> [X,map]=rgb2ind(r,g,b);
> >>> bmpwrite(X,map,"Xtest.bmp");
> > when opened the square is not gradually changing color
> as
> > expected, but a solid green square.
> >
> > Same thing this function did:
> >>> imshow(r,g,b);
> > maybe the problem is in that map routine?
> I've hardcoded 256 colours in the colourmap, so you can't
> use indexed colours with large maps.
> The simplest fix is to detect whether the colourmap is
> larger then 65536 (in which case, just store the
> truecolour
> image from looking up the colours in the colourmap), or
> larger then 256 (in which case, pixel size is 16, and
> output data is of type 'ushort' rather than 'uchar').
> The next simplest is to give rgb2ind a colourmap
> argument,
> and look up the closest matching colour in the colourmap
> to the colour in the image.  This can be improved by
> comparing in a perceptual scale rather than rgb.
> Someone taking an image signal processing course might
> enjoy implementing a version of rgb2ind which accepts
> a colourmap length and using a perceptual-based map,
> chooses the set of colours which minimizes the
> quantization error.
> - Paul

reply via email to

[Prev in Thread] Current Thread [Next in Thread]