How can I display videos without movie()?

3 views (last 30 days)
Enes Alkan
Enes Alkan on 2 Apr 2020
Commented: Image Analyst on 3 May 2020
Hello, first of all I am sorry for my English.
I am making a project on GUI. It is video denoising. First video is original video, second one is noised video, third one is denoised video. When I use this code, filtered videos get longer. It is like a slow motion video. Let's say that original video is 7 seconds. Noisy video is more than that. And also filtered video is longer than original video.
I can solve it using movie(). But I want to compare videos. I want to see all of them in the screen. I don't want to use figure to create a new window.
But movie() always waits for the playing to finish.
Here is my gui.fig
% Here is my original video
v=VideoReader(filename);
H=v.Height;
W=v.Width;
s1=struct('cdata', zeros(H,W,3, 'uint8'), 'colormap', []);
k=1;
axes1=handles.axes1;
while hasFrame(v)
s1(k).cdata=readFrame(v);
image(s1(k).cdata,'Parent',axes1);
pause(1/v.FrameRate);
k=k+1;
end
% Here is my noisy video
value= get(hObject,'Value');
s2=struct('cdata', zeros(H,W,3, 'uint8'), 'colormap', []);
axes2=handles.axes2;
if value==2
for i=1:k-1
s2(i).cdata=tuzbiberGurultusu(s1(i).cdata);
image(s2(i).cdata,'Parent',axes2);
pause(1/v.FrameRate);
end
end
% Here is my filtered video
value= get(hObject,'Value');
s3=struct('cdata', zeros(H,W,3, 'uint8'), 'colormap', []);
axes3=handles.axes3;
if value==2
for i=1:k-1
h=fspecial('average',3);
s3(i).cdata=imfilter(s2(i).cdata,h);
image(s3(i).cdata,'Parent',axes3);
pause(1/v.FrameRate);
end
end

Answers (2)

Harshendra Shah
Harshendra Shah on 9 Apr 2020

Image Analyst
Image Analyst on 3 May 2020
If you want to have the OS play the movie, try calling winopen(filename) (Windows only), or system().
  2 Comments
Enes Alkan
Enes Alkan on 3 May 2020
So I should write video to file and then I should call winopen() ?
Image Analyst
Image Analyst on 3 May 2020
You can do that if you want. Another way wuld be to make a new movie where you stitch together the frames from the two movies side by side. That way they'll always by in sync.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!