[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: |
Wed, 31 Jan 2007 23:49:27 -0800 |
the version of octave I'm using does not have capability to
handle a matrix that has 3 indices, only 2.
If I duplicate your formula, I get an error with the
reshape
I can't put three values in for reshaping a matrix.
>> Y=reshape( [r,g,b], 256*256,3);
will run but then
>> bmpwrite( Y*255, "Xtest.bmp");
doesn't work, because it generates an error that the file
name is missing
- Robert -
On Thu, 01 Feb 2007 15:12:02 +1100
Geordie McBain <address@hidden>
wrote:
> On Wed, 2007-01-31 at 19:44 -0800, Robert A. Macy wrote:
> > Is there another way?
> >
> > cat comes back as undefined.
>
> Yes, you can use reshape ([r, g, b], [(size (r)), 3]);
> e.g.
>
> ---
> octave:25> n=3; m=5; r = rand (n, m); g = rand (n, m); b
> = rand (n, m);
> octave:26> all ((reshape ([r, g, b], [(size (r)), 3]) ==
> cat (3, r, g,
> b)) (:))
> ans = 1
> ---
>
> >
> > On Wed, 31 Jan 2007 21:06:09 -0500
> > Paul Kienzle <address@hidden> wrote:
> > >
> > > On Jan 30, 2007, at 10:01 PM, Robert A. Macy wrote:
> > >
> > > > 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.
> > >
> > > bmpwrite is expecting values in 0-255. Try the
> > > following:
> > >
> > > r=ones(256,1)*(0:255)/255;
> > > g=.5*ones(256,256);b=.5*ones(256,256);
> > > bmpwrite(cat(3,r,g,b)*256,'Xtest.bmp');
> > >
> > > - Paul
> > >
- Re: Anybody have a prgram to write a .bmp file?,
Robert A. Macy <=