How can I change movie to gray (frame by frame)?

2 Ansichten (letzte 30 Tage)
kurczak
kurczak am 5 Apr. 2013
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 :/

Akzeptierte Antwort

Image Analyst
Image Analyst am 5 Apr. 2013
Why not just use rgb2gray() and im2frame():
kraw = rgb2gray(poj_ramka);
mov(k)= im2frame(kraw);

Weitere Antworten (0)

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by