From: Bryan Buckley on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <071db063-25fb-462f-9327-7af81cc580d7(a)c14g2000yqm.googlegroups.com>...
> On Aug 21, 2:47?pm, Robbie Plankenhorn <rplankenh...(a)gmail.com> wrote:
> > I am trying to read in a movie, analyze it, and then write it back
> > out. ?Mainly I want to threshold the movie.
> >
> > After I read in the movie and then analyze the frame, the resulting
> > image is a binary image. ?When I try and call im2frame, I get the
> > error:
> >
> > ??? Error using ==> avifile.addframe at 86
> > FRAME must be of either double or uint8 precision
> >
> > I have also tried passing in a graymap with the binary image like
> > this:
> >
> > mov = im2frame(bw,gray(256));
> > ??? Error using ==> im2frame
> > Can only make movie frames from image matrices of type double or uint8
> >
> > But as you can see I get the same error.
> >
> > Is there a way to convert a binary image so that it can then be added
> > to an AVI movie?
> >
> > Thanks,
> > Robbie
>
> -------------------------------------------------
> How about converting to uint8 like it said?
> eightBitImage = uint8(binaryImage); % Converts logical data
> type into uint8.
> Seems like that should work, don't you agree?

This solution gives the error:
??? Error using ==> im2frame
Indexed movie frame must have a non-empty colormap

This code will do what you want:
binary_mov(index) = im2frame(repmat(uint8(bw).*255, [1 1 3]));

It makes a bw image/frame in the RGB colorspace.
From: ImageAnalyst on
Or skip the repmat() and just pass in gray or 'gray' for the colormap
- either way.