Syntax_Error
Syntax_Error

Reputation: 6210

Create a movie from RGB data stored in Array in MATLAB

I have a set of images stored in an array, created as follow:

NewClip = cat(4, NewClip, SingleFrame);

where SingleFrame is an RGB frame

I am passing the array NewClip to a new function to create a movie out of it as follows:

    for ThisScene=1:K
    for ThisFrame=1:NewVideoRelativeLength
        NewVideo(:,:,:,TempIndex)=NewClip(:,:,:,ThisScene);
        TempIndex=TempIndex+1;
    end
end

in which I iterate to make each frame show for a fixed length...

Doing so I am getting a video with red pixels and blue and yellow and not the actual images in movies. If I do imshow(NewClip(:,:,:,2)), I get a correct image so the images are correctly mapped in the array.

Should I do something before setting the frame to the video?

Upvotes: 1

Views: 614

Answers (1)

Shai
Shai

Reputation: 114786

It might be the case that your NewVideo is a double array with values in range [0..255].
try

>> implay( uint8(NewVideo), 10 );

or

>> implay( NewVideo/255, 10 );

Upvotes: 1

Related Questions