How can I change movie to gray (frame by frame)?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Image Analyst
am 5 Apr. 2013
Why not just use rgb2gray() and im2frame():
kraw = rgb2gray(poj_ramka);
mov(k)= im2frame(kraw);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Convert Image Type finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!