How can I change movie to gray (frame by frame)?
5 views (last 30 days)
Show older comments
I know there are probably easier methods but it must be frame by frame
this is what I have:
movi = VideoReader('xylophone.mpg');
nFrames = movi.NumberOfFrames;
vidHeight = movi.Height;
vidWidth = movi.Width;
mov(1:nFrames) = ... struct('cdata', zeros(vidHeight, vidWidth, 3, 'uint8'),... 'colormap', []);
for k = 1 : nFrames
poj_ramka=mov(k).cdata;
funkcja=zad(poj_ramka);
kraw=uint8(funkcja)*255;
kraw=cat(3,kraw,kraw,kraw);
mov(k)=struct('cdata',kraw,'colormap',[]);
end
okno=figure;
set(okno,'position',[150 150 vidWidth vidHeight]);
movie(okno,mov,1,25);
and zad.m file:
function[obraz]=zad(poj_ramka)
obraz=rgb2gray(poj_ramka);
end
what i get is a black window :/
0 Comments
Accepted Answer
Image Analyst
on 5 Apr 2013
Why not just use rgb2gray() and im2frame():
kraw = rgb2gray(poj_ramka);
mov(k)= im2frame(kraw);
0 Comments
More Answers (0)
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!