MATLAB批量处理图像数据
需求分析说明
在图像处理过程中,尤其是针对一个图像视频,首先,将视频中的图像解析成或者已经保存成一张图,在图像算法处理完每幅图之后,会看下视频中的所有帧整合后的效果。以下就是以MATLAB将图像转化成GIF数据的具体方法。
clc;clear all;
fig_handle = figure;colormap gray;
filename='地址.gif';
NumberStart = 1;
NumberEnd = 100;%最后一张数量
for no = NumberStart :NumberEnd
no
str = ['图片地址' num2str(no), '.png'];
A=imread(strcat(num2str(str)));
imagesc(A);
axis off
axis image
frame=getframe(fig_handle);
im=frame2im(frame);%制作gif文件,图像必须是index索引图像
[I,map]=rgb2ind(im,255);
k=no;
if k==NumberStart
imwrite(I,map,filename,'gif','Loopcount',inf,'DelayTime',0.125);
else
imwrite(I,map,filename,'gif','WriteMode','append','DelayTime',0.125);
end
end

被折叠的 条评论
为什么被折叠?



