How can I change this line?

2 views (last 30 days)
GeonWoo Jeon
GeonWoo Jeon on 4 Sep 2017
Commented: GeonWoo Jeon on 4 Sep 2017
%%displaying
load(['result\' dataName '_DECOLOR.mat'],'dataName','Mask','LowRank','tau');
moviename = ['result\' dataName,'_DECOLOR.avi']; fps = 12;
mov = avifile(moviename,'fps',fps,'compression','none');
for i = 1:size(ImData,3)
figure(1); clf;
subplot(2,2,1);
imshow(ImData(:,:,i)), axis off, colormap gray; axis off;
title('Original image','fontsize',12);
subplot(2,2,2);
imshow(LowRank(:,:,i)), axis off,colormap gray; axis off;
title('Low Rank','fontsize',12);
subplot(2,2,3);
imshow(ImData(:,:,i)), axis off,colormap gray; axis off;
hold on; contour(Mask(:,:,i),[0 0],'y','linewidth',5);
title('Segmentation','fontsize',12);
subplot(2,2,4);
imshow(ImData(:,:,i).*uint8(Mask(:,:,i))), axis off, colormap gray; axis off;
title('Foreground','fontsize',12);
mov = addframe(mov,getframe(1));
end
How can I change the line ??
mov = avifile(moviename,'fps',fps,'compression','none');

Accepted Answer

Guillaume
Guillaume on 4 Sep 2017
avifile was deprecated in R2012a and removed in R2014b. Use VideoWriter instead. That line can probably be replaced by:
writer = VideoWriter(moviename, 'Uncompressed AVI');
writer.FrameRate = fps;
writer.open;
and the addframe line by:
writer.writeVideo(getframe(1));
once all frames are written don't forget to close the file with:
writer.close;

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!